Commit 86753bd0 authored by Ben Gardon's avatar Ben Gardon Committed by Paolo Bonzini

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: default avatarJacob Xu <jacobhxu@google.com>
Reviewed-by: default avatarMakarand Sonare <makarandsonare@google.com>
Signed-off-by: default avatarBen Gardon <bgardon@google.com>
Message-Id: <20210112214253.463999-5-bgardon@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 2d501238
...@@ -139,14 +139,19 @@ static void run_test(enum vm_guest_mode mode, void *arg) ...@@ -139,14 +139,19 @@ static void run_test(enum vm_guest_mode mode, void *arg)
clock_gettime(CLOCK_MONOTONIC, &start); clock_gettime(CLOCK_MONOTONIC, &start);
for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) { for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) {
vcpu_last_completed_iteration[vcpu_id] = -1;
pthread_create(&vcpu_threads[vcpu_id], NULL, vcpu_worker, pthread_create(&vcpu_threads[vcpu_id], NULL, vcpu_worker,
&perf_test_args.vcpu_args[vcpu_id]); &perf_test_args.vcpu_args[vcpu_id]);
} }
/* Allow the vCPU to populate memory */ /* Allow the vCPUs to populate memory */
pr_debug("Starting iteration %d - Populating\n", iteration); pr_debug("Starting iteration %d - Populating\n", iteration);
while (READ_ONCE(vcpu_last_completed_iteration[vcpu_id]) != iteration) for (vcpu_id = 0; vcpu_id < nr_vcpus; vcpu_id++) {
while (READ_ONCE(vcpu_last_completed_iteration[vcpu_id]) !=
iteration)
; ;
}
ts_diff = timespec_elapsed(start); ts_diff = timespec_elapsed(start);
pr_info("Populate memory time: %ld.%.9lds\n", pr_info("Populate memory time: %ld.%.9lds\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment