linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: "Liang, Kan" <kan.liang@linux.intel.com>
Cc: James Clark <james.clark@linaro.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org,
	Ravi Bangoria <ravi.bangoria@amd.com>,
	Mark Rutland <mark.rutland@arm.com>,
	James Clark <james.clark@arm.com>,
	Kajol Jain <kjain@linux.ibm.com>,
	Thomas Richter <tmricht@linux.ibm.com>,
	Atish Patra <atishp@atishpatra.org>,
	Palmer Dabbelt <palmer@rivosinc.com>,
	Mingwei Zhang <mizhang@google.com>
Subject: Re: [PATCH 04/10] perf stat: Add --exclude-guest option
Date: Mon, 30 Sep 2024 13:07:00 -0700	[thread overview]
Message-ID: <ZvsE5IQtEkYooDA8@google.com> (raw)
In-Reply-To: <01c8dcaa-d557-407e-9ef3-babf90eb37d3@linux.intel.com>

On Wed, Sep 25, 2024 at 09:49:14AM -0400, Liang, Kan wrote:
> 
> 
> On 2024-09-24 4:21 p.m., Namhyung Kim wrote:
> > On Mon, Sep 23, 2024 at 09:47:17AM +0100, James Clark wrote:
> >>
> >> On 06/09/2024 3:33 pm, Liang, Kan wrote:
> >>>
> >>> On 2024-09-05 4:24 p.m., Namhyung Kim wrote:
> >>>> This option is to support the old behavior of setting exclude_guest by
> >>>> default.  Now it doesn't set the bit so users want the old behavior can
> >>>> use this option.
> >>>>
> >>>>    $ perf stat true
> >>>>
> >>>>     Performance counter stats for 'true':
> >>>>
> >>>>                  0.86 msec task-clock:u                     #    0.443 CPUs utilized
> >>>>                     0      context-switches:u               #    0.000 /sec
> >>>>                     0      cpu-migrations:u                 #    0.000 /sec
> >>>>                    49      page-faults:u                    #   56.889 K/sec
> >>>>                   ...
> >>>>
> >>>>    $ perf stat --exclude-guest true
> >>>>
> >>>>     Performance counter stats for 'true':
> >>>>
> >>>>                  0.79 msec task-clock:Hu                    #    0.490 CPUs utilized
> >>>>                     0      context-switches:Hu              #    0.000 /sec
> >>>>                     0      cpu-migrations:Hu                #    0.000 /sec
> >>>>                    49      page-faults:Hu                   #   62.078 K/sec
> >>>>                   ...
> >>>>
> >>>> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> >>>> ---
> >>>>   tools/perf/Documentation/perf-stat.txt | 7 +++++++
> >>>>   tools/perf/builtin-stat.c              | 2 ++
> >>>>   2 files changed, 9 insertions(+)
> >>>>
> >>>> diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt
> >>>> index 2bc06367248691dd..d28d8370a856598f 100644
> >>>> --- a/tools/perf/Documentation/perf-stat.txt
> >>>> +++ b/tools/perf/Documentation/perf-stat.txt
> >>>> @@ -382,6 +382,13 @@ color the metric's computed value.
> >>>>   Don't print output, warnings or messages. This is useful with perf stat
> >>>>   record below to only write data to the perf.data file.
> >>>> +--exclude-guest::
> >>>> +Don't count event in the guest mode.  It was the old behavior but the
> >>>> +default is changed to count guest events also.  Use this option if you
> >>>> +want the old behavior (host only).  Note that this option needs to be
> >>>> +before other events in case you added -e/--event option in the command
> >>>> +line.
> >>> I'm not sure if we really need this option. I think it may bring more
> >>> trouble than what we get.
> >>>
> >>> The name of the "--exclude-guest" sounds like a replacement of the event
> >>> modifier "H". But in fact, it's not. It should only affect the default.
> >>> It doesn't set the "H" for any events.
> > Well I think it's tricky but it'd set "H" modifier events after the
> > option.  But I have to agree that it can bring more troubles.
> 
> I may have miss-read something before. After some simple tests, yes, the
> "H" is applied with the option.

Ok.

> 
> Since there is a limit for the "--exclude-guest" option, can we print a
> warning if the option becomes invalid because of the order?

Well.. I'm thinking of removing this option for now.

> 
> > 
> >>> Except for the perf kvm user, I don't think there are many users which
> >>> care the exclude_guest. The behavior of the perf kvm is not changed. So
> >>> the option seems not that important. If we really want an option to
> >>> restore the old behavior, it's better to choose a better name and update
> >>> the description.
> > Personally I don't want to this option but just worried if there's a
> > case where exclude_guest is preferred.
> 
> The only case I can imagine is that, with the new vPMU passthrough
> introduced, some users may want to explicitly set the exclude_guest to
> avoid the fallback. But I'm not sure how useful it is for them.

Because of overhead?  They'll get exclude_guest eventually, right?

So I think I can drop this patch for now.  And consider this later when
we can find a real usecase.

Thanks,
Namhyung


  reply	other threads:[~2024-09-30 20:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05 20:24 [RFC/PATCHSET 00/10] perf tools: Do not set attr.exclude_guest by default (v3) Namhyung Kim
2024-09-05 20:24 ` [PATCH 01/10] perf tools: Add fallback for exclude_guest Namhyung Kim
2024-09-06 13:47   ` Liang, Kan
2024-09-30 20:36     ` Namhyung Kim
2024-09-05 20:24 ` [PATCH 02/10] perf tools: Don't set attr.exclude_guest by default Namhyung Kim
2024-09-06 14:10   ` Liang, Kan
2024-09-05 20:24 ` [PATCH 03/10] perf tools: Simplify evsel__add_modifier() Namhyung Kim
2024-09-05 20:24 ` [PATCH 04/10] perf stat: Add --exclude-guest option Namhyung Kim
2024-09-06 14:33   ` Liang, Kan
2024-09-23  8:47     ` James Clark
2024-09-24 20:21       ` Namhyung Kim
2024-09-25  8:36         ` James Clark
2024-09-30 20:13           ` Namhyung Kim
2024-09-25 13:49         ` Liang, Kan
2024-09-30 20:07           ` Namhyung Kim [this message]
2024-09-05 20:24 ` [PATCH 05/10] perf tools: Do not set exclude_guest for precise_ip Namhyung Kim
2024-09-05 20:24 ` [PATCH 06/10] perf tools: Detect missing kernel features properly Namhyung Kim
2024-09-05 20:24 ` [PATCH 07/10] perf tools: Separate exclude_hv fallback Namhyung Kim
2024-09-06 15:21   ` Liang, Kan
2024-09-30 20:37     ` Namhyung Kim
2024-09-05 20:24 ` [PATCH 08/10] perf tools: Move x86__is_amd_cpu() to util/env.c Namhyung Kim
2024-09-05 20:24 ` [PATCH 09/10] perf tools: Check fallback error and order Namhyung Kim
2024-09-05 20:24 ` [PATCH 10/10] perf record: Just use "cycles:P" as the default event Namhyung Kim

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=ZvsE5IQtEkYooDA8@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=atishp@atishpatra.org \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=kjain@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=mizhang@google.com \
    --cc=palmer@rivosinc.com \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@amd.com \
    --cc=tmricht@linux.ibm.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;
as well as URLs for NNTP newsgroup(s).