From: Chao Gao <chao.gao@intel.com>
To: Sean Christopherson <seanjc@google.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
"Markku Ahvenjärvi" <mankku@gmail.com>,
"Janne Karhunen" <janne.karhunen@gmail.com>
Subject: Re: [PATCH 2/2] KVM: nVMX: Defer SVI update to vmcs01 on EOI when L2 is active w/o VID
Date: Mon, 4 Nov 2024 16:17:42 +0800 [thread overview]
Message-ID: <ZyiDJhTkPclSQYIk@intel.com> (raw)
In-Reply-To: <20241101192114.1810198-3-seanjc@google.com>
>@@ -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@intel.com>
>+ to_vmx(vcpu)->nested.update_vmcs01_hwapic_isr = true;
>+ return;
>+ }
>+
> if (max_isr == -1)
> max_isr = 0;
next prev parent reply other threads:[~2024-11-04 8:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 19:21 [PATCH 0/2] KVM: nVMX: Fix an SVI update bug with passthrough APIC Sean Christopherson
2024-11-01 19:21 ` [PATCH 1/2] KVM: x86: Plumb in the vCPU to kvm_x86_ops.hwapic_isr_update() Sean Christopherson
2024-11-04 7:29 ` Chao Gao
2024-11-04 22:43 ` Sean Christopherson
2024-11-05 4:02 ` Sean Christopherson
2024-11-01 19:21 ` [PATCH 2/2] KVM: nVMX: Defer SVI update to vmcs01 on EOI when L2 is active w/o VID Sean Christopherson
2024-11-04 8:17 ` Chao Gao [this message]
2024-11-05 2:04 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZyiDJhTkPclSQYIk@intel.com \
--to=chao.gao@intel.com \
--cc=janne.karhunen@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mankku@gmail.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox