From: sashiko-bot@kernel.org
To: "Ping Li" <leeonion.muyu@gmail.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf: arm_spe: Probe PMSNEVFR and PMSDSFR filter bits independently
Date: Mon, 23 Nov 2026 07:48:01 +0000 [thread overview]
Message-ID: <sashiko-outbox-228838@kernel.org> (raw)
In-Reply-To: <20261123073719.3190149-1-leeonion.muyu@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] perf: arm_spe: inverted pmsdsfr_res0 check in
arm_spe_pmu_event_init()
--
commit 3f0a782ec38224bd78fe15f8095fc1100ecbb217
Author: Ping Li <leeonion.muyu@gmail.com>
perf: arm_spe: Probe PMSNEVFR and PMSDSFR filter bits independently
This commit probes the supported filter bits of PMSNEVFR_EL1 and
PMSDSFR_EL1 independently and validates inverse event filters and data
source filters against their respective RES0 masks.
> diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c
> index 707778c67dab5..00d54202c59bc 100644
> --- a/drivers/perf/arm_spe_pmu.c
> +++ b/drivers/perf/arm_spe_pmu.c
[ ... ]
> @@ -818,13 +820,22 @@ static int arm_spe_pmu_event_init(struct perf_event *event)
> if (arm_spe_event_to_pmsevfr(event) & spe_pmu->pmsevfr_res0)
> return -EOPNOTSUPP;
>
> - if (arm_spe_event_to_pmsnevfr(event) & spe_pmu->pmsevfr_res0)
> + if (arm_spe_event_to_pmsnevfr(event) & spe_pmu->pmsnevfr_res0)
> return -EOPNOTSUPP;
>
> if (arm_spe_event_to_pmsdsfr(event) != U64_MAX &&
> !(spe_pmu->features & SPE_PMU_FEAT_FDS))
> return -EOPNOTSUPP;
>
> + /*
> + * The data source filter is exposed inverted, so validate the
> + * value written to PMSDSFR_EL1 (~config4) rather than config4
> + * itself.
> + */
> + if (ATTR_CFG_GET_FLD(attr, inv_data_src_filter) &&
> + (arm_spe_event_to_pmsdsfr(event) & spe_pmu->pmsdsfr_res0))
> + return -EOPNOTSUPP;
[Severity: High]
Does validating arm_spe_event_to_pmsdsfr(event) (~config4) against
spe_pmu->pmsdsfr_res0 reject valid exclusion masks whenever PMSDSFR_EL1
has any unimplemented RAZ/WI bits?
Because arm_spe_event_to_pmsdsfr() bitwise-inverts inv_data_src_filter,
every bit left at its default of 0 in config4 becomes 1 in
arm_spe_event_to_pmsdsfr(event). If a user passes inv_data_src_filter=0x1
to exclude data source 0 while leaving all other bits at 0, any
unimplemented bit position in spe_pmu->pmsdsfr_res0 is 1 in both
arm_spe_event_to_pmsdsfr(event) and spe_pmu->pmsdsfr_res0, so
arm_spe_pmu_event_init() fails with -EOPNOTSUPP unless userspace sets
every unimplemented RES0 bit in config4 (which is not exposed in sysfs
caps/). Conversely, a config4 value that sets only unimplemented bits in
spe_pmu->pmsdsfr_res0 clears those bits in ~config4 and is accepted.
Should this check ATTR_CFG_GET_FLD(attr, inv_data_src_filter) &
spe_pmu->pmsdsfr_res0 instead, or expose the supported mask in caps/ if
userspace is expected to clear unimplemented bits?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123073719.3190149-1-leeonion.muyu@gmail.com?part=1
prev parent reply other threads:[~2026-11-23 7:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 7:37 [PATCH] perf: arm_spe: Probe PMSNEVFR and PMSDSFR filter bits independently Ping Li
2026-11-23 7:48 ` sashiko-bot [this message]
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=sashiko-outbox-228838@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=leeonion.muyu@gmail.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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