mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Carlos López" <clopez@suse.de>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Stefano Garzarella <sgarzare@redhat.com>,
	Chris Oo <cho@microsoft.com>
Subject: Re: [PATCH] KVM: SVM: Sync CR8 to the local APIC after marking the VMCB clean
Date: Sun, 15 Nov 2026 20:16:52 +0100	[thread overview]
Message-ID: <4873551e-05d8-47e0-a034-2dbc75fb3459@suse.de> (raw)
In-Reply-To: <20261113162556.461390-1-seanjc@google.com>

On 11/13/26 5:25 PM, Sean Christopherson wrote:
> From: Chris Oo <cho@microsoft.com>
> 
> Sync CR8 from the VMCB to the TPR *after* marking all VMCB fields as clean,
> as syncing CR8 can toggle the CR8 write intercept and thus mark INTERCEPTS
> as dirty.  Clobbering the dirty bit can result in KVM failing to detect CR8
> writes if the underlying "hardware" uses the clean bits to optimize VMRUN,
> e.g. when KVM is running on Hyper-V.
> 
> Failure to intercept CR8 usually manifests as hangs when running Windows as
> L2, as KVM's view of vTPR stays high and so KVM never injects pending IRQs.
> 
> Fixes: bb365a506b1e ("KVM: x86: Unconditionally recompute CR8 intercept on PPR update")
> Cc: stable@vger.kernel.org
> Cc: Carlos López <clopez@suse.de>
> Cc: Stefano Garzarella <sgarzare@redhat.com>
> Not-signed-off-by: Chris Oo <cho@microsoft.com>
> [sean: rewrite changelog, massage comment]
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Looks good, thanks!

Acked-by: Carlos López <clopez@suse.de>

> ---
> 
> Chris, as mentioned, I need your SoB.
> 
>  arch/x86/kvm/svm/svm.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 581bc3a23c95..3152846a6ccd 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -4726,8 +4726,6 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu, u64 run_flags)
>  	if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI))
>  		kvm_after_interrupt(vcpu);
>  
> -	sync_cr8_to_lapic(vcpu);
> -
>  	svm->next_rip = 0;
>  	if (is_guest_mode(vcpu)) {
>  		nested_sync_control_from_vmcb02(svm);
> @@ -4758,6 +4756,13 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu, u64 run_flags)
>  			       vcpu_to_pmu(vcpu)->global_ctrl);
>  	}
>  
> +	/*
> +	 * Note!  Any action that might dirty the VMCB must be done *after*
> +	 * marking all VMCB fields as clean, e.g. syncing CR8 can toggle the
> +	 * CR8 write intercept and thus mark the intercepts field dirty.
> +	 */
> +	sync_cr8_to_lapic(vcpu);
> +
>  	/* if exit due to PF check for async PF */
>  	if (svm->vmcb->control.exit_code == SVM_EXIT_EXCP_BASE + PF_VECTOR)
>  		vcpu->arch.apf.host_apf_flags =
> 
> base-commit: d21eef2084a9af87ac2a783bc7c2b175ba114e4e


      parent reply	other threads:[~2026-11-15 19:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 16:25 Sean Christopherson
2026-11-13 16:36 ` [EXTERNAL] " Chris Oo
2026-11-13 16:59 ` Yosry Ahmed
2026-11-15  8:10 ` Stefano Garzarella
2026-11-15 19:16 ` Carlos López [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=4873551e-05d8-47e0-a034-2dbc75fb3459@suse.de \
    --to=clopez@suse.de \
    --cc=cho@microsoft.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=sgarzare@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®