RE: [PATCH v2 5/5] perf/arm_cspmu: nvidia: Add pmevfiltr2 support

From: Besar Wicaksono

Date: Fri Sep 26 2025 - 12:35:31 EST




> -----Original Message-----
> From: Robin Murphy <robin.murphy@xxxxxxx>
> Sent: Friday, September 26, 2025 5:32 AM
> To: Besar Wicaksono <bwicaksono@xxxxxxxxxx>; will@xxxxxxxxxx;
> ilkka@xxxxxxxxxxxxxxxxxxxxxx
> Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-
> tegra@xxxxxxxxxxxxxxx; suzuki.poulose@xxxxxxx; mark.rutland@xxxxxxx;
> Thierry Reding <treding@xxxxxxxxxx>; Jon Hunter <jonathanh@xxxxxxxxxx>;
> Vikram Sethi <vsethi@xxxxxxxxxx>; Rich Wiley <rwiley@xxxxxxxxxx>; Shanker
> Donthineni <sdonthineni@xxxxxxxxxx>
> Subject: Re: [PATCH v2 5/5] perf/arm_cspmu: nvidia: Add pmevfiltr2 support
>
> External email: Use caution opening links or attachments
>
>
> On 2025-09-23 1:18 am, Besar Wicaksono wrote:
> > Support NVIDIA PMU that utilizes the optional event filter2 register.
> >
> > Signed-off-by: Besar Wicaksono <bwicaksono@xxxxxxxxxx>
> > ---
> > drivers/perf/arm_cspmu/nvidia_cspmu.c | 176 +++++++++++++++++++---
> ----
> > 1 file changed, 133 insertions(+), 43 deletions(-)
> >
> > diff --git a/drivers/perf/arm_cspmu/nvidia_cspmu.c
> b/drivers/perf/arm_cspmu/nvidia_cspmu.c
> > index ac91dc46501d..e06a06d3407b 100644
> > --- a/drivers/perf/arm_cspmu/nvidia_cspmu.c
> > +++ b/drivers/perf/arm_cspmu/nvidia_cspmu.c
> > @@ -40,10 +40,21 @@
> >
> > struct nv_cspmu_ctx {
> > const char *name;
> > - u32 filter_mask;
> > - u32 filter_default_val;
> > +
> > struct attribute **event_attr;
> > struct attribute **format_attr;
> > +
> > + u32 filter_mask;
> > + u32 filter_default_val;
> > + u32 filter2_mask;
> > + u32 filter2_default_val;
> > +
> > + u32 (*get_filter)(const struct perf_event *event);
> > + u32 (*get_filter2)(const struct perf_event *event);
>
> Callbacks for this seem like complete overkill - you already know
> whether a given implementation cares about each filter via
> .filter{,2}_mask being nonzero, so unless you intend to have wildly
> different event encodings across implementations, a simple conditional
> extension of the existing nv_cspmu_event_filter() logic should be all
> you need.
>

Indeed, this is the reason. All the new PMUs we are planning to support
have unique requirements on the filter configuration.

Regards,
Besar