[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c0d5290b9e2dfc7692ed5575babf73092156ca90.camel@redhat.com>
Date: Tue, 27 Oct 2020 16:31:26 -0400
From: Qian Cai <cai@...hat.com>
To: Maxim Levitsky <mlevitsk@...hat.com>, kvm@...r.kernel.org
Cc: "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Joerg Roedel <joro@...tes.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org, Jim Mattson <jmattson@...gle.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH v6 2/4] KVM: x86: report negative values from wrmsr
emulation to userspace
On Mon, 2020-10-26 at 15:40 -0400, Qian Cai wrote:
> On Wed, 2020-09-23 at 00:10 +0300, Maxim Levitsky wrote:
> > This will allow the KVM to report such errors (e.g -ENOMEM)
> > to the userspace.
> >
> > Signed-off-by: Maxim Levitsky <mlevitsk@...hat.com>
>
> Reverting this and its dependency:
>
> 72f211ecaa80 KVM: x86: allow kvm_x86_ops.set_efer to return an error value
>
> on the top of linux-next (they have also unfortunately merged into the
> mainline
> at the same time) fixed an issue that a simple Intel KVM guest is unable to
> boot
> below.
So I debug this a bit more. This also breaks nested virt (VMX). We have here:
[ 345.504403] kvm [1491]: vcpu0 unhandled rdmsr: 0x4e data 0x0
[ 345.758560] kvm [1491]: vcpu0 unhandled rdmsr: 0x1c9 data 0x0
[ 345.758594] kvm [1491]: vcpu0 unhandled rdmsr: 0x1a6 data 0x0
[ 345.758619] kvm [1491]: vcpu0 unhandled rdmsr: 0x1a7 data 0x0
[ 345.758644] kvm [1491]: vcpu0 unhandled rdmsr: 0x3f6 data 0x0
[ 345.951601] kvm [1493]: vcpu1 unhandled rdmsr: 0x4e data 0x0
[ 351.857036] kvm [1493]: vcpu1 unhandled wrmsr: 0xc90 data 0xfffff
After this commit, -ENOENT is returned to vcpu_enter_guest() causes the
userspace to abort.
kvm_msr_ignored_check()
kvm_set_msr()
kvm_emulate_wrmsr()
vmx_handle_exit()
vcpu_enter_guest()
Something like below will unbreak the userspace, but does anyone has a better
idea?
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1748,7 +1748,7 @@ int kvm_emulate_wrmsr(struct kvm_vcpu *vcpu)
return 0;
/* Signal all other negative errors to userspace */
- if (r < 0)
+ if (r < 0 && r != -ENOENT)
return r;
/* MSR write failed? Inject a #GP */
Powered by blists - more mailing lists