All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-stable] KVM: VMX: clear vmx_x86_ops.sync_pir_to_irr if APICv is disabled
@ 2021-12-20  9:49 Paolo Bonzini
  2021-12-20  9:55 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2021-12-20  9:49 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: stable

commit e90e51d5f01d2baae5dcce280866bbb96816e978 upstream.

There is nothing to synchronize if APICv is disabled, since neither
other vCPUs nor assigned devices can set PIR.ON.

After the patch was committed to Linus's tree, it was observed that
this fixes an issue with commit 7e1901f6c86c ("KVM: VMX: prepare
sync_pir_to_irr for running with APICv disabled", backported to stable
as e.g. commit 70a37e04c08a for the 5.15 tree).  Without this patch,
vmx_sync_pir_to_irr can be reached with enable_apicv == false, triggering

 	if (KVM_BUG_ON(!enable_apicv, vcpu->kvm))

Fixes: 7e1901f6c86c ("KVM: VMX: prepare sync_pir_to_irr for running with APICv disabled")
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/vmx/vmx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index dacdf2395f01..4e212f04268b 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -7776,10 +7776,10 @@ static __init int hardware_setup(void)
 		ple_window_shrink = 0;
 	}
 
-	if (!cpu_has_vmx_apicv()) {
+	if (!cpu_has_vmx_apicv())
 		enable_apicv = 0;
+	if (!enable_apicv)
 		vmx_x86_ops.sync_pir_to_irr = NULL;
-	}
 
 	if (cpu_has_vmx_tsc_scaling()) {
 		kvm_has_tsc_control = true;
-- 
2.33.1


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

* Re: [PATCH for-stable] KVM: VMX: clear vmx_x86_ops.sync_pir_to_irr if APICv is disabled
  2021-12-20  9:49 [PATCH for-stable] KVM: VMX: clear vmx_x86_ops.sync_pir_to_irr if APICv is disabled Paolo Bonzini
@ 2021-12-20  9:55 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2021-12-20  9:55 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: linux-kernel, kvm, stable

On Mon, Dec 20, 2021 at 10:49:50AM +0100, Paolo Bonzini wrote:
> commit e90e51d5f01d2baae5dcce280866bbb96816e978 upstream.
> 
> There is nothing to synchronize if APICv is disabled, since neither
> other vCPUs nor assigned devices can set PIR.ON.
> 
> After the patch was committed to Linus's tree, it was observed that
> this fixes an issue with commit 7e1901f6c86c ("KVM: VMX: prepare
> sync_pir_to_irr for running with APICv disabled", backported to stable
> as e.g. commit 70a37e04c08a for the 5.15 tree).  Without this patch,
> vmx_sync_pir_to_irr can be reached with enable_apicv == false, triggering
> 
>  	if (KVM_BUG_ON(!enable_apicv, vcpu->kvm))
> 
> Fixes: 7e1901f6c86c ("KVM: VMX: prepare sync_pir_to_irr for running with APICv disabled")
> Cc: stable@vger.kernel.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  arch/x86/kvm/vmx/vmx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Looks like it is already queued up, thanks.

greg k-h

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

end of thread, other threads:[~2021-12-20  9:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20  9:49 [PATCH for-stable] KVM: VMX: clear vmx_x86_ops.sync_pir_to_irr if APICv is disabled Paolo Bonzini
2021-12-20  9:55 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.