From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EE9D606A332 for ; Wed, 18 Nov 2026 15:36:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=EEIbF/IM; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YEiwg4VY DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=PhnMB43dmhhOP+uEehjfYbWyisR+iluGA4pbiWpu2q0=; b=EEIbF/IM+N/9LqDPPWy2rPW/hy wvTuZXoipTQRxmQSNN6BYD8W7Q3X//5vMEmSRX1NyKxlTN4yByq41zJSgKOjuTUC/a3Yn6d+jyaUq r2rTHGkqqlqlLP47jo/3kTUwR5rBSXQFrOBRGCfy4qoxMj33vkITiOf8jXCIILcJHKNmLfol6P4KI LfL5AorxgIXyT11PwEtPVlYDbgaHQ4HJiJE5M6dXBdOTIBZclYVQttm93Daz/wvIjBDJmTSnIiCCH mX3xG16wGSzy9WBiUkhIYFBKaMobTM1Ratz0D/Hvo+dduzQjz9FPO0BfEV04vM1lzw163ry9vEXyK zivfw5cQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xThhX-00000009KQX-14L2; Wed, 18 Nov 2026 15:35:59 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xThhS-00000009KNp-3gBE for linux-arm-kernel@lists.infradead.org; Wed, 18 Nov 2026 15:35:55 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 99B46624A8; Wed, 18 Nov 2026 15:35:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D4D01F000C6; Wed, 18 Nov 2026 15:35:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795016153; bh=PhnMB43dmhhOP+uEehjfYbWyisR+iluGA4pbiWpu2q0=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=YEiwg4VYtGuqGQJP5AIPXvqqK8mL8uNE+40MF1Ru0rtQdXp4Xd4OzqIn6c3xS/zz9 Tj24RvH6VjLdr9XTcDeGOKiexcgoAP3L3NGDGjhbmlmlubZq3ytpi2LJUp6Qi8cdqX uxiMy4jgVMCaDWY5OOUDlx2vkx1rMTEt/YycTBdLzayKz/LYgULi9ApJ17qghFnQ8Q WfCBGXbeJBGzc1d9OGXfDB7+wUSZgw1ypZS+7uJPXhXLpJtmeXMqC60z7h59GKVlos W0yxzBWnuGgX7UKaWOw05nuX4ZdwPYXr/IJGp/zkHNKDAafpU4vlR799d26p8xbRup O/e8Y8TTy3IAg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xThhP-000000000We-1Pzi; Wed, 18 Nov 2026 15:35:51 +0000 Date: Wed, 18 Nov 2026 15:35:50 +0000 Message-ID: <8633sy17ah.wl-maz@kernel.org> From: Marc Zyngier To: Myria Sarvay Cc: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sven Peter , Janne Grunau , Neal Gompa , 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 , Nick Chan Subject: Re: [PATCH v2 03/15] drivers/perf: apple_m1: Support per-implementation event tables In-Reply-To: References: <20261107-m3-plus-pmu-events-v2-0-acf1e78da039@gmail.com> <20261107-m3-plus-pmu-events-v2-3-acf1e78da039@gmail.com> <864ide1hb1.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-Archived-By: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: myrialsarvay@gmail.com, will@kernel.org, mark.rutland@arm.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, sven@kernel.org, j@jannau.net, 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, yuvanshen09@gmail.com, towinchenmi@gmail.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Wed, 18 Nov 2026 13:36:23 +0000, Myria Sarvay 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.