From: Andi Kleen <andi@firstfloor.org>
To: hpa@zytor.com
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, tglx@linutronix.de,
seto.hidetoshi@jp.fujitsu.com
Subject: [PATCH] [1/4] x86: MCE: Make polling timer interval per CPU v2
Date: Thu, 09 Apr 2009 12:28:22 +0200 [thread overview]
Message-ID: <873aci9l4p.fsf_-_@basil.nowhere.org> (raw)
In-Reply-To: <20090407150654.071D21D046E@basil.firstfloor.org> (Andi Kleen's message of "Tue, 7 Apr 2009 17:06:53 +0200 (CEST)")
This v2 version fixes the check_interval == 0 case noticed by Seto-san.
Please apply.
-Andi
---
x86: MCE: Make polling timer interval per CPU v2
Impact: bug fix
The polling timer while running per CPU still uses a global next_interval
variable, which lead to some CPUs either polling too fast or too slow.
This was not a serious problem because all errors get picked up eventually,
but it's still better to avoid it. Turn next_interval into a per cpu variable.
v2: Fix check_interval == 0 case (Hidetoshi Seto)
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
arch/x86/kernel/cpu/mcheck/mce_64.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
Index: linux/arch/x86/kernel/cpu/mcheck/mce_64.c
===================================================================
--- linux.orig/arch/x86/kernel/cpu/mcheck/mce_64.c 2009-04-09 11:43:58.000000000 +0200
+++ linux/arch/x86/kernel/cpu/mcheck/mce_64.c 2009-04-09 12:16:33.000000000 +0200
@@ -452,13 +452,14 @@
*/
static int check_interval = 5 * 60; /* 5 minutes */
-static int next_interval; /* in jiffies */
+static DEFINE_PER_CPU(int, next_interval); /* in jiffies */
static void mcheck_timer(unsigned long);
static DEFINE_PER_CPU(struct timer_list, mce_timer);
static void mcheck_timer(unsigned long data)
{
struct timer_list *t = &per_cpu(mce_timer, data);
+ int *n;
WARN_ON(smp_processor_id() != data);
@@ -470,14 +471,14 @@
* Alert userspace if needed. If we logged an MCE, reduce the
* polling interval, otherwise increase the polling interval.
*/
+ n = &__get_cpu_var(next_interval);
if (mce_notify_user()) {
- next_interval = max(next_interval/2, HZ/100);
+ *n = max(*n/2, HZ/100);
} else {
- next_interval = min(next_interval * 2,
- (int)round_jiffies_relative(check_interval*HZ));
+ *n = min(*n*2, (int)round_jiffies_relative(check_interval*HZ));
}
- t->expires = jiffies + next_interval;
+ t->expires = jiffies + *n;
add_timer(t);
}
@@ -632,14 +633,13 @@
static void mce_init_timer(void)
{
struct timer_list *t = &__get_cpu_var(mce_timer);
+ int *n = &__get_cpu_var(next_interval);
- /* data race harmless because everyone sets to the same value */
- if (!next_interval)
- next_interval = check_interval * HZ;
- if (!next_interval)
+ *n = check_interval * HZ;
+ if (!*n)
return;
setup_timer(t, mcheck_timer, smp_processor_id());
- t->expires = round_jiffies(jiffies + next_interval);
+ t->expires = round_jiffies(jiffies + *n);
add_timer(t);
}
@@ -907,7 +907,6 @@
/* Reinit MCEs after user configuration changes */
static void mce_restart(void)
{
- next_interval = check_interval * HZ;
on_each_cpu(mce_cpu_restart, NULL, 1);
}
@@ -1110,7 +1109,8 @@
break;
case CPU_DOWN_FAILED:
case CPU_DOWN_FAILED_FROZEN:
- t->expires = round_jiffies(jiffies + next_interval);
+ t->expires = round_jiffies(jiffies +
+ __get_cpu_var(next_interval));
add_timer_on(t, cpu);
smp_call_function_single(cpu, mce_reenable_cpu, &action, 1);
break;
next prev parent reply other threads:[~2009-04-09 10:28 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-07 15:06 [PATCH] [0/4] x86: MCE: Machine check bug fix series for 2.6.30 Andi Kleen
2009-04-07 15:06 ` [PATCH] [1/4] x86: MCE: Make polling timer interval per CPU Andi Kleen
2009-04-08 3:43 ` Hidetoshi Seto
2009-04-08 10:43 ` Andi Kleen
2009-04-08 11:30 ` Hidetoshi Seto
2009-04-08 11:40 ` Andi Kleen
2009-04-09 10:28 ` Andi Kleen [this message]
2009-04-07 15:06 ` [PATCH] [2/4] x86: MCE: Fix boot logging logic Andi Kleen
2009-04-07 15:06 ` [PATCH] [3/4] x86: MCE: Improve mce_get_rip Andi Kleen
2009-04-08 8:15 ` Hidetoshi Seto
2009-04-08 10:06 ` Andi Kleen
2009-04-09 4:59 ` Hidetoshi Seto
2009-04-09 7:14 ` Andi Kleen
2009-04-09 9:59 ` Hidetoshi Seto
2009-04-09 10:13 ` Andi Kleen
2009-04-10 4:38 ` Hidetoshi Seto
2009-04-10 8:25 ` Andi Kleen
2009-04-10 9:49 ` Hidetoshi Seto
2009-04-23 9:43 ` Huang Ying
2009-04-24 6:16 ` Hidetoshi Seto
2009-04-24 6:35 ` Huang Ying
2009-04-24 7:28 ` Hidetoshi Seto
2009-04-24 8:50 ` Andi Kleen
2009-04-24 8:52 ` Huang Ying
2009-04-24 10:11 ` Hidetoshi Seto
2009-04-07 15:06 ` [PATCH] [4/4] x86: MCE: Fix EIPV behaviour with !PCC Andi Kleen
2009-04-23 9:43 ` Huang Ying
2009-04-23 20:49 ` H. Peter Anvin
2009-04-24 8:35 ` Andi Kleen
2009-04-24 0:27 ` Hidetoshi Seto
2009-04-24 1:11 ` Huang Ying
2009-04-24 5:40 ` H. Peter Anvin
2009-04-24 8:46 ` Andi Kleen
2009-04-24 10:30 ` Hidetoshi Seto
2009-04-24 16:32 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=873aci9l4p.fsf_-_@basil.nowhere.org \
--to=andi@firstfloor.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=seto.hidetoshi@jp.fujitsu.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox