Skip to content

KVM: SVM: Add Page Modification Logging (PML) support

Nikunj A Dadhania kvm sashiko-reviews 8 versions – Applied

Status from this message: Applied to kvm-x86 misc, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest8 patches 7 repliesApplied
  2. v77 patches 6 repliesSuperseded
  3. v67 patches 21 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v58 patches13 repliesSuperseded
v47 patches17 repliesSuperseded
v35 patches6 repliesSuperseded
v24 patches8 repliesSuperseded
v1 RFC4 patches14 repliesSuperseded

Changes in v8 from the cover letter

* Rebased on latest kvm/next
* Drop redundant pml_addr=0 in nested_vmcb02_prepare_control() (Yosry)
* Fix misleading comment, pml_index=-1 is hardening not stale-data cleanup (Yosry, Sean)
* Route nested SVM_EXIT_PML_FULL to KVM and treat it as unexpected exit (Sean)
* Refactor update_cpu_dirty_logging() to common code as a separate pre-patch (Sean)

Patches in v8 Applied

#Subject and filesSizeRepliesApplied
1/8KVM: VMX: Pass @vcpu, not @vmx to init_vmcs()arch/x86/kvm/vmx/vmx.c+13 -120 replies
2/8KVM: x86: Move PML page to common vcpu arch structurearch/x86/include/asm/kvm_host.h arch/x86/kvm/vmx/vmx.c arch/x86/kvm/vmx/vmx.h +1 more+17 -180 replies
3/8KVM: x86: Carve out PML flush routinearch/x86/kvm/vmx/vmx.c arch/x86/kvm/x86.c arch/x86/kvm/x86.h+35 -240 replies
4/8KVM: VMX: Use cpu_dirty_log_size instead of enable_pml for PML checksarch/x86/kvm/vmx/vmx.c+1 -10 replies
5/8KVM: x86: Carve out common dirty logging updatearch/x86/include/asm/kvm_host.h arch/x86/kvm/vmx/main.c arch/x86/kvm/vmx/vmx.c +3 more+23 -160 replies
6/8x86/cpufeatures: Add Page modification loggingarch/x86/include/asm/cpufeatures.h arch/x86/kernel/cpu/scattered.c+2 -01 reply
7/8KVM: SVM: Use BIT_ULL for 64-bit misc_ctl bit definitionsarch/x86/include/asm/svm.h+4 -40 replies
8/8KVM: SVM: Add Page modification logging supportarch/x86/include/asm/svm.h arch/x86/include/uapi/asm/svm.h arch/x86/kvm/svm/nested.c +3 more+127 -43 replies

Reviews trailers per patch

6 of 8 patches have a Reviewed-by or Acked-by.

PatchKai HuangPankaj GuptaBorislav Petkov (AMD)
1/8R-b
2/8R-b
3/8R-b
4/8R-b R-b
5/8
6/8A-b
7/8
8/8A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v8 thread

Cover letter [PATCH v8 0/8] KVM: SVM: Add Page Modification Logging (PML) support

This series implements Page Modification Logging (PML) for guests on select AMD Zen6 and later processors, bringing hardware-assisted dirty logging support. PML is designed to track guest modified memory pages. PML enables the hypervisor to identify which pages in a guest's memory have been modified since the last checkpoint or during live migration. More details can be found in the latest AMD APM Volume 2 (System Programming), section "15.25.15 Page Modification Logging".

The PML feature uses two new VMCB fields (PML_ADDR and PML_INDEX) and generates a VMEXIT when the 4KB log buffer becomes full.

The feature is enabled by default when hardware support is detected and can be disabled via the 'pml' module parameter.

Changelog:
v8:
* Rebased on latest kvm/next
* Drop redundant pml_addr=0 in nested_vmcb02_prepare_control() (Yosry)
* Fix misleading comment, pml_index=-1 is hardening not stale-data cleanup (Yosry, Sean)
* Route nested SVM_EXIT_PML_FULL to KVM and treat it as unexpected exit (Sean)
* Refactor update_cpu_dirty_logging() to common code as a separate pre-patch (Sean)

v7: https://lore.kernel.org/kvm/[email protected]/
* Swap patch order to avoid adding @pml_page parameter only to remove it (Sean)
* Add Sean's prep patch to pass @vcpu to init_vmcs() instead of @vmx, cleaning up all vmx->vcpu usage (Sean)
* Drop guard(svm_vmcb01) patch; access vmcb01 directly in svm_update_cpu_dirty_logging() since VMCB is just memory (Sean, Yosry)
* Only initialize PML index on reset, leave unchanged on INIT to avoid discarding unflushed entries. PML_INDEX in the control area remains valid after intercepted SHUTDOWN (Sashiko, Sean, Kai)

Nikunj A Dadhania (7):
KVM: x86: Move PML page to common vcpu arch structure
KVM: x86: Carve out PML flush routine
KVM: VMX: Use cpu_dirty_log_size instead of enable_pml for PML checks
KVM: x86: Carve out common dirty logging update x86/cpufeatures: Add Page modification logging
KVM: SVM: Use BIT_ULL for 64-bit misc_ctl bit definitions
KVM: SVM: Add Page modification logging support

Sean Christopherson (1):
KVM: VMX: Pass @vcpu, not @vmx to init_vmcs()

 arch/x86/include/asm/cpufeatures.h |   1 +
 arch/x86/include/asm/kvm_host.h    |   4 +-
 arch/x86/include/asm/svm.h         |  14 ++--
 arch/x86/include/uapi/asm/svm.h    |   2 +
 arch/x86/kernel/cpu/scattered.c    |   1 +
 arch/x86/kvm/svm/nested.c          |  14 ++++
 arch/x86/kvm/svm/sev.c             |   2 +-
 arch/x86/kvm/svm/svm.c             | 106 ++++++++++++++++++++++++++++-
 arch/x86/kvm/svm/svm.h             |   1 +
 arch/x86/kvm/vmx/main.c            |   4 +-
 arch/x86/kvm/vmx/vmx.c             |  82 +++++++---------------
 arch/x86/kvm/vmx/vmx.h             |   9 +--
 arch/x86/kvm/vmx/x86_ops.h         |   2 +-
 arch/x86/kvm/x86.c                 |  48 ++++++++++++-
 arch/x86/kvm/x86.h                 |   7 ++
 15 files changed, 220 insertions(+), 77 deletions(-)

base-commit: d4b7fb647204f0c81dfeae2d1a708e4d858e0c94

Signature · 1 line
2.48.1