RE: [EXTERNAL] Re: [PATCH v2] x86/mce: Report unavailable MCE support at informational level

From: Dexuan Cui

Date: Thu Dec 03 2026 - 19:14:49 EST


> From: Borislav Petkov <bp@xxxxxxxxx>
> Sent: Monday, November 23, 2026 6:18 PM
> ...
Hi Boris, sorry for my late reply!

> > diff --git a/arch/x86/kernel/cpu/mce/core.c
> b/arch/x86/kernel/cpu/mce/core.c
> > index 50b1614968be6..ca7b729b74126 100644
> > --- a/arch/x86/kernel/cpu/mce/core.c
> > +++ b/arch/x86/kernel/cpu/mce/core.c
> > @@ -2815,8 +2815,8 @@ static __init int mcheck_init_device(void)
> > MAYBE_BUILD_BUG_ON(__VIRTUAL_MASK_SHIFT >= 63);
> >
> > if (!mce_available(&boot_cpu_data)) {
> > - err = -EIO;
> > - goto err_out;
> > + pr_info("MCE is unavailable\n");
> > + return -ENODEV;
>
> What's the difference between:
>
> "MCE is unavailable\n"
>
> and
>
> "Unable to init MCE device (rc: %d)\n", err
>
> ?
My intention with this patch is to distinguish between two different cases:

* MCE is unavailable in expected scenarios (e.g., certain TDX guests or
disabled via boot parameters), where pr_info() is more appropriate.

* MCE is available, but an actual error occurs during initialization,
where pr_err() should be used.

> And changing the routing path breaks the readability in this function.

Since if (!mce_available(&boot_cpu_data)) is the very first check at the
beginning of mcheck_init_device(), I thought an early "return -ENODEV;"
wouldn't hurt readability.

> What's the point of this patch at all?
>
> --
> Regards/Gruss,
> Boris.

Some internal monitoring tool flags all pr_err() messages in dmesg as
failures. When I looked into "mce: Unable to init MCE device (rc: -5)",
I felt using pr_info() for the unavailable case made sense. However,
if you don't think this change is worth the effort, I can ask our internal
tool to ignore this message and we can drop the patch.

Thanks,
Dexuan