aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-31 13:53:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-31 13:53:37 -0400
commit2d117403b30cd7301af60d7d54b279a9f566d10d (patch)
tree7c251e86e1a0101fdf11a15aa0e407360d16f71c /arch
parent8ee78c6fb982b3a7343faf561e7937d4cfa955ff (diff)
parent82f7af09e6fb58fb725c850d725d5e8780a9bec2 (diff)
Merge tag 'please-pull-mce' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras
Pull mce cleanup from Tony Luck: "One more mce cleanup before the 3.5 merge window closes" * tag 'please-pull-mce' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras: x86/mce: Cleanup timer mess
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index b4180f425fb8..0a687fd185e6 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1251,15 +1251,15 @@ void mce_log_therm_throt_event(__u64 status)
1251 * poller finds an MCE, poll 2x faster. When the poller finds no more 1251 * poller finds an MCE, poll 2x faster. When the poller finds no more
1252 * errors, poll 2x slower (up to check_interval seconds). 1252 * errors, poll 2x slower (up to check_interval seconds).
1253 */ 1253 */
1254static int check_interval = 5 * 60; /* 5 minutes */ 1254static unsigned long check_interval = 5 * 60; /* 5 minutes */
1255 1255
1256static DEFINE_PER_CPU(int, mce_next_interval); /* in jiffies */ 1256static DEFINE_PER_CPU(unsigned long, mce_next_interval); /* in jiffies */
1257static DEFINE_PER_CPU(struct timer_list, mce_timer); 1257static DEFINE_PER_CPU(struct timer_list, mce_timer);
1258 1258
1259static void mce_start_timer(unsigned long data) 1259static void mce_timer_fn(unsigned long data)
1260{ 1260{
1261 struct timer_list *t = &per_cpu(mce_timer, data); 1261 struct timer_list *t = &__get_cpu_var(mce_timer);
1262 int *n; 1262 unsigned long iv;
1263 1263
1264 WARN_ON(smp_processor_id() != data); 1264 WARN_ON(smp_processor_id() != data);
1265 1265
@@ -1272,13 +1272,14 @@ static void mce_start_timer(unsigned long data)
1272 * Alert userspace if needed. If we logged an MCE, reduce the 1272 * Alert userspace if needed. If we logged an MCE, reduce the
1273 * polling interval, otherwise increase the polling interval. 1273 * polling interval, otherwise increase the polling interval.
1274 */ 1274 */
1275 n = &__get_cpu_var(mce_next_interval); 1275 iv = __this_cpu_read(mce_next_interval);
1276 if (mce_notify_irq()) 1276 if (mce_notify_irq())
1277 *n = max(*n/2, HZ/100); 1277 iv = max(iv, (unsigned long) HZ/100);
1278 else 1278 else
1279 *n = min(*n*2, (int)round_jiffies_relative(check_interval*HZ)); 1279 iv = min(iv * 2, round_jiffies_relative(check_interval * HZ));
1280 __this_cpu_write(mce_next_interval, iv);
1280 1281
1281 t->expires = jiffies + *n; 1282 t->expires = jiffies + iv;
1282 add_timer_on(t, smp_processor_id()); 1283 add_timer_on(t, smp_processor_id());
1283} 1284}
1284 1285
@@ -1556,17 +1557,17 @@ static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c)
1556static void __mcheck_cpu_init_timer(void) 1557static void __mcheck_cpu_init_timer(void)
1557{ 1558{
1558 struct timer_list *t = &__get_cpu_var(mce_timer); 1559 struct timer_list *t = &__get_cpu_var(mce_timer);
1559 int *n = &__get_cpu_var(mce_next_interval); 1560 unsigned long iv = __this_cpu_read(mce_next_interval);
1560 1561
1561 setup_timer(t, mce_start_timer, smp_processor_id()); 1562 setup_timer(t, mce_timer_fn, smp_processor_id());
1562 1563
1563 if (mce_ignore_ce) 1564 if (mce_ignore_ce)
1564 return; 1565 return;
1565 1566
1566 *n = check_interval * HZ; 1567 __this_cpu_write(mce_next_interval, iv);
1567 if (!*n) 1568 if (!iv)
1568 return; 1569 return;
1569 t->expires = round_jiffies(jiffies + *n); 1570 t->expires = round_jiffies(jiffies + iv);
1570 add_timer_on(t, smp_processor_id()); 1571 add_timer_on(t, smp_processor_id());
1571} 1572}
1572 1573
@@ -2276,7 +2277,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
2276 case CPU_DOWN_FAILED_FROZEN: 2277 case CPU_DOWN_FAILED_FROZEN:
2277 if (!mce_ignore_ce && check_interval) { 2278 if (!mce_ignore_ce && check_interval) {
2278 t->expires = round_jiffies(jiffies + 2279 t->expires = round_jiffies(jiffies +
2279 __get_cpu_var(mce_next_interval)); 2280 per_cpu(mce_next_interval, cpu));
2280 add_timer_on(t, cpu); 2281 add_timer_on(t, cpu);
2281 } 2282 }
2282 smp_call_function_single(cpu, mce_reenable_cpu, &action, 1); 2283 smp_call_function_single(cpu, mce_reenable_cpu, &action, 1);