public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm:vmx: update secondary controls when disabling APICv
@ 2016-05-16 15:38 Roman Kagan
  2016-05-16 20:15 ` Steve Rutherford
  0 siblings, 1 reply; 4+ messages in thread
From: Roman Kagan @ 2016-05-16 15:38 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini, Denis V. Lunev, Roman Kagan

There are APICv-related fields among secondary processor-based
VM-execution controls, too.  Those used to be left at their initial
enabled state when APICv was disabled (upon activating Hyper-V SynIC).
This would result in Windows guests getting stuck when SynIC-based
auto-EOI interrupt intersected with e.g. an IPI in the guest.

So update the secondary execution controls too, if present, when
deactivating APICv while enabling Hyper-V SynIC.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
---
 arch/x86/kvm/vmx.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ee1c8a9..7d98517 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -4778,13 +4778,6 @@ static u32 vmx_pin_based_exec_ctrl(struct vcpu_vmx *vmx)
 	return pin_based_exec_ctrl;
 }
 
-static void vmx_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu)
-{
-	struct vcpu_vmx *vmx = to_vmx(vcpu);
-
-	vmcs_write32(PIN_BASED_VM_EXEC_CONTROL, vmx_pin_based_exec_ctrl(vmx));
-}
-
 static u32 vmx_exec_control(struct vcpu_vmx *vmx)
 {
 	u32 exec_control = vmcs_config.cpu_based_exec_ctrl;
@@ -4843,6 +4836,16 @@ static u32 vmx_secondary_exec_control(struct vcpu_vmx *vmx)
 	return exec_control;
 }
 
+static void vmx_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu)
+{
+	struct vcpu_vmx *vmx = to_vmx(vcpu);
+
+	vmcs_write32(PIN_BASED_VM_EXEC_CONTROL, vmx_pin_based_exec_ctrl(vmx));
+	if (cpu_has_secondary_exec_ctrls())
+		vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
+				vmx_secondary_exec_control(vmx));
+}
+
 static void ept_set_mmio_spte_mask(void)
 {
 	/*
-- 
2.5.5


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

end of thread, other threads:[~2016-05-17 12:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-16 15:38 [PATCH] kvm:vmx: update secondary controls when disabling APICv Roman Kagan
2016-05-16 20:15 ` Steve Rutherford
2016-05-17  5:25   ` Denis V. Lunev
2016-05-17  8:46   ` Roman Kagan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox