All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
Cc: "Jin, Yao" <yao.jin@linux.intel.com>,
	jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com,
	alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org,
	kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH] perf/x86/pmu-events: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric
Date: Tue, 31 Mar 2020 13:04:11 -0700	[thread overview]
Message-ID: <20200331200411.GA397189@tassilo.jf.intel.com> (raw)
In-Reply-To: <20200331190804.GK9917@kernel.org>

On Tue, Mar 31, 2020 at 04:08:04PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Mar 30, 2020 at 08:38:29AM +0800, Jin, Yao escreveu:
> > Hi,
> > 
> > Any comments for this patch?
> 
> Can someone help Jin reviewing this x86 specific metric?

Looks good to me.

Reviewed-by: Andi Kleen <ak@linux.intel.com>
> 
> - Arnaldo
>  
> > Thanks
> > Jin Yao
> > 
> > On 3/9/2020 9:31 AM, Jin Yao wrote:
> > > The kernel utilization metric does multiplexing currently and is somewhat
> > > unreliable. The problem is that it uses two instances of the fixed counter,
> > > and the kernel has to multipleplex which causes errors. So should use
> > > CPU_CLK_UNHALTED.THREAD instead.
> > > 
> > > Before:
> > > 
> > >    # perf stat -M Kernel_Utilization -- sleep 1
> > > 
> > >    Performance counter stats for 'sleep 1':
> > > 
> > >            1,419,425      cpu_clk_unhalted.ref_tsc:k
> > >        <not counted>      cpu_clk_unhalted.ref_tsc	(0.00%)
> > > 
> > > After:
> > > 
> > >    # perf stat -M Kernel_Utilization -- sleep 1
> > > 
> > >    Performance counter stats for 'sleep 1':
> > > 
> > >              746,688      cpu_clk_unhalted.thread:k #      0.7 Kernel_Utilization
> > >            1,088,348      cpu_clk_unhalted.thread
> > > 
> > > Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
> > > ---
> > >   tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json     | 2 +-
> > >   tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json | 2 +-
> > >   tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json    | 2 +-
> > >   tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json  | 2 +-
> > >   tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json       | 2 +-
> > >   tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json      | 2 +-
> > >   tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json     | 2 +-
> > >   tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json       | 2 +-
> > >   tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json      | 2 +-
> > >   tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json   | 2 +-
> > >   tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json       | 2 +-
> > >   tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json      | 2 +-
> > >   12 files changed, 12 insertions(+), 12 deletions(-)
> > > 
> > > diff --git a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> > > index 45a34ce4fe89..8cdc7c13dc2a 100644
> > > --- a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> > > @@ -297,7 +297,7 @@
> > >       },
> > >       {
> > >           "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > -        "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > +        "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > >           "MetricGroup": "Summary",
> > >           "MetricName": "Kernel_Utilization"
> > >       },
> > > diff --git a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> > > index 961fe4395758..16fd8a7490fc 100644
> > > --- a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> > > @@ -115,7 +115,7 @@
> > >       },
> > >       {
> > >           "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > -        "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > +        "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > >           "MetricGroup": "Summary",
> > >           "MetricName": "Kernel_Utilization"
> > >       },
> > > diff --git a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> > > index 746734ce09be..1eb0415fa11a 100644
> > > --- a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> > > @@ -297,7 +297,7 @@
> > >       },
> > >       {
> > >           "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > -        "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > +        "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > >           "MetricGroup": "Summary",
> > >           "MetricName": "Kernel_Utilization"
> > >       },
> > > diff --git a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> > > index f94653229dd4..a2c32db8f14e 100644
> > > --- a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> > > @@ -315,7 +315,7 @@
> > >       },
> > >       {
> > >           "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > -        "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > +        "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > >           "MetricGroup": "Summary",
> > >           "MetricName": "Kernel_Utilization"
> > >       },
> > > diff --git a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> > > index 5402cd3120f9..f57c5f3506c2 100644
> > > --- a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> > > @@ -267,7 +267,7 @@
> > >       },
> > >       {
> > >           "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > -        "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > +        "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > >           "MetricGroup": "Summary",
> > >           "MetricName": "Kernel_Utilization"
> > >       },
> > > diff --git a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> > > index 832f3cb40b34..311a005dc35b 100644
> > > --- a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> > > @@ -267,7 +267,7 @@
> > >       },
> > >       {
> > >           "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > -        "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > +        "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > >           "MetricGroup": "Summary",
> > >           "MetricName": "Kernel_Utilization"
> > >       },
> > > diff --git a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> > > index d69b2a8fc0bc..28e25447d3ef 100644
> > > --- a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> > > @@ -285,7 +285,7 @@
> > >       },
> > >       {
> > >           "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > -        "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > +        "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > >           "MetricGroup": "Summary",
> > >           "MetricName": "Kernel_Utilization"
> > >       },
> > > diff --git a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> > > index 5f465fd81315..db23db2e98be 100644
> > > --- a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> > > @@ -285,7 +285,7 @@
> > >       },
> > >       {
> > >           "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > -        "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > +        "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > >           "MetricGroup": "Summary",
> > >           "MetricName": "Kernel_Utilization"
> > >       },
> > > diff --git a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> > > index 3e909b306003..dbb33e00b72a 100644
> > > --- a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> > > @@ -171,7 +171,7 @@
> > >       },
> > >       {
> > >           "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > -        "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > +        "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > >           "MetricGroup": "Summary",
> > >           "MetricName": "Kernel_Utilization"
> > >       },
> > > diff --git a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> > > index 50c053235752..fb2d7b8875f8 100644
> > > --- a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> > > @@ -171,7 +171,7 @@
> > >       },
> > >       {
> > >           "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > -        "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > +        "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > >           "MetricGroup": "Summary",
> > >           "MetricName": "Kernel_Utilization"
> > >       },
> > > diff --git a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> > > index e7feb60f9fa9..e3afc3178958 100644
> > > --- a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> > > @@ -303,7 +303,7 @@
> > >       },
> > >       {
> > >           "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > -        "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > +        "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > >           "MetricGroup": "Summary",
> > >           "MetricName": "Kernel_Utilization"
> > >       },
> > > diff --git a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> > > index 21d7a0c2c2e8..12d1efba79bb 100644
> > > --- a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> > > @@ -315,7 +315,7 @@
> > >       },
> > >       {
> > >           "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > -        "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > +        "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > >           "MetricGroup": "Summary",
> > >           "MetricName": "Kernel_Utilization"
> > >       },
> > > 
> 
> -- 
> 
> - Arnaldo

  reply	other threads:[~2020-03-31 20:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09  1:31 [PATCH] perf/x86/pmu-events: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric Jin Yao
2020-03-30  0:38 ` Jin, Yao
2020-03-31 19:08   ` Arnaldo Carvalho de Melo
2020-03-31 20:04     ` Andi Kleen [this message]
2020-03-31 19:30 ` Liang, Kan
2020-03-31 19:33   ` Arnaldo Carvalho de Melo
2020-04-04  8:41 ` [tip: perf/urgent] perf pmu-events x86: " tip-bot2 for Jin Yao

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=20200331200411.GA397189@tassilo.jf.intel.com \
    --to=ak@linux.intel.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=arnaldo.melo@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    --cc=yao.jin@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.