diff options
author | Ingo Molnar <mingo@elte.hu> | 2007-03-28 07:17:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-28 16:44:31 -0400 |
commit | 935c631db827cc3a96df4dcc6fec374b994fdbd1 (patch) | |
tree | 3f995412e5be1a6180b37dde4e7e8cfeb2bc8665 | |
parent | de326dbe0c8b61b81aab32970236ee9ee47d782a (diff) |
[PATCH] hrtimers: fix reprogramming SMP race
hrtimer_start() incorrectly set the 'reprogram' flag to enqueue_hrtimer(),
which should only be 1 if the hrtimer is queued to the current CPU.
Doing otherwise could result in a reprogramming of the current CPU's
clockevents device, with a timer that is not queued to it - resulting in a
bogus next expiry value.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/hrtimer.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 6a7938a0d513..067ba2c05328 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -814,7 +814,12 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode) | |||
814 | 814 | ||
815 | timer_stats_hrtimer_set_start_info(timer); | 815 | timer_stats_hrtimer_set_start_info(timer); |
816 | 816 | ||
817 | enqueue_hrtimer(timer, new_base, base == new_base); | 817 | /* |
818 | * Only allow reprogramming if the new base is on this CPU. | ||
819 | * (it might still be on another CPU if the timer was pending) | ||
820 | */ | ||
821 | enqueue_hrtimer(timer, new_base, | ||
822 | new_base->cpu_base == &__get_cpu_var(hrtimer_bases)); | ||
818 | 823 | ||
819 | unlock_hrtimer_base(timer, &flags); | 824 | unlock_hrtimer_base(timer, &flags); |
820 | 825 | ||