diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-04-28 18:02:00 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-04-29 04:57:11 -0400 |
commit | ce31332d3c77532d6ea97ddcb475a2b02dd358b4 (patch) | |
tree | 273c3664420d8fbd08346d9298c5010640ca3f71 | |
parent | f945a3d9600633de589ce698233b34ff6ad57e55 (diff) |
hrtimer: Initialize CLOCK_ID to HRTIMER_BASE table statically
Sedat and Bruno reported RCU stalls which turned out to be caused by
the following;
sched_init() calls init_rt_bandwidth() which calls hrtimer_init()
_BEFORE_ hrtimers_init() is called. While not entirely correct this
worked because hrtimer_init() only accessed statically initialized
data (hrtimer_bases.clock_base[CLOCK_MONOTONIC])
Commit e06383db9 (hrtimers: extend hrtimer base code to handle more
then 2 clockids) added an indirection to the hrtimer_bases.clock_base
lookup to avoid gap handling in the hot path. The table which is used
for the translataion from CLOCK_ID to HRTIMER_BASE index is
initialized at runtime in hrtimers_init(). So the early call of the
scheduler code translates CLOCK_MONOTONIC to HRTIMER_BASE_REALTIME.
Thus the rt_bandwith timer ends up on CLOCK_REALTIME. If the timer is
armed and the wall clock time is set (e.g. ntpdate in the early boot
process - which also gives the problem deterministic behaviour
i.e. magic recovery after N hours), then the timer ends up with an
expiry time far into the future. That breaks the RT throttler
mechanism as rt runtime is accumulated and never cleared, so the rt
throttler detects a false cpu hog condition and blocks all RT tasks
until the timer finally expires. That in turn stalls the RCU thread of
TINYRCU which leads to an huge amount of RCU callbacks piling up.
Make the translation table statically initialized, so we are back to
the status of <= 2.6.39.
Reported-and-tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Reported-by: Bruno Prémont <bonbons@linux-vserver.org>
Cc: John stultz <johnstul@us.ibm.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/%3Calpine.LFD.2.02.1104282353140.3005%40ionos%3E
Reviewed-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | kernel/hrtimer.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 9017478c5d4c..87fdb3f8db14 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -81,7 +81,11 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = | |||
81 | } | 81 | } |
82 | }; | 82 | }; |
83 | 83 | ||
84 | static int hrtimer_clock_to_base_table[MAX_CLOCKS]; | 84 | static int hrtimer_clock_to_base_table[MAX_CLOCKS] = { |
85 | [CLOCK_REALTIME] = HRTIMER_BASE_REALTIME, | ||
86 | [CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC, | ||
87 | [CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME, | ||
88 | }; | ||
85 | 89 | ||
86 | static inline int hrtimer_clockid_to_base(clockid_t clock_id) | 90 | static inline int hrtimer_clockid_to_base(clockid_t clock_id) |
87 | { | 91 | { |
@@ -1722,10 +1726,6 @@ static struct notifier_block __cpuinitdata hrtimers_nb = { | |||
1722 | 1726 | ||
1723 | void __init hrtimers_init(void) | 1727 | void __init hrtimers_init(void) |
1724 | { | 1728 | { |
1725 | hrtimer_clock_to_base_table[CLOCK_REALTIME] = HRTIMER_BASE_REALTIME; | ||
1726 | hrtimer_clock_to_base_table[CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC; | ||
1727 | hrtimer_clock_to_base_table[CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME; | ||
1728 | |||
1729 | hrtimer_cpu_notify(&hrtimers_nb, (unsigned long)CPU_UP_PREPARE, | 1729 | hrtimer_cpu_notify(&hrtimers_nb, (unsigned long)CPU_UP_PREPARE, |
1730 | (void *)(long)smp_processor_id()); | 1730 | (void *)(long)smp_processor_id()); |
1731 | register_cpu_notifier(&hrtimers_nb); | 1731 | register_cpu_notifier(&hrtimers_nb); |