KVM: selftests: Slightly simplify memstress_setup_nested()
PATCH 1/1 KVM: selftests: Slightly simplify memstress_setup_nested()
Instead of calling memstress_setup_ept_mappings() only in the first iteration in the loop, move it before the loop.
The call needed to happen within the loop before commit e40e72fec0de ("KVM: selftests: Stop passing VMX metadata to TDP mapping functions"), as memstress_setup_ept_mappings() used to take in a pointer to vmx_pages and pass it into tdp_identity_map_1g() (to get the EPT root GPA). This is no longer the case, as tdp_identity_map_1g() gets the EPT root through stage2 MMU.
--- tools/testing/selftests/kvm/lib/x86/memstress.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
tools/testing/selftests/kvm/lib/x86/memstress.c +1 -4
@@ -110,16 +110,13 @@ void memstress_setup_nested(struct kvm_vm *vm, int nr_vcpus, struct kvm_vcpu *vcTEST_REQUIRE (kvm_cpu_has_tdp ());vm_enable_tdp (vm); +memstress_setup_ept_mappings (vm);for (vcpu_id =0 ; vcpu_id < nr_vcpus; vcpu_id++) {if (kvm_cpu_has (X86_FEATURE_VMX ))vcpu_alloc_vmx (vm, &nested_gva);else vcpu_alloc_svm (vm, &nested_gva); -/* The EPTs are shared across vCPUs, setup the mappings once */ -if (vcpu_id ==0 ) -memstress_setup_ept_mappings (vm); -/* * Override the vCPU to run memstress_l1_guest_code() which will * bounce it into L2 before calling memstress_guest_code().
base-commit: f62b64b970570c92fe22503b0cdc65be7ce7fc7c
Signature · 1 line
2.52.0.457.g6b5491de43-goog
Sean Christopherson
maintainerQuoted 11 lines · Yosry Ahmed
Instead of calling
memstress_setup_ept_mappings()only in the first iteration in the loop, move it before the loop.The call needed to happen within the loop before commit
e40e72fec0de("KVM: selftests: Stop passing VMX metadata to TDP mapping functions"), asmemstress_setup_ept_mappings()used to take in a pointer tovmx_pagesand pass it intotdp_identity_map_1g()(to get the EPT root GPA). This is no longer the case, astdp_identity_map_1g()gets the EPT root through stage2 MMU.[...]
Applied to kvm-x86 selftests, thanks!
[1/1] KVM: selftests: Slightly simplify memstress_setup_nested()
https://github.com/kvm-x86/linux/commit/f756ed82c62a