All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	wanpengli@tencent.com, stable@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: check for interrupts before deciding whether to exit the fast path
Date: Wed, 20 Oct 2021 19:42:05 +0000	[thread overview]
Message-ID: <YXBxDYJcrx/C9QDS@google.com> (raw)
In-Reply-To: <20211020145231.871299-1-pbonzini@redhat.com>

On Wed, Oct 20, 2021, Paolo Bonzini wrote:
> The kvm_x86_sync_pir_to_irr callback can sometimes set KVM_REQ_EVENT.
> If that happens exactly at the time that an exit is handled as
> EXIT_FASTPATH_REENTER_GUEST, vcpu_enter_guest will go incorrectly
> through the loop that calls kvm_x86_run, instead of processing
> the request promptly.
> 
> Fixes: 379a3c8ee444 ("KVM: VMX: Optimize posted-interrupt delivery for timer fastpath")
> Cc: stable@vger.kernel.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---

Reviewed-by: Sean Christopherson <seanjc@google.com>

>  arch/x86/kvm/x86.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index fa48948b4934..b9b31e5f72b0 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -9781,14 +9781,14 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
>  		if (likely(exit_fastpath != EXIT_FASTPATH_REENTER_GUEST))
>  			break;
>  
> -                if (unlikely(kvm_vcpu_exit_request(vcpu))) {
> +		if (vcpu->arch.apicv_active)
> +			static_call(kvm_x86_sync_pir_to_irr)(vcpu);
> +
> +		if (unlikely(kvm_vcpu_exit_request(vcpu))) {
>  			exit_fastpath = EXIT_FASTPATH_EXIT_HANDLED;
>  			break;
>  		}
> -
> -		if (vcpu->arch.apicv_active)
> -			static_call(kvm_x86_sync_pir_to_irr)(vcpu);
> -        }
> +	}

I think someone working on git has a meta-entry in the obfuscated C context.
This is the most convoluted diff possible for a simple code move :-)

>  	/*
>  	 * Do this here before restoring debug registers on the host.  And
> -- 
> 2.27.0
> 

      reply	other threads:[~2021-10-20 19:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20 14:52 [PATCH] KVM: x86: check for interrupts before deciding whether to exit the fast path Paolo Bonzini
2021-10-20 19:42 ` Sean Christopherson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YXBxDYJcrx/C9QDS@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=wanpengli@tencent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.