[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0c626505-a358-4d13-99e3-144356d136b3@redhat.com>
Date: Fri, 24 Nov 2023 17:07:36 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Maxim Levitsky <mlevitsk@...hat.com>, kvm@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>,
Sean Christopherson <seanjc@...gle.com>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
linux-kernel@...r.kernel.org, x86@...nel.org,
Dave Hansen <dave.hansen@...ux.intel.com>
Subject: Re: [PATCH v3 1/4] KVM: x86: refactor req_immediate_exit logic
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
Powered by blists - more mailing lists