mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Kilroy <andrew.kilroy@arm.com>
To: Andi Kleen <ak@linux.intel.com>,
	John Garry <john.garry@huawei.com>,
	Ian Rogers <irogers@google.com>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	acme@kernel.org, Will Deacon <will@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Leo Yan <leo.yan@linaro.org>, Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 1/1] perf arm64: Implement --topdown with metrics
Date: Thu, 27 Jan 2022 11:11:13 +0000	[thread overview]
Message-ID: <1ec258b8-c6dd-aa0f-8583-2d7667314be9@arm.com> (raw)
In-Reply-To: <12e0deef-08db-445f-4958-bcd5c3e10367@linux.intel.com>

Hi Andi,


On 21/12/2021 14:03, Andi Kleen wrote:
> 
> On 12/20/2021 9:21 AM, Andrew Kilroy wrote:
>>
>> On 15/12/2021 10:52, John Garry wrote:
>>> Hi Andrew,
>>>
>>>>>   const struct pmu_event *metricgroup__find_metric(const char *metric,
>>>>>                                                   const struct 
>>>>> pmu_events_map *map);
>>>>>   int metricgroup__parse_groups_test(struct evlist *evlist,
>>>>> diff --git a/tools/perf/util/topdown.c b/tools/perf/util/topdown.c
>>>>> index 1081b20f9891..57c0c5f2c6bd 100644
>>>>> --- a/tools/perf/util/topdown.c
>>>>> +++ b/tools/perf/util/topdown.c
>>>>> @@ -56,3 +56,9 @@ __weak bool arch_topdown_sample_read(struct evsel 
>>>>> *leader __maybe_unused)
>>>>>   {
>>>>>          return false;
>>>>>   }
>>>>> +
>>>>> +__weak bool arch_topdown_use_json_metrics(void)
>>>>> +{
>>>
>>> AFAICS, only x86 supports topdown today and that is because they have 
>>> special kernel topdown events exposed for the kernel CPU PMU driver. 
>>> So other architectures - not only arm - would need rely on 
>>> metricgroups for topdown support. So let's make this generic for all 
>>> archs.
>>>
>>>> I like this extension! I've ranted in the past about weak symbols
>>>> breaking with archives due to lazy loading [1]. In this case
>>>> tools/perf/arch/arm64/util/topdown.c has no other symbols within it
>>>> and so the weak symbol has an extra chance of being linked
>>>> incorrectly. We could add a new command line of --topdown-json to
>>>> avoid this, but there seems little difference in doing this over just
>>>> doing '-M TopDownL1'.
>>>
>>>
>>>> Is it possible to use the json metric approach
>>>> for when the CPU version fails?
>>>
>>> I think that's a good idea.
>>>
>>
>>
>> While looking into using the json metrics approach as a fallback to 
>> the original, I noticed  there are two json metricgroups 'TopdownL1' 
>> and 'TopDownL1' (note the case difference) on x86. Not sure if the 
>> case difference is intentional.
>>
>> On skylake, 'TopdownL1' contains the four json metrics Retiring, 
>> Bad_Speculation, Frontend_Bound, and Backend_Bound.  'TopDownL1' has 
>> 'SLOTS', 'CoreIPC', 'CoreIPC_SMT', 'Instructions'.  I think its a 
>> similar situation on other x86 chips.
> 
> 
> There's also SMT metrics.
> 
> 
> We don't want to include CoreIPC etc. by default because it would cause 
> multiplexing in common situations.
> 
>>
>> The search for those metrics by metricgroup name is case insensitive, 
>> so it's picking up all 8 metrics when using the lookup string 
>> 'TopDownL1'.  So the extra 'SLOTS', 'CoreIPC', 'CoreIPC_SMT', 
>> 'Instructions' metrics would be printed as well.
>>
>> Not sure what the significance of the case difference might be.
>>
>> Should we use a different string than 'TopDownL1' as the metric group 
>> name to search for?
> 
> 
> We should probably fix the case (or just make the match case insensitive)
> 
> Can we just keep x86 at using the kernel metrics? On Skylake and earlier 
> it needs different formulas and other options depending whether SMT is 
> on or off, so it's not straight forward to express it as json directly.
> 

I posted a v2 of these patches which keeps x86 only using the kernel 
metrics.

 
https://lore.kernel.org/linux-perf-users/20220111150749.13365-1-andrew.kilroy@arm.com/

Would be good to get your feedback,

Thanks
Andrew


  reply	other threads:[~2022-01-27 11:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-10 12:37 [PATCH v2 0/2] perf vendor events: Arm Neoverse N2 Andrew Kilroy
2021-12-10 12:37 ` [PATCH v2 1/2] perf vendor events: For the " Andrew Kilroy
2021-12-10 13:21   ` John Garry
2021-12-14 18:42     ` [RFC PATCH 0/1] topdown with metrics Andrew Kilroy
2021-12-14 18:42       ` [RFC PATCH 1/1] perf arm64: Implement --topdown " Andrew Kilroy
2021-12-14 20:32         ` Ian Rogers
2021-12-15 10:38           ` James Clark
2021-12-15 10:52           ` John Garry
2021-12-15 12:38             ` Andrew Kilroy
2021-12-15 12:53               ` John Garry
2022-01-06 16:33                 ` Andrew Kilroy
2022-01-06 18:24                   ` John Garry
2022-01-11 15:07                     ` [RFC PATCH v2 0/5] topdown " Andrew Kilroy
2022-01-11 15:07                       ` [RFC PATCH v2 1/5] perf stat: Implement --topdown " Andrew Kilroy
2022-01-28 13:44                         ` John Garry
2022-01-11 15:07                       ` [RFC PATCH v2 2/5] perf stat: Topdown kernel events setup function Andrew Kilroy
2022-01-11 15:07                       ` [RFC PATCH v2 3/5] perf stat: Topdown json metrics " Andrew Kilroy
2022-01-11 15:07                       ` [RFC PATCH v2 4/5] perf stat: Detect if topdown kernel events supported Andrew Kilroy
2022-01-11 15:07                       ` [RFC PATCH v2 5/5] perf stat: Ensure only topdown kernel events used on x86 Andrew Kilroy
2022-01-20  9:26                       ` [RFC PATCH v2 0/5] topdown with metrics John Garry
2022-01-20 16:22                         ` Al Grant
2022-01-27 11:42                         ` Andrew Kilroy
2022-02-08 15:58                           ` Andrew Kilroy
2021-12-20 17:21             ` [RFC PATCH 1/1] perf arm64: Implement --topdown " Andrew Kilroy
2021-12-21 14:03               ` Andi Kleen
2022-01-27 11:11                 ` Andrew Kilroy [this message]
2021-12-17 10:19         ` John Garry
2021-12-21 14:31           ` Andrew Kilroy
2022-01-05 16:58           ` Andrew Kilroy
2022-01-28 18:00             ` John Garry
2021-12-10 12:37 ` [PATCH v2 2/2] perf vendor events: Rename arm64 arch std event files Andrew Kilroy
2021-12-10 13:46   ` John Garry
2021-12-10 19:01     ` Arnaldo Carvalho de Melo

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=1ec258b8-c6dd-aa0f-8583-2d7667314be9@arm.com \
    --to=andrew.kilroy@arm.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=namhyung@kernel.org \
    --cc=will@kernel.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

all inboxes | Powered by JetHome®