public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Colton Lewis <coltonlewis@google.com>
Cc: kvm@vger.kernel.org, pbonzini@redhat.com, maz@kernel.org,
	dmatlack@google.com, oupton@google.com, ricarkol@google.com
Subject: Re: [PATCH v9 2/4] KVM: selftests: create -r argument to specify random seed
Date: Wed, 2 Nov 2022 23:35:18 +0000	[thread overview]
Message-ID: <Y2L+tt1uwb4qrPvu@google.com> (raw)
In-Reply-To: <20221102160007.1279193-3-coltonlewis@google.com>

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@google.com>
> ---

Reviewed-by: Sean Christopherson <seanjc@google.com>

> 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@google.com

  reply	other threads:[~2022-11-02 23:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 16:00 [PATCH v9 0/4] randomize memory access of dirty_log_perf_test Colton Lewis
2022-11-02 16:00 ` [PATCH v9 1/4] KVM: selftests: implement random number generator for guest code Colton Lewis
2022-11-02 23:22   ` Sean Christopherson
2022-11-03 16:34   ` David Matlack
2022-11-07 18:14     ` Colton Lewis
2022-11-02 16:00 ` [PATCH v9 2/4] KVM: selftests: create -r argument to specify random seed Colton Lewis
2022-11-02 23:35   ` Sean Christopherson [this message]
2022-11-03 16:27   ` David Matlack
2022-11-07 18:18     ` Colton Lewis
2022-11-02 16:00 ` [PATCH v9 3/4] KVM: selftests: randomize which pages are written vs read Colton Lewis
2022-11-03 16:30   ` David Matlack
2022-11-02 16:00 ` [PATCH v9 4/4] KVM: selftests: randomize page access order Colton Lewis
2022-11-03 16:32   ` David Matlack
2022-11-02 23:38 ` [PATCH v9 0/4] randomize memory access of dirty_log_perf_test Sean Christopherson
2022-11-02 23:55   ` David Matlack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y2L+tt1uwb4qrPvu@google.com \
    --to=seanjc@google.com \
    --cc=coltonlewis@google.com \
    --cc=dmatlack@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=oupton@google.com \
    --cc=pbonzini@redhat.com \
    --cc=ricarkol@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox