Re: [PATCH v7.1] KVM: SVM: Add Page modification logging support
Sean Christopherson <[email protected]>
| Newsgroups | org.kernel.vger.kvm |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Jul 13, 2026, Nikunj A. Dadhania wrote: > > > On 5/29/2026 12:08 PM, Nikunj A Dadhania wrote: > > Currently, dirty logging relies on write protecting guest memory and > > marking dirty GFNs during subsequent write faults. This method works but > > incurs overhead due to additional write faults for each dirty GFN. > > > > Implement support for the Page Modification Logging (PML) feature, a > > hardware-assisted method for efficient dirty logging. PML automatically > > logs dirty GPA[51:12] to a 4K buffer when the CPU sets NPT D-bits. Two new > > VMCB fields are utilized: PML_ADDR and PML_INDEX. The PML_INDEX is > > initialized to 511 (8 bytes per GPA entry), and the CPU decreases the > > PML_INDEX after logging each GPA. When the PML buffer is full, a > > VMEXIT(PML_FULL) with exit code 0x407 is generated. > > > > Since PML_INDEX in the VMCB control area remains valid after an intercepted > > SHUTDOWN, only initialize it on reset and leave it unchanged on INIT to > > avoid discarding already-logged entries that haven't been flushed. > > > > PML operates on guest physical addresses at the NPT level, tracking D-bit > > updates in page tables rather than memory content. This allows it to work > > identically for normal and confidential computing guests > > (SEV/SEV-ES/SEV-SNP), enabling cpu_dirty_log_size to be set uniformly for > > all AMD VMs without special-casing encrypted guests. > > > > Use vmcb01 directly when updating PML controls to ensure L1's state > > remains correct, as svm->vmcb points to vmcb02 when L2 is active. > > > > PML is not enabled in hardware for nested guests; treat PML_FULL as > > unexpected exits. > > > > Add a new module parameter to enable/disable PML, and enable it by default > > when supported. > > > > Acked-by: Kai Huang <[email protected]> > > Signed-off-by: Nikunj A Dadhania <[email protected]> > > --- > > > > Sending updated 7/7 patch here, rather than reposting the full series. > > > > Sean, any remaining comments? Happy to send v8 if needed. > > A gentle reminder Sorry, I had moved this out of the TODO queue when I saw the "will fix in the next version", and didn't pay attention to the updated patch or to this mail. I.e. was waiting for v8. Hold off on v8 for now, in case there's more to address (I'll move this back to my queue).