Re: [PATCH v2 1/2] perf: arm_spe: Validate the inverse event filter against PMSNEVFR_EL1
From: Leo Yan
Date: Mon Nov 30 2026 - 05:56:18 EST
On Mon, Nov 30, 2026 at 10:42:48AM +0000, James Clark wrote:
> On 30/11/2026 06:13, Ping Li wrote:
> > config3 is validated against the mask probed from PMSEVFR_EL1, even
> > though it is written verbatim to PMSNEVFR_EL1. Implementations are
> > expected to use the same bit positions for the two registers, but the
> > borrowed mask also lets an invalid config pass the early check when
> > FEAT_INV_FILT_EVT is absent, deferring the error to the later
> > PMSFCR_EL1.FnE feature check.
When read v1, I thought pmsnevfr_res0 could prevent the inverse
event filter from being configured when FEAT_INV_FILT_EVT is not
supported.
However, the current driver already prevents this in event init:
if ((FIELD_GET(PMSFCR_EL1_FnE, reg)) &&
!(spe_pmu->features & SPE_PMU_FEAT_INV_FILT_EVT))
return -EOPNOTSUPP;
> > Probe the supported filter bits of PMSNEVFR_EL1 separately and
> > validate config3 against its own mask. Keep a full mask when the
> > feature is not implemented so that any attempt to use the inverse
> > event filter is rejected at the earliest opportunity.
> >
> > Fixes: 8d9190f00a975 ("perf: arm_spe: Add support for SPEv1.2 inverted event filtering")
>
> I don't think this actually fixes anything or is required. The ARM states
> that the availability of filters are based on the existence of the same
> events and features for both inverted and non inverted filters. The pseudo
> code also uses a single mask variable to define both filters.
>
> Unless you can show some specific exception?
Based on above, I agreed this patch is not quite useful.
Thanks,
Leo