Re: [PATCH] x86/mce: update outdated comment for refactored ex_has_fault_handler()
From: Borislav Petkov
Date: Sat Mar 21 2026 - 08:47:03 EST
On Sat, Mar 21, 2026 at 07:00:24PM +0800, Kexin Sun wrote:
> The function ex_has_fault_handler() was refactored into
> ex_get_fault_handler_type() by commit a05d54c41ecf ("x86/mce:
> Provide method to find out the type of an exception handler"),
> and then into ex_get_fixup_type() by commit 46d28947d987
> ("x86/extable: Rework the exception table mechanics").
>
> The comment in do_machine_check() still referenced the old
> function and _ASM_EXTABLE_FAULT(). Update the comment to
> describe the current MCE-safe exception table mechanism
> (EX_TYPE_FAULT_MCE_SAFE / EX_TYPE_DEFAULT_MCE_SAFE) and
> the severity grading code that sets MCE_IN_KERNEL_RECOV.
>
> Assisted-by: unnamed:deepseek-v3.2 coccinelle
You got assisted by an unnamed LLM agent to fix up a bunch of comments in the
kernel source?
> Signed-off-by: Kexin Sun <kexinsun@xxxxxxxxxxxxxxxx>
> ---
> arch/x86/kernel/cpu/mce/core.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
> index 8dd424ac5de8..fa9ab282cede 100644
> --- a/arch/x86/kernel/cpu/mce/core.c
> +++ b/arch/x86/kernel/cpu/mce/core.c
> @@ -1713,12 +1713,12 @@ noinstr void do_machine_check(struct pt_regs *regs)
> } else {
> /*
> * Handle an MCE which has happened in kernel space but from
> - * which the kernel can recover: ex_has_fault_handler() has
> - * already verified that the rIP at which the error happened is
> - * a rIP from which the kernel can recover (by jumping to
> - * recovery code specified in _ASM_EXTABLE_FAULT()) and the
> - * corresponding exception handler which would do that is the
> - * proper one.
> + * which the kernel can recover: the severity grading code
> + * has already verified that the rIP at which the error
> + * happened is covered by an MCE-safe exception table entry
> + * (EX_TYPE_FAULT_MCE_SAFE or EX_TYPE_DEFAULT_MCE_SAFE),
> + * from which the kernel can recover by jumping to the
> + * associated fixup code.
And when we change it again, there'll be more patches fixing up the comments?
I'd prefer if this comment is rewritten in a way that doesn't have to get
updated each time the code changes.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette