From: Sean Christopherson <seanjc@google.com>
To: Wei Wang <wei.w.wang@intel.com>
Cc: pbonzini@redhat.com, dmatlack@google.com, vipinsh@google.com,
ajones@ventanamicro.com, eric.auger@redhat.com,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 09/18] KVM: selftests/steal_time: vcpu related code consolidation and cleanup
Date: Thu, 27 Oct 2022 00:17:41 +0000 [thread overview]
Message-ID: <Y1nOJQWys3gUp+oB@google.com> (raw)
In-Reply-To: <20221024113445.1022147-10-wei.w.wang@intel.com>
On Mon, Oct 24, 2022, Wei Wang wrote:
> Remove the unnecessary definition of array of the vcpu pointers and
> re-use the one from the kvm_vm struct (i.e. vm->vcpus[]). Use the helper
> function to create the time stealing thread with name.
One thing per patch.
> Also add a check of the pthread_join return value.
>
> Signed-off-by: Wei Wang <wei.w.wang@intel.com>
> ---
> tools/testing/selftests/kvm/steal_time.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c
> index db8967f1a17b..857ed2c073fc 100644
> --- a/tools/testing/selftests/kvm/steal_time.c
> +++ b/tools/testing/selftests/kvm/steal_time.c
> @@ -8,7 +8,6 @@
> #include <stdio.h>
> #include <time.h>
> #include <sched.h>
> -#include <pthread.h>
> #include <linux/kernel.h>
> #include <asm/kvm.h>
> #include <asm/kvm_para.h>
> @@ -241,7 +240,7 @@ static void run_vcpu(struct kvm_vcpu *vcpu)
>
> int main(int ac, char **av)
> {
> - struct kvm_vcpu *vcpus[NR_VCPUS];
> + struct kvm_vcpu **vcpus;
> struct kvm_vm *vm;
> pthread_attr_t attr;
> pthread_t thread;
> @@ -250,7 +249,7 @@ int main(int ac, char **av)
> long stolen_time;
> long run_delay;
> bool verbose;
> - int i;
> + int i, r;
>
> verbose = ac > 1 && (!strncmp(av[1], "-v", 3) || !strncmp(av[1], "--verbose", 10));
>
> @@ -262,7 +261,8 @@ int main(int ac, char **av)
> pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
>
> /* Create a VM and an identity mapped memslot for the steal time structure */
> - vm = vm_create_with_vcpus(NR_VCPUS, guest_code, vcpus);
> + vm = vm_create_with_vcpus(NR_VCPUS, guest_code, NULL);
> + vcpus = vm->vcpus;
Just use vm->vcpus directly and drop the local variable, it's not that much more
churn and this looks quite odd.
next prev parent reply other threads:[~2022-10-27 0:17 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 11:34 [PATCH v1 00/18] KVM selftests code consolidation and cleanup Wei Wang
2022-10-24 11:34 ` [PATCH v1 01/18] KVM: selftests/kvm_util: use array of pointers to maintain vcpus in kvm_vm Wei Wang
2022-10-26 23:47 ` Sean Christopherson
2022-10-27 12:28 ` Wang, Wei W
2022-10-27 15:27 ` Sean Christopherson
2022-10-28 2:13 ` Wang, Wei W
2022-10-24 11:34 ` [PATCH v1 02/18] KVM: selftests/kvm_util: use vm->vcpus[] when create vm with vcpus Wei Wang
2022-10-24 11:34 ` [PATCH v1 03/18] KVM: selftests/kvm_util: helper functions for vcpus and threads Wei Wang
2022-10-27 0:09 ` Sean Christopherson
2022-10-27 14:02 ` Wang, Wei W
2022-10-27 14:54 ` Sean Christopherson
2022-10-24 11:34 ` [PATCH v1 04/18] KVM: selftests/kvm_page_table_test: vcpu related code consolidation Wei Wang
2022-10-24 11:34 ` [PATCH v1 05/18] KVM: selftests/hardware_disable_test: code consolidation and cleanup Wei Wang
2022-10-27 0:16 ` Sean Christopherson
2022-10-27 14:14 ` Wang, Wei W
2022-10-27 18:03 ` Sean Christopherson
2022-10-28 2:16 ` Wang, Wei W
2022-10-24 11:34 ` [PATCH v1 06/18] KVM: selftests/dirty_log_test: vcpu related code consolidation Wei Wang
2022-10-24 11:34 ` [PATCH v1 07/18] KVM: selftests/max_guest_memory_test: " Wei Wang
2022-10-24 11:34 ` [PATCH v1 08/18] KVM: selftests/set_memory_region_test: " Wei Wang
2022-10-24 11:34 ` [PATCH v1 09/18] KVM: selftests/steal_time: vcpu related code consolidation and cleanup Wei Wang
2022-10-27 0:17 ` Sean Christopherson [this message]
2022-10-24 11:34 ` [PATCH v1 10/18] KVM: selftests/tsc_scaling_sync: vcpu related code consolidation Wei Wang
2022-10-24 11:34 ` [PATCH v1 11/18] KVM: selftest/xapic_ipi_test: " Wei Wang
2022-10-24 11:34 ` [PATCH v1 12/18] KVM: selftests/rseq_test: name the migration thread and some cleanup Wei Wang
2022-10-27 0:18 ` Sean Christopherson
2022-10-24 11:34 ` [PATCH v1 13/18] KVM: selftests/perf_test_util: vcpu related code consolidation Wei Wang
2022-10-24 11:34 ` [PATCH v1 14/18] KVM: selftest/memslot_perf_test: " Wei Wang
2022-10-24 11:34 ` [PATCH v1 15/18] KVM: selftests/vgic_init: " Wei Wang
2022-10-24 11:34 ` [PATCH v1 16/18] KVM: selftest/arch_timer: " Wei Wang
2022-10-24 11:34 ` [PATCH v1 17/18] KVM: selftests: remove the *vcpu[] input from __vm_create_with_vcpus Wei Wang
2022-10-24 11:34 ` [PATCH v1 18/18] KVM: selftests/kvm_create_max_vcpus: check KVM_MAX_VCPUS Wei Wang
2022-10-27 0:22 ` Sean Christopherson
2022-10-26 21:22 ` [PATCH v1 00/18] KVM selftests code consolidation and cleanup David Matlack
2022-10-27 12:18 ` Wang, Wei W
2022-10-27 15:44 ` Sean Christopherson
2022-10-27 16:24 ` David Matlack
2022-10-27 18:27 ` Sean Christopherson
2022-10-28 12:41 ` Andrew Jones
2022-10-28 15:49 ` Sean Christopherson
2022-11-07 18:11 ` David Matlack
2022-11-07 18:19 ` Sean Christopherson
2022-11-09 19:05 ` 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=Y1nOJQWys3gUp+oB@google.com \
--to=seanjc@google.com \
--cc=ajones@ventanamicro.com \
--cc=dmatlack@google.com \
--cc=eric.auger@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=vipinsh@google.com \
--cc=wei.w.wang@intel.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.