public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Binbin Wu <binbin.wu@linux.intel.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Fred Griffoul <fgriffo@amazon.co.uk>
Subject: Re: [PATCH v3 4/5] KVM: VMX: Move nested_mark_vmcs12_pages_dirty() to vmx.c, and rename
Date: Tue, 13 Jan 2026 16:51:52 +0800	[thread overview]
Message-ID: <b9281487-7dcf-4bab-b251-c2e54c9940c8@linux.intel.com> (raw)
In-Reply-To: <20251121223444.355422-5-seanjc@google.com>



On 11/22/2025 6:34 AM, Sean Christopherson wrote:
> Move nested_mark_vmcs12_pages_dirty() to vmx.c now that it's only used in
> the VM-Exit path, and add "all" to its name to document that its purpose
> is to mark all (mapped-out-of-band) vmcs12 pages as dirty.
> 
> No functional change intended.
> 
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
>  arch/x86/kvm/vmx/nested.c | 13 -------------
>  arch/x86/kvm/vmx/vmx.c    | 14 +++++++++++++-
>  2 files changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index d0cf99903971..97554eda440c 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -3980,19 +3980,6 @@ static void vmcs12_save_pending_event(struct kvm_vcpu *vcpu,
>  	}
>  }
>  
> -
> -void nested_mark_vmcs12_pages_dirty(struct kvm_vcpu *vcpu)

The declaration in the header file is left over.
Since the patch series has been merged in the kvm-x86 next branch, I sent a
patch to remove it.

https://lore.kernel.org/kvm/20260113084748.1714633-1-binbin.wu@linux.intel.com/

> -{
> -	struct vcpu_vmx *vmx = to_vmx(vcpu);
> -
> -	/*
> -	 * Don't need to mark the APIC access page dirty; it is never
> -	 * written to by the CPU during APIC virtualization.
> -	 */
> -	kvm_vcpu_map_mark_dirty(vcpu, &vmx->nested.virtual_apic_map);
> -	kvm_vcpu_map_mark_dirty(vcpu, &vmx->nested.pi_desc_map);
> -}
> -
>  static int vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu)
>  {
>  	struct vcpu_vmx *vmx = to_vmx(vcpu);
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 4cbe8c84b636..cc38d08935e8 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -6378,6 +6378,18 @@ static void vmx_flush_pml_buffer(struct kvm_vcpu *vcpu)
>  	vmcs_write16(GUEST_PML_INDEX, PML_HEAD_INDEX);
>  }
>  
> +static void nested_vmx_mark_all_vmcs12_pages_dirty(struct kvm_vcpu *vcpu)
> +{
> +	struct vcpu_vmx *vmx = to_vmx(vcpu);
> +
> +	/*
> +	 * Don't need to mark the APIC access page dirty; it is never
> +	 * written to by the CPU during APIC virtualization.
> +	 */
> +	kvm_vcpu_map_mark_dirty(vcpu, &vmx->nested.virtual_apic_map);
> +	kvm_vcpu_map_mark_dirty(vcpu, &vmx->nested.pi_desc_map);
> +}
> +
>  static void vmx_dump_sel(char *name, uint32_t sel)
>  {
>  	pr_err("%s sel=0x%04x, attr=0x%05x, limit=0x%08x, base=0x%016lx\n",
> @@ -6655,7 +6667,7 @@ static int __vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)
>  		 * Mark them dirty on every exit from L2 to prevent them from
>  		 * getting out of sync with dirty tracking.
>  		 */
> -		nested_mark_vmcs12_pages_dirty(vcpu);
> +		nested_vmx_mark_all_vmcs12_pages_dirty(vcpu);
>  
>  		/*
>  		 * Synthesize a triple fault if L2 state is invalid.  In normal


  reply	other threads:[~2026-01-13  8:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21 22:34 [PATCH v3 0/5] KVM: nVMX: Mark APIC page dirty on VM-Exit Sean Christopherson
2025-11-21 22:34 ` [PATCH v3 1/5] KVM: Use vCPU specific memslots in __kvm_vcpu_map() Sean Christopherson
2025-11-21 22:34 ` [PATCH v3 2/5] KVM: x86: Mark vmcs12 pages as dirty if and only if they're mapped Sean Christopherson
2025-11-21 22:34 ` [PATCH v3 3/5] KVM: nVMX: Precisely mark vAPIC and PID maps dirty when delivering nested PI Sean Christopherson
2025-11-21 22:34 ` [PATCH v3 4/5] KVM: VMX: Move nested_mark_vmcs12_pages_dirty() to vmx.c, and rename Sean Christopherson
2026-01-13  8:51   ` Binbin Wu [this message]
2025-11-21 22:34 ` [PATCH v3 5/5] KVM: nVMX: Mark APIC access page dirty when syncing vmcs12 pages Sean Christopherson
2026-01-12 17:38 ` [PATCH v3 0/5] KVM: nVMX: Mark APIC page dirty on VM-Exit Sean Christopherson

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=b9281487-7dcf-4bab-b251-c2e54c9940c8@linux.intel.com \
    --to=binbin.wu@linux.intel.com \
    --cc=fgriffo@amazon.co.uk \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.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