Skip to content

Add Nested NPT support in selftests

Yosry Ahmed kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest16 patches 19 repliesIn review

Changes in v3 from the cover letter

- Dropped the patches that landed in kvm-x86.
- Reshuffled some patches and cleanups.
- Introduced kvm_mmu data structures to hold the root, page table levels, and page table masks (Sean).
- Extended memstress as well to cover nested SVM.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/16KVM: selftests: Make __vm_get_page_table_entry() statictools/testing/selftests/kvm/include/x86/processor.h tools/testing/selftests/kvm/lib/x86/processor.c+2 -40 replies
2/16KVM: selftests: Stop passing a memslot to nested_map_memslot()tools/testing/selftests/kvm/include/x86/vmx.h tools/testing/selftests/kvm/lib/x86/vmx.c tools/testing/selftests/kvm/x86/vmx_dirty_log_test.c+11 -70 replies
3/16KVM: selftests: Rename nested TDP mapping functionstools/testing/selftests/kvm/include/x86/vmx.h tools/testing/selftests/kvm/lib/x86/memstress.c tools/testing/selftests/kvm/lib/x86/vmx.c +1 more+37 -390 replies
4/16KVM: selftests: Kill eptPageTablePointertools/testing/selftests/kvm/lib/x86/vmx.c+17 -200 replies
5/16KVM: selftests: Stop setting AD bits on nested EPTs on creationtools/testing/selftests/kvm/lib/x86/vmx.c+0 -82 replies
6/16KVM: selftests: Introduce struct kvm_mmutools/testing/selftests/kvm/include/x86/kvm_util_arch.h tools/testing/selftests/kvm/include/x86/processor.h tools/testing/selftests/kvm/lib/x86/processor.c+53 -203 replies
7/16KVM: selftests: Move PTE bitmasks to kvm_mmutools/testing/selftests/kvm/include/x86/processor.h tools/testing/selftests/kvm/lib/x86/processor.c+74 -372 replies
8/16KVM: selftests: Use a nested MMU to share nested EPTs between vCPUstools/testing/selftests/kvm/include/x86/kvm_util_arch.h tools/testing/selftests/kvm/include/x86/processor.h tools/testing/selftests/kvm/include/x86/vmx.h +4 more+36 -361 reply
9/16KVM: selftests: Stop passing VMX metadata to TDP mapping functionstools/testing/selftests/kvm/include/x86/vmx.h tools/testing/selftests/kvm/lib/x86/memstress.c tools/testing/selftests/kvm/lib/x86/vmx.c +1 more+24 -401 reply
10/16KVM: selftests: Reuse virt mapping functions for nested EPTstools/testing/selftests/kvm/include/x86/processor.h tools/testing/selftests/kvm/lib/x86/processor.c tools/testing/selftests/kvm/lib/x86/vmx.c+33 -977 replies
11/16KVM: selftests: Move TDP mapping functions outside of vmx.ctools/testing/selftests/kvm/include/x86/processor.h tools/testing/selftests/kvm/include/x86/vmx.h tools/testing/selftests/kvm/lib/x86/processor.c +1 more+75 -741 reply
12/16KVM: selftests: Allow kvm_cpu_has_ept() to be called on AMD CPUstools/testing/selftests/kvm/lib/x86/vmx.c+3 -00 replies
13/16KVM: selftests: Add support for nested NPTstools/testing/selftests/kvm/include/x86/processor.h tools/testing/selftests/kvm/include/x86/svm_util.h tools/testing/selftests/kvm/lib/x86/memstress.c +3 more+52 -40 replies
14/16KVM: selftests: Set the user bit on nested NPT PTEstools/testing/selftests/kvm/include/x86/processor.h tools/testing/selftests/kvm/lib/x86/processor.c tools/testing/selftests/kvm/lib/x86/svm.c+11 -20 replies
15/16KVM: selftests: Extend vmx_dirty_log_test to cover SVMtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/x86/nested_dirty_log_test.c+54 -210 replies
16/16KVM: selftests: Extend memstress to run on nested SVMtools/testing/selftests/kvm/lib/x86/memstress.c+35 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 00/16] Add Nested NPT support in selftests

This series adds support for nested NPT, then extends vmx_dirty_log_test and kvm_dirty_log_test (with -n, using memstress) to cover nested SVM.

Patches 1-5 are cleanups and prep.

Patches 6-7 introduce a new data structure, kvm_mmu, that is used by virt mapping functions for guest page tables.

Patches 8-11 add a nested kvm_mmu for nested EPTs, which are now shared between all vCPUs, and reuses the virt mapping functions for EPTs.

Patches 12-14 add the support for nested NPTs, which becomes simple after all the above prep work.

Patches 15-16 extend the existing selftests exercising nested EPTs to also cover nested NPTs.

v2 -> v3:
- Dropped the patches that landed in kvm-x86.
- Reshuffled some patches and cleanups.
- Introduced kvm_mmu data structures to hold the root, page table levels, and page table masks (Sean).
- Extended memstress as well to cover nested SVM.

v2: https://lore.kernel.org/kvm/[email protected]/

Yosry Ahmed (16):
KVM: selftests: Make __vm_get_page_table_entry() static
KVM: selftests: Stop passing a memslot to nested_map_memslot()
KVM: selftests: Rename nested TDP mapping functions
KVM: selftests: Kill eptPageTablePointer
KVM: selftests: Stop setting AD bits on nested EPTs on creation
KVM: selftests: Introduce struct kvm_mmu
KVM: selftests: Move PTE bitmasks to kvm_mmu
KVM: selftests: Use a nested MMU to share nested EPTs between vCPUs
KVM: selftests: Stop passing VMX metadata to TDP mapping functions
KVM: selftests: Reuse virt mapping functions for nested EPTs
KVM: selftests: Move TDP mapping functions outside of vmx.c
KVM: selftests: Allow kvm_cpu_has_ept() to be called on AMD CPUs
KVM: selftests: Add support for nested NPTs
KVM: selftests: Set the user bit on nested NPT PTEs
KVM: selftests: Extend vmx_dirty_log_test to cover SVM
KVM: selftests: Extend memstress to run on nested SVM

 tools/testing/selftests/kvm/Makefile.kvm      |   2 +-
 .../selftests/kvm/include/x86/kvm_util_arch.h |   7 +
 .../selftests/kvm/include/x86/processor.h     |  68 ++++-
 .../selftests/kvm/include/x86/svm_util.h      |   9 +
 tools/testing/selftests/kvm/include/x86/vmx.h |  16 +-
 .../testing/selftests/kvm/lib/x86/memstress.c |  68 +++--
 .../testing/selftests/kvm/lib/x86/processor.c | 217 ++++++++++++---
 tools/testing/selftests/kvm/lib/x86/svm.c     |  25 ++
 tools/testing/selftests/kvm/lib/x86/vmx.c     | 256 ++++--------------
 ...rty_log_test.c => nested_dirty_log_test.c} |  87 ++++--
 10 files changed, 428 insertions(+), 327 deletions(-)
 rename tools/testing/selftests/kvm/x86/{vmx_dirty_log_test.c => nested_dirty_log_test.c} (67%)

base-commit: 115d5de2eef32ac5cd488404b44b38789362dbe6

Signature · 1 line
2.52.0.158.g65b55ccf14-goog