public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Peter Xu <peterx@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>,
	James Houghton <jthoughton@google.com>,
	Anish Moorthy <amoorthy@google.com>
Subject: Re: [PATCH] selftests/kvm: Allow specify physical cpu list in demand paging test
Date: Wed, 31 May 2023 15:15:52 -0700	[thread overview]
Message-ID: <ZHfHGCfsz4dSQ62b@google.com> (raw)
In-Reply-To: <20230503233812.2743269-1-peterx@redhat.com>

On Wed, May 03, 2023, Peter Xu wrote:
> Mimic dirty log test to allow specify physical cpu pinning for vcpu threads.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  tools/testing/selftests/kvm/demand_paging_test.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c
> index bdb8e0748154..d709b65fda2f 100644
> --- a/tools/testing/selftests/kvm/demand_paging_test.c
> +++ b/tools/testing/selftests/kvm/demand_paging_test.c
> @@ -220,12 +220,13 @@ static void run_test(enum vm_guest_mode mode, void *arg)
>  static void help(char *name)
>  {
>  	puts("");
> -	printf("usage: %s [-h] [-m vm_mode] [-u uffd_mode] [-a]\n"
> +	printf("usage: %s [-h] [-m vm_mode] [-u uffd_mode] [-a] [-c cpu_list]\n"
>  		   "          [-d uffd_delay_usec] [-r readers_per_uffd] [-b memory]\n"
>  		   "          [-s type] [-v vcpus] [-o]\n", name);
>  	guest_modes_help();
>  	printf(" -u: use userfaultfd to handle vCPU page faults. Mode is a\n"
>  	       "     UFFD registration mode: 'MISSING' or 'MINOR'.\n");
> +	printf(" -c: physical cores to pin vcpu threads (e.g. 1,2,3,...)\n");

This help really should be provided by kvm_util.c, e.g. this doesn't capture the
"must pin all vCPUs" behavior, nor does it capture the "pin the main thread"
behavior.

Something like this?

void kvm_get_vcpu_pinning_help(char *buffer, size_t size,
			       const char *optchar, const char *testname)
{
	snprintf(buffer, size,
		 " -%c: Pin tasks to physical CPUs.  Takes a list of comma separated\n"
		 "     values (target pCPU), one for each vCPU, plus an optional\n"
		 "     entry for the main application task (specified via entry\n"
		 "     <nr_vcpus + 1>).  If used, entries must be provided for all\n"
		 "     vCPUs, i.e. pinning vCPUs is all or nothing.\n\n"
		 "     E.g. to create 3 vCPUs, pin vCPU0=>pCPU22, vCPU1=>pCPU23,\n"
		 "     vCPU2=>pCPU24, and pin the application task to pCPU50:\n\n"
		 "         ./%s -v 3 -c 22,23,24,50\n\n"
		 "     To leave the application task unpinned, drop the final entry:\n\n"
		 "         ./%s -v 3 -c 22,23,24\n\n"
		 "     (default: no pinning)\n", optchar, testname);
}

  reply	other threads:[~2023-05-31 22:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03 23:38 [PATCH] selftests/kvm: Allow specify physical cpu list in demand paging test Peter Xu
2023-05-31 22:15 ` Sean Christopherson [this message]
2023-06-01 18:37   ` Peter Xu

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=ZHfHGCfsz4dSQ62b@google.com \
    --to=seanjc@google.com \
    --cc=amoorthy@google.com \
    --cc=jthoughton@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.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