diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2007-07-21 07:37:34 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-21 20:49:15 -0400 |
| commit | 18de5bc4c1f1f1fa5e14f354a7603bd6e9d4e3b6 (patch) | |
| tree | cb0ff399fb3f368adecf213318e32a499ada6ff9 /kernel/time | |
| parent | 93da56efcf8c6a111f0349f6b7651172d4745ca0 (diff) | |
clockevents: fix resume logic
We need to make sure, that the clockevent devices are resumed, before
the tick is resumed. The current resume logic does not guarantee this.
Add CLOCK_EVT_MODE_RESUME and call the set mode functions of the clock
event devices before resuming the tick / oneshot functionality.
Fixup the existing users.
Thanks to Nigel Cunningham for tracking down a long standing thinko,
which affected the jinxed VAIO.
[akpm@linux-foundation.org: xen build fix]
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/time')
| -rw-r--r-- | kernel/time/tick-broadcast.c | 6 | ||||
| -rw-r--r-- | kernel/time/tick-common.c | 16 |
2 files changed, 14 insertions, 8 deletions
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 8001d37071..8339af229c 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
| @@ -49,7 +49,7 @@ cpumask_t *tick_get_broadcast_mask(void) | |||
| 49 | */ | 49 | */ |
| 50 | static void tick_broadcast_start_periodic(struct clock_event_device *bc) | 50 | static void tick_broadcast_start_periodic(struct clock_event_device *bc) |
| 51 | { | 51 | { |
| 52 | if (bc && bc->mode == CLOCK_EVT_MODE_SHUTDOWN) | 52 | if (bc) |
| 53 | tick_setup_periodic(bc, 1); | 53 | tick_setup_periodic(bc, 1); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| @@ -299,7 +299,7 @@ void tick_suspend_broadcast(void) | |||
| 299 | spin_lock_irqsave(&tick_broadcast_lock, flags); | 299 | spin_lock_irqsave(&tick_broadcast_lock, flags); |
| 300 | 300 | ||
| 301 | bc = tick_broadcast_device.evtdev; | 301 | bc = tick_broadcast_device.evtdev; |
| 302 | if (bc && tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) | 302 | if (bc) |
| 303 | clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN); | 303 | clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN); |
| 304 | 304 | ||
| 305 | spin_unlock_irqrestore(&tick_broadcast_lock, flags); | 305 | spin_unlock_irqrestore(&tick_broadcast_lock, flags); |
| @@ -316,6 +316,8 @@ int tick_resume_broadcast(void) | |||
| 316 | bc = tick_broadcast_device.evtdev; | 316 | bc = tick_broadcast_device.evtdev; |
| 317 | 317 | ||
| 318 | if (bc) { | 318 | if (bc) { |
| 319 | clockevents_set_mode(bc, CLOCK_EVT_MODE_RESUME); | ||
| 320 | |||
| 319 | switch (tick_broadcast_device.mode) { | 321 | switch (tick_broadcast_device.mode) { |
| 320 | case TICKDEV_MODE_PERIODIC: | 322 | case TICKDEV_MODE_PERIODIC: |
| 321 | if(!cpus_empty(tick_broadcast_mask)) | 323 | if(!cpus_empty(tick_broadcast_mask)) |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index a96ec9ab34..77a21abc87 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
| @@ -318,12 +318,17 @@ static void tick_resume(void) | |||
| 318 | { | 318 | { |
| 319 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | 319 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); |
| 320 | unsigned long flags; | 320 | unsigned long flags; |
| 321 | int broadcast = tick_resume_broadcast(); | ||
| 321 | 322 | ||
| 322 | spin_lock_irqsave(&tick_device_lock, flags); | 323 | spin_lock_irqsave(&tick_device_lock, flags); |
| 323 | if (td->mode == TICKDEV_MODE_PERIODIC) | 324 | clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_RESUME); |
| 324 | tick_setup_periodic(td->evtdev, 0); | 325 | |
| 325 | else | 326 | if (!broadcast) { |
| 326 | tick_resume_oneshot(); | 327 | if (td->mode == TICKDEV_MODE_PERIODIC) |
| 328 | tick_setup_periodic(td->evtdev, 0); | ||
| 329 | else | ||
| 330 | tick_resume_oneshot(); | ||
| 331 | } | ||
| 327 | spin_unlock_irqrestore(&tick_device_lock, flags); | 332 | spin_unlock_irqrestore(&tick_device_lock, flags); |
| 328 | } | 333 | } |
| 329 | 334 | ||
| @@ -360,8 +365,7 @@ static int tick_notify(struct notifier_block *nb, unsigned long reason, | |||
| 360 | break; | 365 | break; |
| 361 | 366 | ||
| 362 | case CLOCK_EVT_NOTIFY_RESUME: | 367 | case CLOCK_EVT_NOTIFY_RESUME: |
| 363 | if (!tick_resume_broadcast()) | 368 | tick_resume(); |
| 364 | tick_resume(); | ||
| 365 | break; | 369 | break; |
| 366 | 370 | ||
| 367 | default: | 371 | default: |
