[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZyiDJhTkPclSQYIk@intel.com>
Date: Mon, 4 Nov 2024 16:17:42 +0800
From: Chao Gao <chao.gao@...el.com>
To: Sean Christopherson <seanjc@...gle.com>
CC: Paolo Bonzini <pbonzini@...hat.com>, <kvm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Markku Ahvenjärvi
<mankku@...il.com>, Janne Karhunen <janne.karhunen@...il.com>
Subject: Re: [PATCH 2/2] KVM: nVMX: Defer SVI update to vmcs01 on EOI when L2
is active w/o VID
>@@ -6873,6 +6873,23 @@ void vmx_hwapic_isr_update(struct kvm_vcpu *vcpu, int max_isr)
> u16 status;
> u8 old;
>
>+ /*
>+ * If L2 is active, defer the SVI update until vmcs01 is loaded, as SVI
>+ * is only relevant for if and only if Virtual Interrupt Delivery is
>+ * enabled in vmcs12, and if VID is enabled then L2 EOIs affect L2's
>+ * vAPIC, not L1's vAPIC. KVM must update vmcs01 on the next nested
>+ * VM-Exit, otherwise L1 with run with a stale SVI.
>+ */
>+ if (is_guest_mode(vcpu)) {
>+ /*
>+ * KVM is supposed to forward intercepted L2 EOIs to L1 if VID
>+ * is enabled in vmcs12; as above, the EOIs affect L2's vAPIC.
>+ */
>+ WARN_ON_ONCE(nested_cpu_has_vid(get_vmcs12(vcpu)));
This function can be called in other scenarios, e.g., from
kvm_apic_set_state(). Is it possible for the userspace VMM to set the APIC
state while L2 is running and VID is enabled for L2? If so, this warning could
be triggered by the userspace VMM.
Anyway, I verified this patch can fix the reported issue. So,
Tested-by: Chao Gao <chao.gao@...el.com>
>+ to_vmx(vcpu)->nested.update_vmcs01_hwapic_isr = true;
>+ return;
>+ }
>+
> if (max_isr == -1)
> max_isr = 0;
Powered by blists - more mailing lists