From: Havard Skinnemoen <hskinnemoen@google.com>
To: Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@alien8.de>
Cc: linux-kernel@vger.kernel.org, Ewout van Bekkum <ewout@google.com>,
Havard Skinnemoen <hskinnemoen@google.com>
Subject: [PATCH 1/6] x86-mce: Modify CMCI poll interval to adjust for small check_interval values.
Date: Wed, 9 Jul 2014 10:09:21 -0700 [thread overview]
Message-ID: <1404925766-32253-2-git-send-email-hskinnemoen@google.com> (raw)
In-Reply-To: <1404925766-32253-1-git-send-email-hskinnemoen@google.com>
From: Ewout van Bekkum <ewout@google.com>
The CMCI poll interval was updated to pick the minimum interval between
the original 30 seconds and the check_interval divided by 8 (minimum of
3 polls).
This resolves a bug where the CMCI storm handler is unable to return to
interrupt mode from polling mode, if the check_interval shorter than the
CMCI poll interval. This problem is caused by the mce_timer_fn function
which only allows the poll interval to be incremented up to the
check_interval, while the mce_intel_adjust_timer function requires the
poll interval to be greater than the CMCI poll interval before leaving
the CMCI_STORM_ACTIVE state.
Signed-off-by: Ewout van Bekkum <ewout@google.com>
Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>
---
arch/x86/kernel/cpu/mcheck/mce-internal.h | 1 +
arch/x86/kernel/cpu/mcheck/mce.c | 5 +++++
arch/x86/kernel/cpu/mcheck/mce_intel.c | 15 +++++++++++----
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce-internal.h b/arch/x86/kernel/cpu/mcheck/mce-internal.h
index 09edd0b..2f0b1e8 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-internal.h
+++ b/arch/x86/kernel/cpu/mcheck/mce-internal.h
@@ -40,6 +40,7 @@ static inline void cmci_disable_bank(int bank) { }
#endif
void mce_timer_kick(unsigned long interval);
+unsigned long current_check_interval(void);
#ifdef CONFIG_ACPI_APEI
int apei_write_mce(struct mce *m);
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index bb92f38..1ebdd34 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1265,6 +1265,11 @@ void mce_log_therm_throt_event(__u64 status)
*/
static unsigned long check_interval = 5 * 60; /* 5 minutes */
+unsigned long current_check_interval(void)
+{
+ return check_interval;
+}
+
static DEFINE_PER_CPU(unsigned long, mce_next_interval); /* in jiffies */
static DEFINE_PER_CPU(struct timer_list, mce_timer);
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index 9a316b2..26eb8d3 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -45,10 +45,17 @@ static DEFINE_PER_CPU(mce_banks_t, mce_banks_owned);
static DEFINE_SPINLOCK(cmci_discover_lock);
#define CMCI_THRESHOLD 1
-#define CMCI_POLL_INTERVAL (30 * HZ)
#define CMCI_STORM_INTERVAL (1 * HZ)
#define CMCI_STORM_THRESHOLD 15
+/*
+ * Poll every 30 seconds unless the current check_interval / 8 is smaller.
+ */
+static unsigned long cmci_poll_interval(void)
+{
+ return min(30UL * HZ, current_check_interval() * HZ / 8);
+}
+
static DEFINE_PER_CPU(unsigned long, cmci_time_stamp);
static DEFINE_PER_CPU(unsigned int, cmci_storm_cnt);
static DEFINE_PER_CPU(unsigned int, cmci_storm_state);
@@ -101,7 +108,7 @@ unsigned long mce_intel_adjust_timer(unsigned long interval)
{
int r;
- if (interval < CMCI_POLL_INTERVAL)
+ if (interval < cmci_poll_interval())
return interval;
switch (__this_cpu_read(cmci_storm_state)) {
@@ -128,7 +135,7 @@ unsigned long mce_intel_adjust_timer(unsigned long interval)
cmci_reenable();
cmci_recheck();
}
- return CMCI_POLL_INTERVAL;
+ return cmci_poll_interval();
default:
/*
* We have shiny weather. Let the poll do whatever it
@@ -178,7 +185,7 @@ static bool cmci_storm_detect(void)
cmci_storm_disable_banks();
__this_cpu_write(cmci_storm_state, CMCI_STORM_ACTIVE);
r = atomic_add_return(1, &cmci_storm_on_cpus);
- mce_timer_kick(CMCI_POLL_INTERVAL);
+ mce_timer_kick(cmci_poll_interval());
if (r == 1)
pr_notice("CMCI storm detected: switching to poll mode\n");
--
2.0.0.526.g5318336
next prev parent reply other threads:[~2014-07-09 17:10 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-09 17:09 [PATCH 0/6] x86 mce fixes Havard Skinnemoen
2014-07-09 17:09 ` Havard Skinnemoen [this message]
2014-07-09 19:17 ` [PATCH 1/6] x86-mce: Modify CMCI poll interval to adjust for small check_interval values Borislav Petkov
2014-07-09 21:24 ` Havard Skinnemoen
2014-07-10 9:01 ` Chen, Gong
2014-07-10 17:16 ` Havard Skinnemoen
2014-07-11 2:12 ` Chen, Gong
2014-07-10 11:42 ` Borislav Petkov
2014-07-10 17:51 ` Havard Skinnemoen
2014-07-10 18:55 ` Tony Luck
2014-07-10 22:45 ` Havard Skinnemoen
2014-07-11 15:35 ` Borislav Petkov
2014-07-11 18:56 ` Havard Skinnemoen
2014-07-11 20:10 ` Borislav Petkov
2014-07-11 20:39 ` Havard Skinnemoen
2014-07-14 14:57 ` Borislav Petkov
2014-07-11 20:22 ` Borislav Petkov
2014-07-12 0:10 ` Havard Skinnemoen
2014-07-14 15:14 ` Borislav Petkov
2014-07-11 20:36 ` Borislav Petkov
2014-07-11 21:05 ` Havard Skinnemoen
2014-07-09 17:09 ` [PATCH 2/6] x86-mce: Modify CMCI storm exit to reenable instead of rediscover banks Havard Skinnemoen
2014-07-09 20:20 ` Luck, Tony
2014-07-09 21:34 ` Havard Skinnemoen
2014-07-10 15:51 ` Borislav Petkov
2014-07-10 18:32 ` Havard Skinnemoen
2014-07-09 17:09 ` [PATCH 3/6] x86-mce: Clear CMCI enable on all claimed CMCI banks before reboot Havard Skinnemoen
2014-07-09 20:36 ` Luck, Tony
2014-07-09 21:40 ` Havard Skinnemoen
2014-07-10 16:24 ` Borislav Petkov
2014-07-10 16:33 ` Tony Luck
2014-07-10 17:56 ` Havard Skinnemoen
2014-07-10 18:27 ` Tony Luck
2014-07-10 18:30 ` Borislav Petkov
2014-07-09 17:09 ` [PATCH 4/6] x86-mce: Add spinlocks to prevent duplicated MCP and CMCI reports Havard Skinnemoen
2014-07-09 20:35 ` Andi Kleen
2014-07-09 21:51 ` Havard Skinnemoen
2014-07-09 23:32 ` Luck, Tony
2014-07-10 8:16 ` Borislav Petkov
2014-07-09 20:47 ` Luck, Tony
2014-07-09 21:56 ` Havard Skinnemoen
2014-07-10 16:41 ` Borislav Petkov
2014-07-10 18:03 ` Havard Skinnemoen
2014-07-10 18:44 ` Borislav Petkov
2014-07-10 18:57 ` Tony Luck
2014-07-10 19:12 ` Borislav Petkov
2014-07-11 9:24 ` Borislav Petkov
2014-07-11 19:06 ` Tony Luck
2014-07-11 19:52 ` Borislav Petkov
2014-07-11 21:15 ` Havard Skinnemoen
2014-07-17 10:50 ` Borislav Petkov
2014-07-18 21:23 ` Tony Luck
2014-07-18 21:31 ` Borislav Petkov
2014-07-09 17:09 ` [PATCH 5/6] x86-mce: check if no_way_out applies before deciding not to clear MCE banks Havard Skinnemoen
2014-07-09 21:00 ` Luck, Tony
2014-07-09 23:00 ` Havard Skinnemoen
2014-07-09 23:27 ` Luck, Tony
2014-07-10 16:49 ` Borislav Petkov
2014-07-09 17:09 ` [PATCH 6/6] x86-mce: ensure the MCP timer is not already set in the mce_timer_fn Havard Skinnemoen
2014-07-09 21:04 ` Luck, Tony
2014-07-09 23:01 ` Havard Skinnemoen
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=1404925766-32253-2-git-send-email-hskinnemoen@google.com \
--to=hskinnemoen@google.com \
--cc=bp@alien8.de \
--cc=ewout@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/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
all inboxes | Powered by JetHome®