Skip to content

Commit f0248f1

Browse files
committed
x86/mce: Ensure user polling settings are honored when restarting timer
JIRA: https://issues.redhat.com/browse/RHEL-118444 commit 00c092d Author: Yazen Ghannam <yazen.ghannam@amd.com> Date: Tue Jun 24 14:15:57 2025 +0000 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 <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/20250624-wip-mca-updates-v4-2-236dd74f645f@amd.com Signed-off-by: David Arcari <darcari@redhat.com>
1 parent 001750b commit f0248f1

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
@@ -1739,6 +1739,11 @@ static void mc_poll_banks_default(void)
17391739

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

1742+
static bool should_enable_timer(unsigned long iv)
1743+
{
1744+
return !mca_cfg.ignore_ce && iv;
1745+
}
1746+
17421747
static void mce_timer_fn(struct timer_list *t)
17431748
{
17441749
struct timer_list *cpu_t = this_cpu_ptr(&mce_timer);
@@ -1762,7 +1767,7 @@ static void mce_timer_fn(struct timer_list *t)
17621767

17631768
if (mce_get_storm_mode()) {
17641769
__start_timer(t, HZ);
1765-
} else {
1770+
} else if (should_enable_timer(iv)) {
17661771
__this_cpu_write(mce_next_interval, iv);
17671772
__start_timer(t, iv);
17681773
}
@@ -2155,11 +2160,10 @@ static void mce_start_timer(struct timer_list *t)
21552160
{
21562161
unsigned long iv = check_interval * HZ;
21572162

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

21652169
static void __mcheck_cpu_setup_timer(void)

0 commit comments

Comments
 (0)