public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Fred Griffoul <fgriffo@amazon.co.uk>
Subject: [PATCH v3 3/5] KVM: nVMX: Precisely mark vAPIC and PID maps dirty when delivering nested PI
Date: Fri, 21 Nov 2025 14:34:42 -0800	[thread overview]
Message-ID: <20251121223444.355422-4-seanjc@google.com> (raw)
In-Reply-To: <20251121223444.355422-1-seanjc@google.com>

Explicitly mark the vmcs12 vAPIC and PI descriptor pages as dirty when
delivering a nested posted interrupt instead of marking all vmcs12 pages
as dirty.  This will allow marking the APIC access page (and any future
 vmcs12 pages) as dirty in nested_mark_vmcs12_pages_dirty() without over-
dirtying in the nested PI case.  Manually marking the vAPIC and PID pages
as dirty also makes the flow a bit more self-documenting, e.g. it's not
obvious at first glance that vmx->nested.pi_desc is actually a host kernel
mapping of a vmcs12 page.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/kvm/vmx/nested.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index d4ef33578747..d0cf99903971 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -4027,7 +4027,8 @@ static int vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu)
 		}
 	}
 
-	nested_mark_vmcs12_pages_dirty(vcpu);
+	kvm_vcpu_map_mark_dirty(vcpu, &vmx->nested.virtual_apic_map);
+	kvm_vcpu_map_mark_dirty(vcpu, &vmx->nested.pi_desc_map);
 	return 0;
 
 mmio_needed:
-- 
2.52.0.rc2.455.g230fcf2819-goog


  parent reply	other threads:[~2025-11-21 22:34 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 ` Sean Christopherson [this message]
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
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=20251121223444.355422-4-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=fgriffo@amazon.co.uk \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@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