lkml.org 
[lkml]   [2022]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH v2 16/21] KVM: x86: Evaluate ability to inject SMI/NMI/IRQ after potential VM-Exit
From
Date
On Tue, 2022-06-14 at 20:47 +0000, Sean Christopherson wrote:
> Determine whether or not new events can be injected after checking nested
> events. If a VM-Exit occurred during nested event handling, any previous
> event that needed re-injection is gone from's KVM perspective; the event
> is captured in the vmc*12 VM-Exit information, but doesn't exist in terms
> of what needs to be done for entry to L1.
>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
> arch/x86/kvm/x86.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 930de833aa2b..1a301a1730a5 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -9502,7 +9502,7 @@ static void kvm_inject_exception(struct kvm_vcpu *vcpu)
>
> static int inject_pending_event(struct kvm_vcpu *vcpu, bool *req_immediate_exit)
> {
> - bool can_inject = !kvm_event_needs_reinjection(vcpu);
> + bool can_inject;
> int r;
>
> /*
> @@ -9567,7 +9567,13 @@ static int inject_pending_event(struct kvm_vcpu *vcpu, bool *req_immediate_exit)
> if (r < 0)
> goto out;
>
> - /* try to inject new event if pending */
> + /*
> + * New events, other than exceptions, cannot be injected if KVM needs
> + * to re-inject a previous event. See above comments on re-injecting
> + * for why pending exceptions get priority.
> + */
> + can_inject = !kvm_event_needs_reinjection(vcpu);
> +
> if (vcpu->arch.exception.pending) {
> /*
> * Fault-class exceptions, except #DBs, set RF=1 in the RFLAGS

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
Maxim Levitsky

\
 
 \ /
  Last update: 2022-07-06 14:06    [W:0.497 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site