Re: [PATCH v9 2/4] KVM: selftests: create -r argument to specify random seed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 02, 2022, Colton Lewis wrote:
> Create a -r argument to specify a random seed. If no argument is
> provided, the seed defaults to 1. The random seed is set with
> perf_test_set_random_seed() and must be set before guest_code runs to
> apply.
> 
> Signed-off-by: Colton Lewis <coltonlewis@xxxxxxxxxx>
> ---

Reviewed-by: Sean Christopherson <seanjc@xxxxxxxxxx>

> diff --git a/tools/testing/selftests/kvm/lib/perf_test_util.c b/tools/testing/selftests/kvm/lib/perf_test_util.c
> index 9618b37c66f7..0bb0659b9a0d 100644
> --- a/tools/testing/selftests/kvm/lib/perf_test_util.c
> +++ b/tools/testing/selftests/kvm/lib/perf_test_util.c
> @@ -229,6 +229,12 @@ void perf_test_set_wr_fract(struct kvm_vm *vm, int wr_fract)
>  	sync_global_to_guest(vm, perf_test_args);
>  }
>  
> +void perf_test_set_random_seed(struct kvm_vm *vm, uint32_t random_seed)
> +{
> +	perf_test_args.random_seed = random_seed;
> +	sync_global_to_guest(vm, perf_test_args.random_seed);

After Vishal's series[*] to add a kvm_selftest_init() and kvm_arch_vm_post_create()
lands, we should look into moving the pRNG support to kvm_vm and kvm_vcpu.  E.g.
parse the base kvm_selftest_init(), copy it to each VM during kvm_arch_vm_post_create(),
and then init the per-vCPU pRNG when a vCPU is createrd.

The common parsing will probably require mucking with args[], or maybe using an
environment variable, but it'd be nice for the pRNG to be automagically available
to guest code.

[*] https://lore.kernel.org/all/20221013121319.994170-3-vannapurve@xxxxxxxxxx



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux