Skip to contentSkip to conversation

KVM: x86/tdx: Do not print error message on non-present feature

PATCH Superseded Jiri Slaby (SUSE) 3 participants 3 messages Jul 2 – Jul 6

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: x86/tdx: Do not print error message on non-present feature

Before commit 165e77353831 below, the kernel did not print anything when X86_FEATURE_TDX_HOST_PLATFORM was not present in a cpu.

After the commit, this is emitted to the log, with the error level:
virt/tdx: TDX not supported by the host platform

This is disturbing as it is not an error running CPUs without the feature.

Drop the error message completely to revert to the state before 165e77353831.

Fixes 165e77353831 ("KVM: x86/tdx: Do VMXON and TDX-Module initialization during subsys init")
Cc Dan Williams <[email protected]>
Cc Chao Gao <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Sean Christopherson <[email protected]>

--

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Kiryl Shutsemau <[email protected]>
Cc Rick Edgecombe <[email protected]>
---
 arch/x86/virt/vmx/tdx/tdx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/virt/vmx/tdx/tdx.c +1 -3
index 42df8ea464c4..bdfc3bf12a9c 100644
@@ -1228,10 +1228,8 @@ static __init int tdx_enable(void)
 	enum cpuhp_state state;
 	int ret;
 
-	if (!cpu_feature_enabled(X86_FEATURE_TDX_HOST_PLATFORM)) {
-		pr_err("TDX not supported by the host platform\n");
+	if (!cpu_feature_enabled(X86_FEATURE_TDX_HOST_PLATFORM))
 		return -ENODEV;
-	}
 
 	if (!cpu_feature_enabled(X86_FEATURE_XSAVE)) {
 		pr_err("XSAVE is required for TDX\n");
Signature · 1 line
2.54.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Jiri Slaby (SUSE)

Before commit 165e77353831 below, the kernel did not print anything when X86_FEATURE_TDX_HOST_PLATFORM was not present in a cpu.

After the commit, this is emitted to the log, with the error level:
virt/tdx: TDX not supported by the host platform

This is disturbing as it is not an error running CPUs without the feature.

Drop the error message completely to revert to the state before 165e77353831.

Quoted 6 lines
Fixes 165e77353831 ("KVM: x86/tdx: Do VMXON and TDX-Module initialization during subsys init")
Cc Dan Williams <[email protected]>
Cc Chao Gao <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Sean Christopherson <[email protected]>
Signature · 1 line
  Kiryl Shutsemau / Kirill A. Shutemov
#2 lore raw
In reply to Jiri Slaby (SUSE)
Quoted 2 lines · Jiri Slaby (SUSE)

Before commit 165e77353831 below, the kernel did not print anything when X86_FEATURE_TDX_HOST_PLATFORM was not present in a cpu.

This isn't quite correct. It would print something if KVM tried to enable it, which is controlled by a module param.

Quoted 6 lines

After the commit, this is emitted to the log, with the error level:
virt/tdx: TDX not supported by the host platform

This is disturbing as it is not an error running CPUs without the feature.

Agree. If the kernel is now trying to enabling TDX automatically, it is not error print worthy if it fails because TDX is not supported.

But after the below change, something is still printed if the kernel param is used. Can we be a little more specific?

Quoted 3 lines

Drop the error message completely to revert to the state before 165e77353831.

'state' is a little ambiguous here. Sounds like a full revert.

Quoted 30 lines
Fixes 165e77353831 ("KVM: x86/tdx: Do VMXON and TDX-Module initialization during subsys init")
Cc Dan Williams <[email protected]>
Cc Chao Gao <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Sean Christopherson <[email protected]>

--

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Kiryl Shutsemau <[email protected]>
Cc Rick Edgecombe <[email protected]>
---
 arch/x86/virt/vmx/tdx/tdx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/virt/vmx/tdx/tdx.c +0 -0
index 42df8ea464c4..bdfc3bf12a9c 100644

arch/x86/virt/vmx/tdx/tdx.c static __init int tdx_enable(void) · line 1234

Quoted 8 lines
arch/x86/virt/vmx/tdx/tdx.c +1 -3
@@ -1228,10 +1228,8 @@ static __init int tdx_enable(void)
 	enum cpuhp_state state;
 	int ret;
 
-	if (!cpu_feature_enabled(X86_FEATURE_TDX_HOST_PLATFORM)) {
-		pr_err("TDX not supported by the host platform\n");
+	if (!cpu_feature_enabled(X86_FEATURE_TDX_HOST_PLATFORM))
 		return -ENODEV;
-	}

Seems like a reasonable change to me, but the log is a bit misleading.

Quoted 3 lines
arch/x86/virt/vmx/tdx/tdx.c +0 -0
 	if (!cpu_feature_enabled(X86_FEATURE_XSAVE)) {
 		pr_err("XSAVE is required for TDX\n");