Linux EDAC development
 help / color / mirror / Atom feed
* [PATCH v3] x86/mce: Don't report an error when MCE is unavailable
@ 2026-12-04  2:12 Dexuan Cui
  2026-12-04  5:30 ` Naman Jain
  0 siblings, 1 reply; 2+ messages in thread
From: Dexuan Cui @ 2026-12-04  2:12 UTC (permalink / raw)
  To: tony.luck, bp, tglx, mingo, dave.hansen, x86, hpa, linux-edac,
	linux-kernel
  Cc: kameroncarr, namjain, yazen.ghannam, Dexuan Cui

A TDX guest with TD_CTLS.REDUCE_VE set and FEATURE_PARAVIRT_CTLS.MCA
clear does not enumerate the MCE or MCA CPUID bits. This is expected,
but mcheck_init_device() logs:

  mce: Unable to init MCE device (rc: -5)

An internal monitor treats every pr_err() in dmesg as a failure, so it
flags a healthy guest. Booting with mce=off or nomce takes the same
error path.

Return -ENODEV without logging when mce_available() is false. Keep the
existing diagnostic for failures during device initialization.

Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
Changes in v3:
  - Explain the motivation in the commit message (Boris).
  - Drop the v2 pr_info("MCE is unavailable\n") and return silently
    (Boris).
  - Not carrying the v2 Reviewed-by tags, since the logging behavior
    they reviewed has changed.

v2: https://lore.kernel.org/all/20261119185811.565606-1-decui@microsoft.com/
v2 review: https://lore.kernel.org/all/20261204003753.GJaxILYWe-nBosYtkh@fat_crate.local/

 arch/x86/kernel/cpu/mce/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -2814,10 +2814,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;
-	}
+	if (!mce_available(&boot_cpu_data))
+		return -ENODEV;
 
 	if (!zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL)) {
 		err = -ENOMEM;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] x86/mce: Don't report an error when MCE is unavailable
  2026-12-04  2:12 [PATCH v3] x86/mce: Don't report an error when MCE is unavailable Dexuan Cui
@ 2026-12-04  5:30 ` Naman Jain
  0 siblings, 0 replies; 2+ messages in thread
From: Naman Jain @ 2026-12-04  5:30 UTC (permalink / raw)
  To: Dexuan Cui, tony.luck, bp, tglx, mingo, dave.hansen, x86, hpa,
	linux-edac, linux-kernel
  Cc: kameroncarr, yazen.ghannam



On 12/4/2026 7:42 AM, Dexuan Cui wrote:
> A TDX guest with TD_CTLS.REDUCE_VE set and FEATURE_PARAVIRT_CTLS.MCA
> clear does not enumerate the MCE or MCA CPUID bits. This is expected,
> but mcheck_init_device() logs:
> 
>    mce: Unable to init MCE device (rc: -5)
> 
> An internal monitor treats every pr_err() in dmesg as a failure, so it
> flags a healthy guest. Booting with mce=off or nomce takes the same
> error path.
> 
> Return -ENODEV without logging when mce_available() is false. Keep the
> existing diagnostic for failures during device initialization.
> 
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
> ---
> Changes in v3:
>    - Explain the motivation in the commit message (Boris).
>    - Drop the v2 pr_info("MCE is unavailable\n") and return silently
>      (Boris).
>    - Not carrying the v2 Reviewed-by tags, since the logging behavior
>      they reviewed has changed.
> 
> v2: https://lore.kernel.org/all/20261119185811.565606-1-decui@microsoft.com/
> v2 review: https://lore.kernel.org/all/20261204003753.GJaxILYWe-nBosYtkh@fat_crate.local/
> 
>   arch/x86/kernel/cpu/mce/core.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
> --- a/arch/x86/kernel/cpu/mce/core.c
> +++ b/arch/x86/kernel/cpu/mce/core.c
> @@ -2814,10 +2814,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;
> -	}
> +	if (!mce_available(&boot_cpu_data))
> +		return -ENODEV;
>   
>   	if (!zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL)) {
>   		err = -ENOMEM;


Reviewed-by: Naman Jain <namjain@linux.microsoft.com>

Regards,
Naman

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04  5:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  2:12 [PATCH v3] x86/mce: Don't report an error when MCE is unavailable Dexuan Cui
2026-12-04  5:30 ` Naman Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox