[PATCH] clockevents: Leave broadcast device shtudown only if the current device is always running.

From: Santosh Shilimkar
Date: Mon Apr 09 2012 - 02:04:27 EST


Commit 77b0d60{clockevents: Leave the broadcast device in shutdown mode
when not needed} was intended to leave the broadcast device in shutdown mode
when the per-cpu clockevent devices are always running.

This breaks the systems where per cpu clock events stop in low power states.

Hence revert 77b0d60 and implement the same requirement with use
of C3STOP feature flag.

Not-yet-signed-off-by: Santosh Shilimkar <santosh.shilimkar@xxxxxx>
Cc: Suresh Siddha <suresh.b.siddha@xxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: john stultz <johnstul@xxxxxxxxxx>
---
The 3.4-rc1 kernel introduced a regression with cpuidle and after debugging it
arrowed down the issue to commit 77b0d60 {clockevents: Leave the broadcast
device in shutdown mode when not needed}.

On OMAP, the percpu clock-events die in the low power states and
hence the broadcast clock-event needs to be active. With 77b0d60
patch I was seeing that broadcast device was not getting programmed
while entering in low power states and hence system locks up.

I am not completely sure about this fix and the patch is RFC.

kernel/time/tick-broadcast.c | 4 ----
kernel/time/tick-oneshot.c | 3 ++-
2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index e883f57..fd4a7b1 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -575,15 +575,11 @@ void ntick_broadcast_switch_to_oneshot(void)
unsigned long flags;

raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
- if (cpumask_empty(tick_get_broadcast_mask()))
- goto end;

tick_broadcast_device.mode = TICKDEV_MODE_ONESHOT;
bc = tick_broadcast_device.evtdev;
if (bc)
tick_broadcast_setup_oneshot(bc);
-
-end:
raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
}

diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c
index 8241090..318ec0c 100644
--- a/kernel/time/tick-oneshot.c
+++ b/kernel/time/tick-oneshot.c
@@ -82,7 +82,8 @@ int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *))
td->mode = TICKDEV_MODE_ONESHOT;
dev->event_handler = handler;
clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT);
- tick_broadcast_switch_to_oneshot();
+ if (dev->features & CLOCK_EVT_FEAT_C3STOP)
+ tick_broadcast_switch_to_oneshot();
return 0;
}

--
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/