diff options
| author | Nikunj A Dadhania <nikunj@amd.com> | 2026-09-07 06:39:06 +0000 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2026-09-28 16:40:40 -0700 |
| commit | 0d7fbc059f33527caadf1f0387d3eea61962c402 (patch) | |
| tree | 3daede297bfe50e14b669c15c5dc9a3ddc3ffba5 /tools/perf/scripts/python/task-analyzer.py | |
| parent | 5ebaa85a746e886ca23f03b8d2990a3c16d7f01f (diff) | |
KVM: SVM: Add Page modification logging support
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 <kai.huang@intel.com>
Signed-off-by: Nikunj A Dadhania <nikunj@amd.com>
Link: https://patch.msgid.link/20260907063906.1964557-9-nikunj@amd.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/perf/scripts/python/task-analyzer.py')
0 files changed, 0 insertions, 0 deletions
