Skip to content

Commit f756ed8

Browse files
yosrym93sean-jc
authored andcommitted
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 e40e72f ("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. Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev> Link: https://patch.msgid.link/20260113171456.2097312-1-yosry.ahmed@linux.dev Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent e353850 commit f756ed8

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

tools/testing/selftests/kvm/lib/x86/memstress.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,13 @@ void memstress_setup_nested(struct kvm_vm *vm, int nr_vcpus, struct kvm_vcpu *vc
110110
TEST_REQUIRE(kvm_cpu_has_tdp());
111111

112112
vm_enable_tdp(vm);
113+
memstress_setup_ept_mappings(vm);
113114
for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) {
114115
if (kvm_cpu_has(X86_FEATURE_VMX))
115116
vcpu_alloc_vmx(vm, &nested_gva);
116117
else
117118
vcpu_alloc_svm(vm, &nested_gva);
118119

119-
/* The EPTs are shared across vCPUs, setup the mappings once */
120-
if (vcpu_id == 0)
121-
memstress_setup_ept_mappings(vm);
122-
123120
/*
124121
* Override the vCPU to run memstress_l1_guest_code() which will
125122
* bounce it into L2 before calling memstress_guest_code().

0 commit comments

Comments
 (0)