KVM: selftests: Sync perf_test_args to guest during VM creation
Copy perf_test_args to the guest during VM creation instead of relying on the caller to do so at their leisure. Ideally, tests wouldn't even be able to modify perf_test_args, i.e. they would have no motivation to do the sync, but enforcing that is arguably a net negative for readability. No functional change intended. [Set wr_fract=1 by default and add helper to override it since the new access_tracking_perf_test needs to set it dynamically.] Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: David Matlack <dmatlack@google.com> Reviewed-by: Ben Gardon <bgardon@google.com> Message-Id: <20211111000310.1435032-13-dmatlack@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
cf1d59300a
commit
13bbc70329
@@ -94,6 +94,9 @@ struct kvm_vm *perf_test_create_vm(enum vm_guest_mode mode, int vcpus,
|
||||
|
||||
pr_info("Testing guest mode: %s\n", vm_guest_mode_string(mode));
|
||||
|
||||
/* By default vCPUs will write to memory. */
|
||||
pta->wr_fract = 1;
|
||||
|
||||
/*
|
||||
* Snapshot the non-huge page size. This is used by the guest code to
|
||||
* access/dirty pages at the logging granularity.
|
||||
@@ -157,6 +160,9 @@ struct kvm_vm *perf_test_create_vm(enum vm_guest_mode mode, int vcpus,
|
||||
|
||||
ucall_init(vm, NULL);
|
||||
|
||||
/* Export the shared variables to the guest. */
|
||||
sync_global_to_guest(vm, perf_test_args);
|
||||
|
||||
return vm;
|
||||
}
|
||||
|
||||
@@ -165,3 +171,9 @@ void perf_test_destroy_vm(struct kvm_vm *vm)
|
||||
ucall_uninit(vm);
|
||||
kvm_vm_free(vm);
|
||||
}
|
||||
|
||||
void perf_test_set_wr_fract(struct kvm_vm *vm, int wr_fract)
|
||||
{
|
||||
perf_test_args.wr_fract = wr_fract;
|
||||
sync_global_to_guest(vm, perf_test_args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user