From: Sean Christopherson <seanjc@google.com>
To: "Wang, Wei W" <wei.w.wang@intel.com>
Cc: Vipin Sharma <vipinsh@google.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"dmatlack@google.com" <dmatlack@google.com>,
"andrew.jones@linux.dev" <andrew.jones@linux.dev>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 0/5] dirty_log_perf_test vCPU pinning
Date: Fri, 14 Oct 2022 16:34:48 +0000 [thread overview]
Message-ID: <Y0mPqNRSgpArgyS8@google.com> (raw)
In-Reply-To: <DS0PR11MB63735576A8FBF80738FF9B76DC249@DS0PR11MB6373.namprd11.prod.outlook.com>
On Fri, Oct 14, 2022, Wang, Wei W wrote:
> On Tuesday, October 11, 2022 6:06 AM, Vipin Sharma wrote:
> > Pin vCPUs to a host physical CPUs (pCPUs) in dirty_log_perf_test and optionally
> > pin the main application thread to a physical cpu if provided. All tests based on
> > perf_test_util framework can take advantage of it if needed.
> >
> > While at it, I changed atoi() to atoi_paranoid(), atoi_positive,
> > atoi_non_negative() in other tests, sorted command line options alphabetically
> > in dirty_log_perf_test, and added break between -e and -g which was missed in
> > original commit when -e was introduced.
>
> Just curious why not re-using the existing tools (e.g. taskset) to do the pinning?
IIUC, you're suggesting the test give tasks meaningful names so that the user can
do taskset on the appropriate tasks? The goal is to ensure vCPUs are pinned before
they do any meaningful work. I don't see how that can be accomplished with taskset
without some form of hook in the test to effectively pause the test until the user
(or some run script) is ready to continue.
Pinning aside, naming the threads is a great idea! That would definitely help
debug, e.g. if one vCPU gets stuck or is lagging behind.
>
> For example, with below changes:
> diff --git a/tools/testing/selftests/kvm/lib/perf_test_util.c b/tools/testing/se lftests/kvm/lib/perf_test_util.c
> index 9618b37c66f7..aac58d1acb3c 100644
> --- a/tools/testing/selftests/kvm/lib/perf_test_util.c
> +++ b/tools/testing/selftests/kvm/lib/perf_test_util.c
> @@ -264,6 +264,7 @@ void perf_test_start_vcpu_threads(int nr_vcpus,
> void (*vcpu_fn)(struct perf_test_vcpu_args *))
> {
> int i;
> + char vcpu_name[5];
>
> vcpu_thread_fn = vcpu_fn;
> WRITE_ONCE(all_vcpu_threads_running, false);
> @@ -275,6 +276,8 @@ void perf_test_start_vcpu_threads(int nr_vcpus,
> WRITE_ONCE(vcpu->running, false);
>
> pthread_create(&vcpu->thread, NULL, vcpu_thread_main, vcpu);
> + sprintf(vcpu_name, "%s%d", "vcpu", i);
> + pthread_setname_np(vcpu->thread, vcpu_name);
> }
>
> and with top we can get
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> 4464 root 20 0 4248684 4.0g 1628 R 99.9 26.2 0:50.97 dirty_log_perf_
> 4467 root 20 0 4248684 4.0g 1628 R 99.9 26.2 0:50.93 vcpu0
> 4469 root 20 0 4248684 4.0g 1628 R 99.9 26.2 0:50.93 vcpu2
> 4470 root 20 0 4248684 4.0g 1628 R 99.9 26.2 0:50.94 vcpu3
> 4468 root 20 0 4248684 4.0g 1628 R 99.7 26.2 0:50.93 vcpu1
next prev parent reply other threads:[~2022-10-14 16:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 22:05 [PATCH v5 0/5] dirty_log_perf_test vCPU pinning Vipin Sharma
2022-10-10 22:05 ` [PATCH v5 1/5] KVM: selftests: Add missing break between -e and -g option in dirty_log_perf_test Vipin Sharma
2022-10-10 22:05 ` [PATCH v5 2/5] KVM: selftests: Put command line options in alphabetical order " Vipin Sharma
2022-10-10 22:05 ` [PATCH v5 3/5] KVM: selftests: Add atoi_paranoid() to catch errors missed by atoi() Vipin Sharma
2022-10-10 22:05 ` [PATCH v5 4/5] KVM: selftests: Add atoi_positive() and atoi_non_negative() for input validation Vipin Sharma
2022-10-10 22:05 ` [PATCH v5 5/5] KVM: selftests: Run dirty_log_perf_test on specific CPUs Vipin Sharma
2022-10-20 21:42 ` Sean Christopherson
2022-10-20 21:44 ` Sean Christopherson
2022-10-14 15:12 ` [PATCH v5 0/5] dirty_log_perf_test vCPU pinning Wang, Wei W
2022-10-14 15:16 ` Wang, Wei W
2022-10-14 16:34 ` Sean Christopherson [this message]
2022-10-14 16:55 ` David Matlack
2022-10-14 18:26 ` Vipin Sharma
2022-10-14 19:02 ` Sean Christopherson
2022-10-14 21:21 ` Vipin Sharma
2022-10-17 0:47 ` Wang, Wei W
2022-10-20 21:46 ` Sean Christopherson
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=Y0mPqNRSgpArgyS8@google.com \
--to=seanjc@google.com \
--cc=andrew.jones@linux.dev \
--cc=dmatlack@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox