From: David Matlack <dmatlack@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, Sean Christopherson <seanjc@google.com>,
Ben Gardon <bgardon@google.com>,
Andrew Jones <drjones@redhat.com>,
Jim Mattson <jmattson@google.com>,
Yanan Wang <wangyanan55@huawei.com>, Peter Xu <peterx@redhat.com>,
Aaron Lewis <aaronlewis@google.com>,
David Matlack <dmatlack@google.com>
Subject: [PATCH 1/4] KVM: selftests: Start at iteration 0 instead of -1
Date: Thu, 11 Nov 2021 00:12:54 +0000 [thread overview]
Message-ID: <20211111001257.1446428-2-dmatlack@google.com> (raw)
In-Reply-To: <20211111001257.1446428-1-dmatlack@google.com>
Start at iteration 0 instead of -1 to avoid having to initialize
vcpu_last_completed_iteration when setting up vCPU threads. This
simplifies the next commit where we move vCPU thread initialization
out to a common helper.
No functional change intended.
Signed-off-by: David Matlack <dmatlack@google.com>
---
tools/testing/selftests/kvm/access_tracking_perf_test.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/kvm/access_tracking_perf_test.c b/tools/testing/selftests/kvm/access_tracking_perf_test.c
index 5364a2ed7c68..7f25a06e19c9 100644
--- a/tools/testing/selftests/kvm/access_tracking_perf_test.c
+++ b/tools/testing/selftests/kvm/access_tracking_perf_test.c
@@ -47,7 +47,7 @@
#include "guest_modes.h"
/* Global variable used to synchronize all of the vCPU threads. */
-static int iteration = -1;
+static int iteration;
/* Defines what vCPU threads should do during a given iteration. */
static enum {
@@ -220,7 +220,7 @@ static void *vcpu_thread_main(void *arg)
struct perf_test_vcpu_args *vcpu_args = arg;
struct kvm_vm *vm = perf_test_args.vm;
int vcpu_id = vcpu_args->vcpu_id;
- int current_iteration = -1;
+ int current_iteration = 0;
while (spin_wait_for_next_iteration(¤t_iteration)) {
switch (READ_ONCE(iteration_work)) {
@@ -303,11 +303,9 @@ static pthread_t *create_vcpu_threads(int vcpus)
vcpu_threads = malloc(vcpus * sizeof(vcpu_threads[0]));
TEST_ASSERT(vcpu_threads, "Failed to allocate vcpu_threads.");
- for (i = 0; i < vcpus; i++) {
- vcpu_last_completed_iteration[i] = iteration;
+ for (i = 0; i < vcpus; i++)
pthread_create(&vcpu_threads[i], NULL, vcpu_thread_main,
&perf_test_args.vcpu_args[i]);
- }
return vcpu_threads;
}
--
2.34.0.rc1.387.gb447b232ab-goog
next prev parent reply other threads:[~2021-11-11 0:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-11 0:12 [PATCH 0/4] KVM: selftests: Avoid mmap_sem contention during memory population David Matlack
2021-11-11 0:12 ` David Matlack [this message]
2021-11-11 0:12 ` [PATCH 2/4] KVM: selftests: Move vCPU thread creation and joining to common helpers David Matlack
2021-11-11 18:08 ` Ben Gardon
2021-11-12 0:47 ` David Matlack
2021-11-11 0:12 ` [PATCH 3/4] KVM: selftests: Wait for all vCPU to be created before entering guest mode David Matlack
2021-11-11 18:17 ` Ben Gardon
2021-11-12 0:51 ` David Matlack
2021-11-12 1:46 ` David Matlack
2021-11-12 16:32 ` Sean Christopherson
2021-11-11 0:12 ` [PATCH 4/4] KVM: selftests: Use perf_test_destroy_vm in memslot_modification_stress_test David Matlack
2021-11-11 18:18 ` Ben Gardon
2021-11-16 11:13 ` [PATCH 0/4] KVM: selftests: Avoid mmap_sem contention during memory population Paolo Bonzini
2021-11-17 0:21 ` David Matlack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211111001257.1446428-2-dmatlack@google.com \
--to=dmatlack@google.com \
--cc=aaronlewis@google.com \
--cc=bgardon@google.com \
--cc=drjones@redhat.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=seanjc@google.com \
--cc=wangyanan55@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.