lkml.org 
[lkml]   [2023]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v5 1/6] perf vendor events arm64: Add topdown L1 metrics for neoverse-n2
From


On 06/01/2023 10:14, John Garry wrote:
> On 05/01/2023 21:13, Ian Rogers wrote:
>>>> This may be a feasible idea. The value of slots comes from the
>>>> register PMMIR_EL1, which I can read in
>>>> /sys/bus/event_source/device/armv8_pmuv3_*/caps/slots. But how do I
>>>> replace the slots in MetricExpr with the
>>>> read slots values? Currently I understand that parameters in
>>>> metricExpr only support events and constants.
>>>>
>>> Maybe during runtime we could create a pseudo metric/event for SLOT.
>> For Intel we do this by just having a different constant for each
>> architecture. It is fairly easy to add a new "literal", so you could
>> add a #slots in expr__get_literal:
>> https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/util/expr.c?h=perf*core*n407__;LyM!!ACWV5N9M2RV99hQ!IHcZFuFaLdQDQvVOnHVlbbME2S4aW8GohWUkydlejpi7ifFz61r7RutGXReRt0d88X_vDfkTySCiuD2PqOA$  Populating it would be the challenge 😄
>
> Thanks for the pointer. I think that the challenge in populating it
> really comes down to whether we would really want to make this generic.
>
> I suppose that for arm64 we could have a method which accesses this
> PMMIR_EL1 register, while for other archs we could have a weak function
> which just returns NAN. If other archs want to use this key expr, they
> can add their own method.
>

I wonder if it would be worthwhile and even more generic to add some
sort of int containing file accessor construct. It could also have
support for a default value when the file doesn't exist. For example:

"MetricExpr": "ITLB / {file://<pmu>/caps/slots(5)}"

It gets a bit fiddly because you might want to support absolute paths
and paths relative to whatever PMU is being used. But it could prevent
having to add some custom identifier and glue code for every possible
file that just has an integer in it.

It also wouldn't be possible to support the case where the file has
bitfields in it that need to be extracted, so maybe we shouldn't do it.

James

\
 
 \ /
  Last update: 2023-03-26 23:33    [W:0.060 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site