Re: [PATCH v2 2/2] perf: arm_spe: Validate the data source filter per-bit
From: Leo Yan
Date: Mon Nov 30 2026 - 09:50:19 EST
On Mon, Nov 30, 2026 at 09:17:48PM +0800, Ping Li wrote:
[...]
> Example: inv_data_src_filter=0x8 (exclude source 3, keep the rest)
>
> config4 = 0x0000000000000008
> written to PMSDSFR_EL1 = ~config4 = 0xfffffffffffffff7
>
> reg & pmsdsfr_res0 = 0xfffffffffffffff7 & 0xffffffffffffff00
> = 0xffffffffffffff00 != 0
> -> current check rejects: perf_event_open() fails with
> -EOPNOTSUPP
>
> ~reg & pmsdsfr_res0 = 0x0000000000000008 & 0xffffffffffffff00
> = 0x0000000000000000 == 0
> -> proposed check passes: the session runs, source 3 is
> excluded as requested, but sources 8-63 are silently
> missing although the config asked to include them
>
> The crux is the bits the user never explicitly set: with the
> inverted ABI, a cleared bit asks for the source to be included, so
> inv_data_src_filter=0x8 also asks for sources 8-63 to be included,
> and their bits are not implemented.
I have different understanding for "inv_data_src_filter=0x8 also asks
for sources 8-63 to be included".
With 0x8, userspace asks only to exclude data source 3. A clear bit
leaves the corresponding source eligible where supported, so I'd
validate only the set bits in config4.
Thanks,
Leo