linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yunseong Kim <yskelg@gmail.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	skhan@linuxfoundation.org, Austin Kim <austindh.kim@gmail.com>,
	shjy180909@gmail.com, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH] buitin-kvm: Update cmd_kvm() to check perf_host value
Date: Mon, 27 May 2024 15:12:18 +0900	[thread overview]
Message-ID: <bb87c165-679b-413c-a62c-93b4772e3107@gmail.com> (raw)
In-Reply-To: <CAM9d7ciFpGhQat3esWLBUDNc1pzAqVw+8d+oX-WJeN+KJfW8Ew@mail.gmail.com>



On 5/23/24 1:23 오후, Namhyung Kim wrote:
> Hello,
> 
> On Wed, May 15, 2024 at 12:54 PM <yskelg@gmail.com> wrote:
>>
>> From: Yunseong Kim <yskelg@gmail.com>
>>
>> According to perf-kvm.txt, the default operation is --guest, meaning
>> perf_host should be set to false and perf_guest to true. Currently,
>> the incorrect usage of --no-host and --no-guest still results in
>> the default --guest operation.
> 
> Hmm, right.. This is not good.
> 
>>
>> This patch updates the usage messages to include the --no-guest option
>> for those who only want host data, as well as the --no-host and
>> --no-guest case.
> 
> I'm not sure if it's worth mentioning the host-only use case which is
> not expected for this command.  I think it's enough to warn the
> no-host and no-guest use cases.

Thank you Namhyung for the code review!

I wasn't sure if it was necessary to mention that either.

I should have asked in the patch mail first.

>> Signed-off-by: Yunseong Kim <yskelg@gmail.com>
>> ---
>>  tools/perf/builtin-kvm.c | 19 +++++++++++++------
>>  1 file changed, 13 insertions(+), 6 deletions(-)
>>
>> diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
>> index 71165036e4ca..654a07658cdd 100644
>> --- a/tools/perf/builtin-kvm.c
>> +++ b/tools/perf/builtin-kvm.c
>> @@ -2129,7 +2129,7 @@ int cmd_kvm(int argc, const char **argv)
>>                 OPT_BOOLEAN(0, "guest", &perf_guest,
>>                             "Collect guest os data"),
>>                 OPT_BOOLEAN(0, "host", &perf_host,
>> -                           "Collect host os data"),
>> +                          "Collect host os data. Host only with --host --no-guest"),
>>                 OPT_STRING(0, "guestmount", &symbol_conf.guestmount, "directory",
>>                            "guest mount directory under which every guest os"
>>                            " instance has a subdir"),
>> @@ -2150,16 +2150,23 @@ int cmd_kvm(int argc, const char **argv)
>>                                                 "buildid-list", "stat", NULL };
>>         const char *kvm_usage[] = { NULL, NULL };
>>
>> -       perf_host  = 0;
>> -       perf_guest = 1;
>> +       /*
>> +        * tools/perf/Documentation/perf-kvm.txt
>> +        *
>> +        *    Default('')         ->  perf.data.guest
>> +        *    --host              ->  perf.data.kvm
>> +        *    --guest             ->  perf.data.guest
>> +        *    --host --guest      ->  perf.data.kvm
>> +        *    --host --no-guest   ->  perf.data.host
>> +        */
>> +       perf_host = false;
>> +       perf_guest = true;
> 
> Probably not needed.

I agree.

>>
>>         argc = parse_options_subcommand(argc, argv, kvm_options, kvm_subcommands, kvm_usage,
>>                                         PARSE_OPT_STOP_AT_NON_OPTION);
>> -       if (!argc)
>> +       if (!argc || (!perf_host && !perf_guest))
>>                 usage_with_options(kvm_usage, kvm_options);
>>
>> -       if (!perf_host)
>> -               perf_guest = 1;
> 
> Instead of showing the whole usage, I think it's better to
> print a specific message for this case.
> 
> Oh, I've realized that we have 'h' modifier for hypervisors
> (on ARM64?)  Then maybe no-host + no-guest is a valid
> combination.  Probably we need to add --hypervisor option
> then.
> 
> Thanks,
> Namhyung

Yes, I have a native Arm64 devlopment environment.

So I'll implement and test it and send the patch.


Thank you so much for the detailed review!


Warm Regards,

Yunseong Kim

>>
>>         if (!file_name) {
>>                 file_name = get_filename_for_perf_kvm();
>> --
>> 2.34.1
>>

      reply	other threads:[~2024-05-27  6:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-15 19:52 [PATCH] buitin-kvm: Update cmd_kvm() to check perf_host value yskelg
2024-05-23  4:23 ` Namhyung Kim
2024-05-27  6:12   ` Yunseong Kim [this message]

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=bb87c165-679b-413c-a62c-93b4772e3107@gmail.com \
    --to=yskelg@gmail.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=austindh.kim@gmail.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=shjy180909@gmail.com \
    --cc=skhan@linuxfoundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).