Re: [PATCH v3 1/4] KVM: x86: refactor req_immediate_exit logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/28/23 12:36, Maxim Levitsky wrote:
@@ -4176,6 +4176,9 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu)
  	clgi();
  	kvm_load_guest_xsave_state(vcpu);
+ if (vcpu->arch.req_immediate_exit)
+		smp_send_reschedule(vcpu->cpu);
+

This code is in a non-standard situation where IF=1 but interrupts are
effectively disabled.  Better something like:

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index beea99c8e8e0..3b945de2d880 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -4148,8 +4148,11 @@ static __no_kcsan fastpath_t svm_vcpu_run(
 		 * is enough to force an immediate vmexit.
 		 */
 		disable_nmi_singlestep(svm);
+		vcpu->arch.req_immediate_exit = true;
+	}
+
+	if (vcpu->arch.req_immediate_exit)
 		smp_send_reschedule(vcpu->cpu);
-	}

 	pre_svm_run(vcpu);


Paolo





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux