Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: selftests: Fix population stage in dirty_log_perf_test

Currently the population stage in the dirty_log_perf_test does nothing
as the per-vCPU iteration counters are not initialized and the loop does
not wait for each vCPU. Remedy those errors.

Reviewed-by: Jacob Xu <jacobhxu@google.com>
Reviewed-by: Makarand Sonare <makarandsonare@google.com>

Signed-off-by: Ben Gardon <bgardon@google.com>
Message-Id: <20210112214253.463999-5-bgardon@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Ben Gardon and committed by
Paolo Bonzini
86753bd0 2d501238

+8 -3
+8 -3
tools/testing/selftests/kvm/dirty_log_perf_test.c
··· 139 139 140 140 clock_gettime(CLOCK_MONOTONIC, &start); 141 141 for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) { 142 + vcpu_last_completed_iteration[vcpu_id] = -1; 143 + 142 144 pthread_create(&vcpu_threads[vcpu_id], NULL, vcpu_worker, 143 145 &perf_test_args.vcpu_args[vcpu_id]); 144 146 } 145 147 146 - /* Allow the vCPU to populate memory */ 148 + /* Allow the vCPUs to populate memory */ 147 149 pr_debug("Starting iteration %d - Populating\n", iteration); 148 - while (READ_ONCE(vcpu_last_completed_iteration[vcpu_id]) != iteration) 149 - ; 150 + for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) { 151 + while (READ_ONCE(vcpu_last_completed_iteration[vcpu_id]) != 152 + iteration) 153 + ; 154 + } 150 155 151 156 ts_diff = timespec_elapsed(start); 152 157 pr_info("Populate memory time: %ld.%.9lds\n",