linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Ian Rogers <irogers@google.com>, "Paul A. Clarke" <pc@us.ibm.com>,
	Jiri Olsa <jolsa@kernel.org>, lkml <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Michael Petlan <mpetlan@redhat.com>,
	Andi Kleen <ak@linux.intel.com>, Kajol Jain <kjain@linux.ibm.com>,
	John Garry <john.garry@huawei.com>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCHv4 00/19] perf metric: Add support to reuse metric
Date: Mon, 3 Aug 2020 13:49:59 -0300	[thread overview]
Message-ID: <20200803164959.GC3440834@kernel.org> (raw)
In-Reply-To: <20200803162636.GF139381@krava>

Em Mon, Aug 03, 2020 at 06:26:36PM +0200, Jiri Olsa escreveu:
> On Mon, Aug 03, 2020 at 08:54:16AM -0700, Ian Rogers wrote:
> > On Sat, Aug 1, 2020 at 4:41 AM Paul A. Clarke <pc@us.ibm.com> wrote:
> > >
> > > On Wed, Jul 29, 2020 at 11:18:49AM +0200, Jiri Olsa wrote:
> > > > this patchset is adding the support to reused metric in
> > > > another metric.
> > > >
> > > > For example, to define IPC by using CPI with change like:
> > > >
> > > >      {
> > > >          "BriefDescription": "Instructions Per Cycle (per Logical Processor)",
> > > > -        "MetricExpr": "INST_RETIRED.ANY / CPU_CLK_UNHALTED.THREAD",
> > > > +        "MetricExpr": "1/CPI",
> > > >          "MetricGroup": "TopDownL1",
> > > >          "MetricName": "IPC"
> > > >      },
> > > >
> > > > I won't be able to find all the possible places we could
> > > > use this at, so I wonder you guys (who was asking for this)
> > > > would try it and come up with comments if there's something
> > > > missing or we could already use it at some places.
> > > >
> > > > It's based on Arnaldo's tmp.perf/core.
> > > >
> > > > v4 changes:
> > > >   - removed acks from patch because it changed a bit
> > > >     with the last fixes:
> > > >       perf metric: Collect referenced metrics in struct metric_ref_node
> > > >   - fixed runtime metrics [Kajol Jain]
> > > >   - increased recursion depth [Paul A. Clarke]
> > > >   - changed patches due to dependencies:
> > > >       perf metric: Collect referenced metrics in struct metric_ref_node
> > > >       perf metric: Add recursion check when processing nested metrics
> > > >       perf metric: Rename struct egroup to metric
> > > >       perf metric: Rename group_list to metric_list
> > > >
> > > > Also available in here:
> > > >   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
> > > >   perf/metric
> > >
> > > I built and ran from the above git branch, and things seem to work.
> > > Indeed, I was able to apply my changes to exploit the new capabilities
> > > via modifications to tools/perf/pmu-events/arch/powerpc/power9/metrics.json,
> > > as I posted earlier (and will submit once this set gets merged).
> > >
> > > Tested-by: Paul A. Clarke <pc@us.ibm.com>
> > >
> > > One thing I noted, but which also occurs without these patches, is that
> > > the perf metrics are not computed unless run as root:
> > > --
> > > $ perf stat --metrics br_misprediction_percent command
> > >
> > >  Performance counter stats for 'command':
> > >
> > >      1,823,530,051      pm_br_pred:u
> > >          2,662,705      pm_br_mpred_cmpl:u
> 
> it's because when you don't run as root, events will get the :u suffix,

s/as root/with the required permissions/

I.e. using CAP_PERFMON, etc as per the explanation at
Documentation/admin-guide/perf-security.rst.

Just to help more people be aware of a more secure way of using perf.

> so they will not match the events in metric.. we need to decide if we
> want the metric to match events without modifiers or be strict about it
> 
> > >
> > > $ /usr/bin/sudo perf stat --metrics br_misprediction_percent command
> > >
> > >  Performance counter stats for 'command':
> > >
> > >      1,824,655,269      pm_br_pred                #     0.09 br_misprediction_percent
> > >          1,654,466      pm_br_mpred_cmpl
> > > --
> > >
> > > Is that expected?  I don't think it's always been that way.
> > 
> > I agree Paul, this seems broken. I've noticed a bunch of issues with
> > printing CSV, per-socket output and so on. Jiri may have a better idea
> > but I plan to look at problems in this area later, and hopefully stick
> > a few tests on it :-)
> 
> ok, that'd be great, thanks

Yeah, tests are good, keep them coming :-)

- Arnaldo

  reply	other threads:[~2020-08-03 16:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29  9:18 [PATCHv4 00/19] perf metric: Add support to reuse metric Jiri Olsa
2020-07-29  9:18 ` [PATCH 01/19] perf metric: Fix memory leak in expr__add_id function Jiri Olsa
2020-07-29  9:18 ` [PATCH 02/19] perf metric: Add " Jiri Olsa
2020-07-29  9:18 ` [PATCH 03/19] perf metric: Change expr__get_id to return struct expr_id_data Jiri Olsa
2020-07-29  9:18 ` [PATCH 04/19] perf metric: Add expr__del_id function Jiri Olsa
2020-07-29  9:18 ` [PATCH 05/19] perf metric: Add macros for iterating map events Jiri Olsa
2020-07-29  9:18 ` [PATCH 06/19] perf metric: Add add_metric function Jiri Olsa
2020-07-29  9:18 ` [PATCH 07/19] perf metric: Rename __metricgroup__add_metric to __add_metric Jiri Olsa
2020-07-29  9:18 ` [PATCH 08/19] perf metric: Collect referenced metrics in struct metric_ref_node Jiri Olsa
2020-07-29  9:18 ` [PATCH 09/19] perf metric: Collect referenced metrics in struct metric_expr Jiri Olsa
2020-07-29  9:18 ` [PATCH 10/19] perf metric: Add referenced metrics to hash data Jiri Olsa
2020-07-29  9:19 ` [PATCH 11/19] perf metric: Compute referenced metrics Jiri Olsa
2020-07-29  9:19 ` [PATCH 12/19] perf metric: Add events for the current list Jiri Olsa
2020-07-29  9:19 ` [PATCH 13/19] perf metric: Add cache_miss_cycles to metric parse test Jiri Olsa
2020-07-29  9:19 ` [PATCH 14/19] perf metric: Add DCache_L2 " Jiri Olsa
2020-07-29  9:19 ` [PATCH 15/19] perf metric: Add recursion check when processing nested metrics Jiri Olsa
2020-07-29  9:19 ` [PATCH 16/19] perf metric: Make compute_single function more precise Jiri Olsa
2020-07-29  9:19 ` [PATCH 17/19] perf metric: Add metric group test Jiri Olsa
2020-07-29  9:19 ` [PATCH 18/19] perf metric: Rename struct egroup to metric Jiri Olsa
2020-07-29  9:19 ` [PATCH 19/19] perf metric: Rename group_list to metric_list Jiri Olsa
2020-08-01 11:40 ` [PATCHv4 00/19] perf metric: Add support to reuse metric Paul A. Clarke
2020-08-03 15:54   ` Ian Rogers
2020-08-03 16:26     ` Jiri Olsa
2020-08-03 16:49       ` Arnaldo Carvalho de Melo [this message]
2021-03-22 11:36   ` John Garry
2021-03-23 15:06     ` Paul A. Clarke
2021-03-23 15:15       ` John Garry
2021-03-24  1:54         ` Paul A. Clarke
2021-03-24  9:13           ` John Garry

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=20200803164959.GC3440834@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=kjain@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpetlan@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=pc@us.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).