Skip to content

Commit 86753bd

Browse files
Ben Gardonbonzini
authored andcommitted
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 <[email protected]> Reviewed-by: Makarand Sonare <[email protected]> Signed-off-by: Ben Gardon <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 2d50123 commit 86753bd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tools/testing/selftests/kvm/dirty_log_perf_test.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,19 @@ static void run_test(enum vm_guest_mode mode, void *arg)
139139

140140
clock_gettime(CLOCK_MONOTONIC, &start);
141141
for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) {
142+
vcpu_last_completed_iteration[vcpu_id] = -1;
143+
142144
pthread_create(&vcpu_threads[vcpu_id], NULL, vcpu_worker,
143145
&perf_test_args.vcpu_args[vcpu_id]);
144146
}
145147

146-
/* Allow the vCPU to populate memory */
148+
/* Allow the vCPUs to populate memory */
147149
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+
}
150155

151156
ts_diff = timespec_elapsed(start);
152157
pr_info("Populate memory time: %ld.%.9lds\n",

0 commit comments

Comments
 (0)