linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: Will Deacon <will@kernel.org>
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 16:09:21 +0100	[thread overview]
Message-ID: <20250714150921.GE1093654@e132581.arm.com> (raw)
In-Reply-To: <aHUBFGPck-O3vs9b@willie-the-truck>

Hi Will,

On Mon, Jul 14, 2025 at 02:07:32PM +0100, Will Deacon wrote:

[...]

> > +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?

It's fine with me to remove the validation for the event filter.

However, I have the following question in comment below.

> 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.

Then the question is: what information should be exposed to userspace
so that tools can decide which events are valid?

I would suggest to expose a new entry, "caps/version", to indicate the
SPE version number. Tools can use this to apply the appropriate event
validation. Please let me know if this works for you.

Thanks,
Leo

  reply	other threads:[~2025-07-14 15:09 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
2025-07-14 15:09     ` Leo Yan [this message]
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=20250714150921.GE1093654@e132581.arm.com \
    --to=leo.yan@arm.com \
    --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=linux-arm-kernel@lists.infradead.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    --cc=will@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;
as well as URLs for NNTP newsgroup(s).