]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: selftests: x86: Prioritize getting max_gfn from GuestPhysBits
authorTao Su <tao1.su@linux.intel.com>
Mon, 13 May 2024 01:40:03 +0000 (09:40 +0800)
committerSean Christopherson <seanjc@google.com>
Wed, 5 Jun 2024 13:16:10 +0000 (06:16 -0700)
commit980b8bc01938c8bcc9742c1051f64b5f0ed178ac
tree0bf3dfac527077cb2f266b669c86250eebdad8ab
parentd21b3c60d6e3917f7388db6bcc455f01c99ee42b
KVM: selftests: x86: Prioritize getting max_gfn from GuestPhysBits

Use the max mappable GPA via GuestPhysBits advertised by KVM to calculate
max_gfn. Currently some selftests (e.g. access_tracking_perf_test,
dirty_log_test...) add RAM regions close to max_gfn, so guest may access
GPA beyond its mappable range and cause infinite loop.

Adjust max_gfn in vm_compute_max_gfn() since x86 selftests already
overrides vm_compute_max_gfn() specifically to deal with goofy edge cases.

Reported-by: Yi Lai <yi1.lai@intel.com>
Signed-off-by: Tao Su <tao1.su@linux.intel.com>
Tested-by: Yi Lai <yi1.lai@intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20240513014003.104593-1-tao1.su@linux.intel.com
[sean: tweak name, add comment and sanity check]
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/include/x86_64/processor.h
tools/testing/selftests/kvm/lib/x86_64/processor.c