]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: selftests: Print the seed for the guest pRNG iff it has changed
authorSean Christopherson <seanjc@google.com>
Thu, 27 Jun 2024 02:17:56 +0000 (10:17 +0800)
committerSean Christopherson <seanjc@google.com>
Thu, 27 Jun 2024 14:52:17 +0000 (07:52 -0700)
commitea09ace3f8f31fa32f6674c95329a6caf5ef629d
treebebda78f42271f7931e0e2f6117576152828db0d
parent17019d5195c467938b0289a2175e17eac4cc1cdf
KVM: selftests: Print the seed for the guest pRNG iff it has changed

Print the guest's random seed during VM creation if and only if the seed
has changed since the seed was last printed.  The vast majority of tests,
if not all tests at this point, set the seed during test initialization
and never change the seed, i.e. printing it every time a VM is created is
useless noise.

Snapshot and print the seed during early selftest init to play nice with
tests that use the kselftests harness, at the cost of printing an unused
seed for tests that change the seed during test-specific initialization,
e.g. dirty_log_perf_test.  The kselftests harness runs each testcase in a
separate process that is forked from the original process before creating
each testcase's VM, i.e. waiting until first VM creation will result in
the seed being printed by each testcase despite it never changing.  And
long term, the hope/goal is that setting the seed will be handled by the
core framework, i.e. that the dirty_log_perf_test wart will naturally go
away.

Reported-by: Yi Lai <yi1.lai@intel.com>
Reported-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Link: https://lore.kernel.org/r/20240627021756.144815-2-dapeng1.mi@linux.intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/lib/kvm_util.c