linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: VMX: Prepare VMCS setting for posted interrupt enabling when APICv is available
@ 2022-03-15 14:58 Zeng Guang
  2022-03-15 20:39 ` Paolo Bonzini
  2022-03-15 21:38 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Zeng Guang @ 2022-03-15 14:58 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
	Jim Mattson, Joerg Roedel, kvm
  Cc: x86, linux-kernel, Gao Chao, Zeng Guang

Currently KVM setup posted interrupt VMCS only depending on
per-vcpu APICv activation status at the vCPU creation time.
However, this status can be toggled dynamically under some
circumstance. So potentially, later posted interrupt enabling
may be problematic without VMCS readiness.

To fix this, always settle the VMCS setting for posted interrupt
as long as APICv is available and lapic locates in kernel.

Signed-off-by: Zeng Guang <guang.zeng@intel.com>
---
 arch/x86/kvm/vmx/vmx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index b730d799c26e..d6e42d37bb61 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -4388,7 +4388,7 @@ static void init_vmcs(struct vcpu_vmx *vmx)
 	if (cpu_has_secondary_exec_ctrls())
 		secondary_exec_controls_set(vmx, vmx_secondary_exec_control(vmx));
 
-	if (kvm_vcpu_apicv_active(&vmx->vcpu)) {
+	if (enable_apicv && lapic_in_kernel(&vmx->vcpu)) {
 		vmcs_write64(EOI_EXIT_BITMAP0, 0);
 		vmcs_write64(EOI_EXIT_BITMAP1, 0);
 		vmcs_write64(EOI_EXIT_BITMAP2, 0);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: VMX: Prepare VMCS setting for posted interrupt enabling when APICv is available
  2022-03-15 14:58 [PATCH] KVM: VMX: Prepare VMCS setting for posted interrupt enabling when APICv is available Zeng Guang
@ 2022-03-15 20:39 ` Paolo Bonzini
  2022-03-15 21:38 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2022-03-15 20:39 UTC (permalink / raw)
  To: Zeng Guang
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, x86, linux-kernel, Gao Chao

Queued, thanks.

Paolo



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: VMX: Prepare VMCS setting for posted interrupt enabling when APICv is available
  2022-03-15 14:58 [PATCH] KVM: VMX: Prepare VMCS setting for posted interrupt enabling when APICv is available Zeng Guang
  2022-03-15 20:39 ` Paolo Bonzini
@ 2022-03-15 21:38 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2022-03-15 21:38 UTC (permalink / raw)
  To: Zeng Guang
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, x86, linux-kernel, Gao Chao

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-15 21:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-15 14:58 [PATCH] KVM: VMX: Prepare VMCS setting for posted interrupt enabling when APICv is available Zeng Guang
2022-03-15 20:39 ` Paolo Bonzini
2022-03-15 21:38 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).