From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8B260C3DA4A for ; Tue, 20 Aug 2024 09:28:50 +0000 (UTC) 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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OrNv0a8pV7AB5eoyrLGaZ4gbqbbMnLV9qRf5w9arfjU=; b=sh7nQy8RHySbyIVSAghPK8p5lA oH39kJ14btWyuKKU1I5pSJ38SGLxmABqDCILsLvBMfNSoeHkLrRmeqP/jn91At8pMZI+2Q9OlOHbG q3fLxCIQ/jmYYRmBQmSmIUazwf6kh7MJXLeWkY7D+8due1VenVZFfeVK6wXtAH4HcpbiFwqxGWklY /n16s9VspkQVR1AjGg0ynRYuJas9+eEBsngnhtBfGALIvMYidymdVuqEiRFZRgnP3J+bKXe+25gRB Qpm+b8OY+hTAR6jvFPLjCvXwg6GQeCS3td7D0ANoumw/I1tvLIpKN8KYe3O6gfDeLtll96k7osw8M iWWC+U6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgLAL-00000004ZWP-05Tx; Tue, 20 Aug 2024 09:28:37 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgL9d-00000004ZKo-0LqH for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 09:27:54 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 08BBADA7; Tue, 20 Aug 2024 02:28:18 -0700 (PDT) Received: from J2N7QTR9R3 (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E745B3F66E; Tue, 20 Aug 2024 02:27:50 -0700 (PDT) Date: Tue, 20 Aug 2024 10:27:48 +0100 From: Mark Rutland To: Robin Murphy Cc: will@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, ilkka@os.amperecomputing.com Subject: Re: [PATCH 3/8] perf/arm-cmn: Ensure dtm_idx is big enough Message-ID: References: <22b69400-af16-4e78-8f72-c10564d7cc6c@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <22b69400-af16-4e78-8f72-c10564d7cc6c@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240820_022753_195274_440D2B69 X-CRM114-Status: GOOD ( 24.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Aug 19, 2024 at 04:00:06PM +0100, Robin Murphy wrote: > On 16/08/2024 11:14 am, Mark Rutland wrote: > > On Fri, Aug 09, 2024 at 08:15:42PM +0100, Robin Murphy wrote: > > > While CMN_MAX_DIMENSION was bumped to 12 for CMN-650, that only supports > > > up to a 10x10 mesh, so bumping dtm_idx to 256 bits at the time worked > > > out OK in practice. However CMN-700 did finally support up to 144 XPs, > > > and thus needs a worst-case 288 bits of dtm_idx for an aggregated XP > > > event on a maxed-out config. Oops. > > > > > > Fixes: 23760a014417 ("perf/arm-cmn: Add CMN-700 support") > > > Signed-off-by: Robin Murphy > > > --- > > > drivers/perf/arm-cmn.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c > > > index 0e2e12e2f4fb..c9a2b21a7aec 100644 > > > --- a/drivers/perf/arm-cmn.c > > > +++ b/drivers/perf/arm-cmn.c > > > @@ -563,7 +563,7 @@ static void arm_cmn_debugfs_init(struct arm_cmn *cmn, int id) {} > > > struct arm_cmn_hw_event { > > > struct arm_cmn_node *dn; > > > - u64 dtm_idx[4]; > > > + u64 dtm_idx[5]; > > > > Can't we size this based on CMN_MAX_DIMENSION (or CMN_MAX_XPS or > > CMN_MAX_DTMS), to make that clear? > > Fair enough, I did go back and forth a little on that idea, but reached the > opposite conclusion that documenting this with the assert to deliberately > make it *not* look straightforward was nicer than wrestling with an accurate > name for the logical quantity here, which strictly would be something like > CMN_MAX_NODES_PER_TYPE_WE_CARE_ABOUT (there can already be up to 256 RN-Fs, > but those aren't visible to the PMU). > > I'll have another think on that approach - I do concur that the assert isn't > *functionally* any better than automatically sizing the array. FWIW, I'm happy with the value being an over-estimate, and with needing a comment. What I'm really after is that the sizing of dtm_idx is clear at the definition of dtm_idx, without an arbitrary-looking number. Mark.