[PATCH] KVM: VMX: Delete ancient pr_warn() about KVM_SET_TSS_ADDR not being set

Sean Christopherson posted 1 patch 2 years, 4 months ago
arch/x86/kvm/vmx/vmx.c | 7 -------
1 file changed, 7 deletions(-)
[PATCH] KVM: VMX: Delete ancient pr_warn() about KVM_SET_TSS_ADDR not being set
Posted by Sean Christopherson 2 years, 4 months ago
Delete KVM's printk about KVM_SET_TSS_ADDR not being called.  When the
printk was added by commit 776e58ea3d37 ("KVM: unbreak userspace that does
not sets tss address"), KVM also stuffed a "hopefully safe" value, i.e.
the message wasn't purely informational.  For reasons unknown, ostensibly
to try and help people running outdated qemu-kvm versions, the message got
left behind when KVM's stuffing was removed by commit 4918c6ca6838
("KVM: VMX: Require KVM_SET_TSS_ADDR being called prior to running a VCPU").

Today, the message is completely nonsensical, as it has been over a decade
since KVM supported userspace running a Real Mode guest, on a CPU without
unrestricted guest support, without doing KVM_SET_TSS_ADDR before KVM_RUN.
I.e. KVM's ABI has required KVM_SET_TSS_ADDR for 10+ years.

To make matters worse, the message is prone to false positives as it
triggers when simply *creating* a vCPU due to RESET putting vCPUs into
Real Mode, even when the user has no intention of ever *running* the vCPU
in a Real Mode.  E.g. KVM selftests stuff 64-bit mode and never touch Real
Mode, but trigger the message even though they run just fine without
doing KVM_SET_TSS_ADDR.  Creating "dummy" vCPUs, e.g. to probe features,
can also trigger the message.  In both scenarios, the message confuses
users and falsely implies that they've done something wrong.

Reported-by: Thorsten Glaser <t.glaser@tarent.de>
Closes: https://lkml.kernel.org/r/f1afa6c0-cde2-ab8b-ea71-bfa62a45b956%40tarent.de
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/kvm/vmx/vmx.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 8cf1c00d9352..aadbe1a23e3a 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -3061,13 +3061,6 @@ static void enter_rmode(struct kvm_vcpu *vcpu)
 
 	vmx->rmode.vm86_active = 1;
 
-	/*
-	 * Very old userspace does not call KVM_SET_TSS_ADDR before entering
-	 * vcpu. Warn the user that an update is overdue.
-	 */
-	if (!kvm_vmx->tss_addr)
-		pr_warn_once("KVM_SET_TSS_ADDR needs to be called before running vCPU\n");
-
 	vmx_segment_cache_clear(vmx);
 
 	vmcs_writel(GUEST_TR_BASE, kvm_vmx->tss_addr);

base-commit: 240f736891887939571854bd6d734b6c9291f22e
-- 
2.41.0.694.ge786442a9b-goog
Re: [PATCH] KVM: VMX: Delete ancient pr_warn() about KVM_SET_TSS_ADDR not being set
Posted by Sean Christopherson 2 years, 3 months ago
On Tue, 15 Aug 2023 10:42:15 -0700, Sean Christopherson wrote:
> Delete KVM's printk about KVM_SET_TSS_ADDR not being called.  When the
> printk was added by commit 776e58ea3d37 ("KVM: unbreak userspace that does
> not sets tss address"), KVM also stuffed a "hopefully safe" value, i.e.
> the message wasn't purely informational.  For reasons unknown, ostensibly
> to try and help people running outdated qemu-kvm versions, the message got
> left behind when KVM's stuffing was removed by commit 4918c6ca6838
> ("KVM: VMX: Require KVM_SET_TSS_ADDR being called prior to running a VCPU").
> 
> [...]

Applied to kvm-x86 vmx, thanks!

[1/1] KVM: VMX: Delete ancient pr_warn() about KVM_SET_TSS_ADDR not being set
      https://github.com/kvm-x86/linux/commit/9ca0c1a1265c

--
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/fixes