mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Myria Sarvay <myrialsarvay@gmail.com>
Cc: Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Sven Peter <sven@kernel.org>,
	Janne Grunau <j@jannau.net>, Neal Gompa <neal@gompa.dev>,
	linux-arm-kernel@lists.infradead.org,
	linux-perf-users@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, asahi@lists.linux.dev,
	Yuvan Shen <yuvanshen09@gmail.com>,
	Nick Chan <towinchenmi@gmail.com>
Subject: Re: [PATCH v2 03/15] drivers/perf: apple_m1: Support per-implementation event tables
Date: Wed, 18 Nov 2026 15:35:50 +0000	[thread overview]
Message-ID: <8633sy17ah.wl-maz@kernel.org> (raw)
In-Reply-To: <av2p17j8AglpTSAz@macbookair>

On Wed, 18 Nov 2026 13:36:23 +0000,
Myria Sarvay <myrialsarvay@gmail.com> wrote:
> 
> On Wed, Nov 18, 2026 at 11:59:30AM +0000, Marc Zyngier wrote:
> >
> > Looking at the following patches, I feel that this series is taking
> > the long route to get to a relatively clear point: most of the
> > invariant that we relied on for M1, slightly relaxed for M2 (counter
> > width), are even more relaxed for M3+ (event width). We therefore need
> > to indirect things. The way you do it is to mirror the current setup,
> > with a whole set of callbacks per implementation and a bunch of
> > additional helpers.
> > 
> > But instead of having a set of helper functions, one per
> > implementation, with an ever increasing set of parameters, it really
> > feels like we could do with a more data-centric approach where we have
> > a single data structure describing an implementation, containing all
> > the relevant data (pointer to the event mapping table, flags, bit
> > indices for the user/kernel/guest/host attributes, and so on. We could
> > then have a single set of callbacks that work on everything.
> > 
> > You could convert M1/M2 to that, then just add the relevant
> > descriptions for M3+, which should just add data and the init
> > functions, nothing else.
> > 
> > Does this make sense to you?
> 
> Hi Marc,
> 
> It does make sense, and should reduce duplicated code, I'm just not
> confident I have the right idea as to how to implement it. I don't want
> to duplicate a lot of the generic arm_pmu code, so it looks like it'd
> probably have to be modified to allow passing a hardware specific detail
> struct to all the callbacks, likely stored as a new field (void *) in
> the arm_pmu struct itself. Does that vaguely sound right to you?

I'm not sure we really need an extra field. arm_pmu already has a
pointer to the platform device (pmu->plat_device, also as
pmu->dev.parent). It means you can use dev_{get,set}_data() on the
attached device. That's a bit of pointer chasing, but nothing that we
can't easily swallow if placed behind a convenient macro.

> 
> Also, with this rewrite, if we're going to make the code a whole lot
> more generic, and take hardware specific data from a static struct,
> would it make sense to rename the driver/all the callbacks while we're
> at it, now that we're adding a lot more than just M1/M2 pmu events?

I don't think names matter much. If I had my way, all variables and
functions would be called "bob". I'd suggest you look into the
refactoring without worrying about the naming, and if that's the last
problem we have to solve, we'll be in a remarkably good place! ;-)

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2026-11-18 15:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 10:48 [PATCH v2 00/15] drivers/perf: apple_m1: Add M3/M4/A18 Pro Support Myria Sarvay via B4 Relay
2026-11-07 10:48 ` [PATCH v2 01/15] dt-bindings: arm: pmu: Add Apple M3/M4/A18 Pro SoC CPU PMU compatibles Myria Sarvay via B4 Relay
2026-11-07 10:48 ` [PATCH v2 02/15] drivers/perf: apple_m1: Remove unused variables Myria Sarvay via B4 Relay
2026-11-18 11:13   ` Marc Zyngier
2026-11-18 13:06     ` Myria Sarvay
2026-11-07 10:48 ` [PATCH v2 03/15] drivers/perf: apple_m1: Support per-implementation event tables Myria Sarvay via B4 Relay
2026-11-18 11:59   ` Marc Zyngier
2026-11-18 13:36     ` Myria Sarvay
2026-11-18 15:35       ` Marc Zyngier [this message]
2026-11-07 10:48 ` [PATCH v2 04/15] drivers/perf: apple_m1: Support per-implementation event size Myria Sarvay via B4 Relay
2026-11-07 10:48 ` [PATCH v2 05/15] drivers/perf: apple_m1: Use macros for per-implementation init functions Myria Sarvay via B4 Relay
2026-11-07 10:48 ` [PATCH v2 06/15] drivers/perf: apple_m1: Add Apple M3 Series Support Myria Sarvay via B4 Relay
2026-11-08  0:42   ` kernel test robot
2026-11-07 10:48 ` [PATCH v2 07/15] drivers/perf: apple_m1: Add Apple M4 " Myria Sarvay via B4 Relay
2026-11-07 10:48 ` [PATCH v2 08/15] drivers/perf: apple_m1: Add Apple A18 Support Myria Sarvay via B4 Relay
2026-11-07 10:48 ` [PATCH v2 09/15] arm64: dts: apple: t603*: Add core interrupt affinities Myria Sarvay via B4 Relay
2026-11-07 10:48 ` [PATCH v2 10/15] arm64: dts: apple: t8140: " Myria Sarvay via B4 Relay
2026-11-07 10:48 ` [PATCH v2 11/15] arm64: dts: apple: t603x: Add PMU Device Nodes Myria Sarvay via B4 Relay
2026-11-07 10:48 ` [PATCH v2 12/15] arm64: dts: apple: t8122: " Myria Sarvay via B4 Relay
2026-11-07 10:49 ` [PATCH v2 13/15] arm64: dts: apple: t604x: " Myria Sarvay via B4 Relay
2026-11-07 10:49 ` [PATCH v2 14/15] arm64: dts: apple: t8132: " Myria Sarvay via B4 Relay
2026-11-07 10:49 ` [PATCH v2 15/15] arm64: dts: apple: t8140: " Myria Sarvay via B4 Relay

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=8633sy17ah.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=asahi@lists.linux.dev \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=j@jannau.net \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=myrialsarvay@gmail.com \
    --cc=neal@gompa.dev \
    --cc=robh@kernel.org \
    --cc=sven@kernel.org \
    --cc=towinchenmi@gmail.com \
    --cc=will@kernel.org \
    --cc=yuvanshen09@gmail.com \
    /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

all inboxes | Powered by JetHome®