public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Leo Yan <leo.yan@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	James Clark <james.clark@linaro.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	German Gomez <german.gomez@arm.com>,
	Ali Saidi <alisaidi@amazon.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 01/14] drivers/perf: arm_spe: Expose event filter
Date: Mon, 14 Jul 2025 14:07:32 +0100	[thread overview]
Message-ID: <aHUBFGPck-O3vs9b@willie-the-truck> (raw)
In-Reply-To: <20250707-arm_spe_support_hitm_overhead_v1_public-v3-1-33ea82da3280@arm.com>

On Mon, Jul 07, 2025 at 02:39:23PM +0100, Leo Yan wrote:
> Expose an "event_filter" entry in the caps folder to inform user space
> about which events can be filtered.
> 
> Change the return type of arm_spe_pmu_cap_get() from u32 to u64 to
> accommodate the added event filter entry.
> 
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
>  drivers/perf/arm_spe_pmu.c | 36 ++++++++++++++++++++----------------
>  1 file changed, 20 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c
> index 3efed8839a4ec5604eba242cb620327cd2a6a87d..78d8cb59b66d7bc6319eb4ee40e6d2d32ffb8bdf 100644
> --- a/drivers/perf/arm_spe_pmu.c
> +++ b/drivers/perf/arm_spe_pmu.c
> @@ -115,6 +115,7 @@ enum arm_spe_pmu_capabilities {
>  	SPE_PMU_CAP_FEAT_MAX,
>  	SPE_PMU_CAP_CNT_SZ = SPE_PMU_CAP_FEAT_MAX,
>  	SPE_PMU_CAP_MIN_IVAL,
> +	SPE_PMU_CAP_EVENT_FILTER,
>  };
>  
>  static int arm_spe_pmu_feat_caps[SPE_PMU_CAP_FEAT_MAX] = {
> @@ -122,7 +123,21 @@ static int arm_spe_pmu_feat_caps[SPE_PMU_CAP_FEAT_MAX] = {
>  	[SPE_PMU_CAP_ERND]	= SPE_PMU_FEAT_ERND,
>  };
>  
> -static u32 arm_spe_pmu_cap_get(struct arm_spe_pmu *spe_pmu, int cap)
> +static u64 arm_spe_pmsevfr_res0(u16 pmsver)
> +{
> +	switch (pmsver) {
> +	case ID_AA64DFR0_EL1_PMSVer_IMP:
> +		return PMSEVFR_EL1_RES0_IMP;
> +	case ID_AA64DFR0_EL1_PMSVer_V1P1:
> +		return PMSEVFR_EL1_RES0_V1P1;
> +	case ID_AA64DFR0_EL1_PMSVer_V1P2:
> +	/* Return the highest version we support in default */
> +	default:
> +		return PMSEVFR_EL1_RES0_V1P2;
> +	}
> +}

Hmm. This logic was already a little shakey and so I'm not sure it's a
good idea to expose it directly to userspace. Maintaining RES0 masks for
different versions of SPE won't scale and there are already things that
we can't sensibly handle. For example, E[8]:

  | When (FEAT_SPEv1p4 is implemented or filtering on event 8 is
  | optionally supported) and event 8 is implemented:

So, stepping back, can we remove this stuff altogether? The bits are
RAZ/WI in the case that the even is not implement, but that means that:

  | Software can rely on the field reading as all 0s, and on writes being
  | ignored.

so why are we even bothering to police this?

In other words, remove arm_spe_pmsevfr_res0() and the two checks that
use it in arm_spe_pmu_event_init(). If userspace tries to filter events
that aren't implemented, then it gets to keep the pieces.

Will


  reply	other threads:[~2025-07-14 13:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-07 13:39 [PATCH v3 00/14] perf arm-spe: Support new events in FEAT_SPEv1p4 Leo Yan
2025-07-07 13:39 ` [PATCH v3 01/14] drivers/perf: arm_spe: Expose event filter Leo Yan
2025-07-14 13:07   ` Will Deacon [this message]
2025-07-14 15:09     ` Leo Yan
2025-07-14 15:13       ` Will Deacon
2025-07-14 15:42         ` Leo Yan
2025-07-15 11:15           ` James Clark
2025-07-17 11:43             ` Will Deacon
2025-07-07 13:39 ` [PATCH v3 02/14] perf arm_spe: Correct setting remote access Leo Yan
2025-07-07 13:39 ` [PATCH v3 03/14] perf arm_spe: Correct memory level for " Leo Yan
2025-07-07 13:39 ` [PATCH v3 04/14] perf arm_spe: Use full type for data_src Leo Yan
2025-07-07 13:39 ` [PATCH v3 05/14] perf arm_spe: Directly propagate raw event Leo Yan
2025-07-07 13:39 ` [PATCH v3 06/14] perf arm_spe: Decode event types for new features Leo Yan
2025-07-07 13:39 ` [PATCH v3 07/14] perf arm_spe: Add "event_filter" entry in meta data Leo Yan
2025-07-07 13:39 ` [PATCH v3 08/14] perf arm_spe: Refine memory level filling Leo Yan
2025-07-07 13:39 ` [PATCH v3 09/14] perf arm_spe: Separate setting of memory levels for loads and stores Leo Yan
2025-07-07 13:39 ` [PATCH v3 10/14] perf arm_spe: Fill memory levels for FEAT_SPEv1p4 Leo Yan
2025-07-07 13:39 ` [PATCH v3 11/14] perf arm_spe: Improve CPU number retrieving in per-thread mode Leo Yan
2025-07-07 13:39 ` [PATCH v3 12/14] perf arm_spe: Refactor arm_spe__get_metadata_by_cpu() Leo Yan
2025-07-07 13:39 ` [PATCH v3 13/14] perf arm_spe: Set HITM flag Leo Yan
2025-07-07 13:39 ` [PATCH v3 14/14] perf arm_spe: Allow parsing both data source and events Leo Yan

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=aHUBFGPck-O3vs9b@willie-the-truck \
    --to=will@kernel.org \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alisaidi@amazon.com \
    --cc=german.gomez@arm.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    /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