Skip to content

Commit c76db5d

Browse files
committed
x86/mce/inject: Remove call to mce_notify_irq()
JIRA: https://issues.redhat.com/browse/RHEL-118444 commit 6447828 Author: Nikolay Borisov <nik.borisov@suse.com> Date: Tue Feb 25 16:33:48 2025 +0200 x86/mce/inject: Remove call to mce_notify_irq() The call to mce_notify_irq() has been there since the initial version of the soft inject mce machinery, introduced in ea149b3 ("x86, mce: add basic error injection infrastructure"). At that time it was functional since injecting an MCE resulted in the following call chain: raise_mce() ->machine_check_poll() ->mce_log() - sets notfiy_user_bit ->mce_notify_user() (current mce_notify_irq) consumed the bit and called the usermode helper. However, with the introduction of 011d826 ("RAS: Add a Corrected Errors Collector") the code got moved around and the usermode helper began to be called via the early notifier mce_first_notifier() rendering the call in raise_local() defunct as the mce_need_notify bit (ex notify_user) is only being set from the early notifier. Remove the noop call and make mce_notify_irq() static. No functional changes. Signed-off-by: Nikolay Borisov <nik.borisov@suse.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20250225143348.268469-1-nik.borisov@suse.com Signed-off-by: David Arcari <darcari@redhat.com>
1 parent 575164e commit c76db5d

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

arch/x86/include/asm/mce.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,6 @@ enum mcp_flags {
296296

297297
void machine_check_poll(enum mcp_flags flags, mce_banks_t *b);
298298

299-
bool mce_notify_irq(void);
300-
301299
DECLARE_PER_CPU(struct mce, injectm);
302300

303301
/* Disable CMCI/polling for MCA bank claimed by firmware */

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

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,28 @@ bool mce_is_correctable(struct mce *m)
583583
}
584584
EXPORT_SYMBOL_GPL(mce_is_correctable);
585585

586+
/*
587+
* Notify the user(s) about new machine check events.
588+
* Can be called from interrupt context, but not from machine check/NMI
589+
* context.
590+
*/
591+
static bool mce_notify_irq(void)
592+
{
593+
/* Not more than two messages every minute */
594+
static DEFINE_RATELIMIT_STATE(ratelimit, 60*HZ, 2);
595+
596+
if (test_and_clear_bit(0, &mce_need_notify)) {
597+
mce_work_trigger();
598+
599+
if (__ratelimit(&ratelimit))
600+
pr_info(HW_ERR "Machine check events logged\n");
601+
602+
return true;
603+
}
604+
605+
return false;
606+
}
607+
586608
static int mce_early_notifier(struct notifier_block *nb, unsigned long val,
587609
void *data)
588610
{
@@ -1772,28 +1794,6 @@ static void mce_timer_delete_all(void)
17721794
del_timer_sync(&per_cpu(mce_timer, cpu));
17731795
}
17741796

1775-
/*
1776-
* Notify the user(s) about new machine check events.
1777-
* Can be called from interrupt context, but not from machine check/NMI
1778-
* context.
1779-
*/
1780-
bool mce_notify_irq(void)
1781-
{
1782-
/* Not more than two messages every minute */
1783-
static DEFINE_RATELIMIT_STATE(ratelimit, 60*HZ, 2);
1784-
1785-
if (test_and_clear_bit(0, &mce_need_notify)) {
1786-
mce_work_trigger();
1787-
1788-
if (__ratelimit(&ratelimit))
1789-
pr_info(HW_ERR "Machine check events logged\n");
1790-
1791-
return true;
1792-
}
1793-
return false;
1794-
}
1795-
EXPORT_SYMBOL_GPL(mce_notify_irq);
1796-
17971797
static void __mcheck_cpu_mce_banks_init(void)
17981798
{
17991799
struct mce_bank *mce_banks = this_cpu_ptr(mce_banks_array);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ static int raise_local(void)
229229
} else if (m->status) {
230230
pr_info("Starting machine check poll CPU %d\n", cpu);
231231
raise_poll(m);
232-
mce_notify_irq();
233232
pr_info("Machine check poll done on CPU %d\n", cpu);
234233
} else
235234
m->finished = 0;

0 commit comments

Comments
 (0)