This patch adds the ability to randomize parts of dirty_log_perf_test, specifically the order pages are accessed and whether pages are read or written. This version scraps the use of arrays to remove the memory management concerns and implementes a well-known random number generator, the Park-Miller Linear Congruential Generator, for the guest code to use directly. From comments on v2, several others agree this is the right approach. I came to the same conclusion and was already working on it. Though I had this idea and ignored it previously over concerns about introducing mysterious code, doing some research convinced me Park-Miller is both extremely easy to understand and high enough quality for this purpose. I also believe this approach better preserves the integrity of the test as a couple math instructions are definitely faster than fetching from memory. Compiled and run on x86_64 and arm64 to test the new flags. Based on v5.19 as tests on kvm/queue do not build Colton Lewis (3): KVM: selftests: Implement random number generation for guest code. KVM: selftests: Randomize which pages are written vs read. KVM: selftests: Randomize page access order. .../selftests/kvm/access_tracking_perf_test.c | 2 +- .../selftests/kvm/dirty_log_perf_test.c | 48 +++++++++++++------ .../selftests/kvm/include/perf_test_util.h | 8 +++- .../selftests/kvm/lib/perf_test_util.c | 40 +++++++++++++--- 4 files changed, 74 insertions(+), 24 deletions(-) -- 2.37.2.672.g94769d06f0-goog