]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: nVMX: Precisely mark vAPIC and PID maps dirty when delivering nested PI
authorSean Christopherson <seanjc@google.com>
Fri, 21 Nov 2025 22:34:42 +0000 (14:34 -0800)
committerSean Christopherson <seanjc@google.com>
Thu, 8 Jan 2026 19:58:22 +0000 (11:58 -0800)
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.

Link: https://patch.msgid.link/20251121223444.355422-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/nested.c

index 72fcb1228af4dd6659a046a200407687134d0284..f5ebd84a2f6beea8219028035aafa31740fd9bd8 100644 (file)
@@ -4028,7 +4028,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: