Skip to content

Commit 00c092d

Browse files
yghannambp3tk0v
authored andcommitted
x86/mce: Ensure user polling settings are honored when restarting timer
Users can disable MCA polling by setting the "ignore_ce" parameter or by setting "check_interval=0". This tells the kernel to *not* start the MCE timer on a CPU. If the user did not disable CMCI, then storms can occur. When these happen, the MCE timer will be started with a fixed interval. After the storm subsides, the timer's next interval is set to check_interval. This disregards the user's input through "ignore_ce" and "check_interval". Furthermore, if "check_interval=0", then the new timer will run faster than expected. Create a new helper to check these conditions and use it when a CMCI storm ends. [ bp: Massage. ] Fixes: 7eae17c ("x86/mce: Add per-bank CMCI storm mitigation") Signed-off-by: Yazen Ghannam <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/[email protected]
1 parent 4c113a5 commit 00c092d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

arch/x86/kernel/cpu/mce/core.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,11 @@ static void mc_poll_banks_default(void)
17401740

17411741
void (*mc_poll_banks)(void) = mc_poll_banks_default;
17421742

1743+
static bool should_enable_timer(unsigned long iv)
1744+
{
1745+
return !mca_cfg.ignore_ce && iv;
1746+
}
1747+
17431748
static void mce_timer_fn(struct timer_list *t)
17441749
{
17451750
struct timer_list *cpu_t = this_cpu_ptr(&mce_timer);
@@ -1763,7 +1768,7 @@ static void mce_timer_fn(struct timer_list *t)
17631768

17641769
if (mce_get_storm_mode()) {
17651770
__start_timer(t, HZ);
1766-
} else {
1771+
} else if (should_enable_timer(iv)) {
17671772
__this_cpu_write(mce_next_interval, iv);
17681773
__start_timer(t, iv);
17691774
}
@@ -2156,11 +2161,10 @@ static void mce_start_timer(struct timer_list *t)
21562161
{
21572162
unsigned long iv = check_interval * HZ;
21582163

2159-
if (mca_cfg.ignore_ce || !iv)
2160-
return;
2161-
2162-
this_cpu_write(mce_next_interval, iv);
2163-
__start_timer(t, iv);
2164+
if (should_enable_timer(iv)) {
2165+
this_cpu_write(mce_next_interval, iv);
2166+
__start_timer(t, iv);
2167+
}
21642168
}
21652169

21662170
static void __mcheck_cpu_setup_timer(void)

0 commit comments

Comments
 (0)