Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp882857rdb; Fri, 20 Oct 2023 02:06:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFeNYRZnpK/chAu4KALuQf7GOR10kzLNhi66T27WYvmH7nNzkppBXShwVgVYT1AwP9orqrE X-Received: by 2002:a05:6a20:3d02:b0:15e:d84:1c5e with SMTP id y2-20020a056a203d0200b0015e0d841c5emr1315083pzi.38.1697792781893; Fri, 20 Oct 2023 02:06:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697792781; cv=none; d=google.com; s=arc-20160816; b=cTsyf8pHlvlRazmJmONOCUJIO6aSDlkKbXArXiIIzoI3U0Q8VlJVC1LWzSPgZY3wHN DER4MG+IucTexjb0hTGkKw+HCKCf72b51AlmIAPKHiPJO1E8WXul3Zu+FTBm8/N0Pjs1 EpUB+gJuQMlruL01xk2Ca0VfILV19tREjjtgee3udBjz2K6z4N2rV0HMeDPfz5YAcVER OH4B9vISQ23JxFubi5wgXWqDmquJtNrPR4UGl5tF1+K27xFRKF+cXzenQpkEdeVmPEdC n1lTTfCzyKLQm4alN4Vctqjm+JX50gZFoBiHfK8HWwpC3NH0QL7eIx1yOaAJXgVj8NlZ d0+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1d4+IdE5BiyApx+tc0lvMXXqthts9FUrCT3AFyKt204=; fh=v128TtLsN0Ef2cgU1JX7ZqOgx3IFCKDAjKUPOmc6M9I=; b=QVRIVjfelTUAJISCVkXVKSSiFjBbNkpUpIKdAnykRlu1bF4OJsSyq4Wwv6PHs6AZeB UzOCOK9zq/RbBQP6plZ0avf4Ii95zXSssRovnO/+iJDuVjfObJ+ZwtZUKG7lckFGTlfl YMNyeyS4D0iExb5j5M6AAB9lAVx2lVaYiCjgOkCRbCBFDdIqYJKCfAtKZ5k2pHxsH49m 2ectzw4/dFeA6pKxVKbrofM+pq8DoanR+7oIoS/r+oyjd5eL4dKODVhmf+5czX/ZZc1I AgJZ9CbPxhuEltIuwWBpvTCeIwGICzEbW4KVjunz+M3Dt6hv9QS+Jq+wIqtam4OUVr6s q2TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Wchl94Qi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id c7-20020a170902b68700b001c6223663b2si1354162pls.339.2023.10.20.02.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 02:06:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Wchl94Qi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 21977804E333; Fri, 20 Oct 2023 02:05:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376556AbjJTJFb (ORCPT + 99 others); Fri, 20 Oct 2023 05:05:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376539AbjJTJFa (ORCPT ); Fri, 20 Oct 2023 05:05:30 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B0C8AB for ; Fri, 20 Oct 2023 02:05:28 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40FD4C433C7; Fri, 20 Oct 2023 09:05:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697792728; bh=Q2i9cGMMYMVelZA9jo7bWwCUpM96iBnURwnpSnHzXg8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Wchl94Qi9hV+Vi4rtCKso9+DojD9vgE2mBuYsml/2HTQuuWqaONwikdibV/L0utDh W6e1US1Qu5JgEufPe+Emtd4PAffm3XUuWyL/4rT95jwY3iwbPdDh9m3rUPx67XPWnA xVIvSoGT0aBVZiU4KdO94lDZ7MYCO1v2sMB0pp1ViK/HxJdG11ikb6AxRaxdmLUXsB Yr7gaptM/hY5iKNqz5+Jjb2238Nrwdta3o7XyczhhEqegkZcKMinWS4Zuk1cgeErzy mMF5Js9z7hOATCKn6/uJpXuQGLOo8PKG5JwEhhgR77Zg8Sv5fc1ikxAz8N0bRgrQJ7 Ka2/s4MKLegQw== Date: Fri, 20 Oct 2023 10:05:20 +0100 From: Conor Dooley To: Yu-Chien Peter Lin Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, will@kernel.org, mark.rutland@arm.com, atishp@atishpatra.org, anup@brainfault.org, conor.dooley@microchip.com, evan@rivosinc.com, jszhang@kernel.org, ajones@ventanamicro.com, rdunlap@infradead.org, heiko@sntech.de, samuel@sholland.org, guoren@kernel.org, prabhakar.mahadev-lad.rj@bp.renesas.com, uwu@icenowy.me, sunilvl@ventanamicro.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tim609@andestech.com, dylan@andestech.com, locus84@andestech.com, dminus@andestech.com Subject: Re: [RFC PATCH v2 07/10] perf: RISC-V: Move T-Head PMU to CPU feature alternative framework Message-ID: <20231020-snippet-diffusive-1a6052d52aae@spud> References: <20231019140119.3659651-1-peterlin@andestech.com> <20231019-predator-quartet-e56f43d5aa8d@spud> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XvYVzaew7WL+CCDC" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 20 Oct 2023 02:05:52 -0700 (PDT) --XvYVzaew7WL+CCDC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 20, 2023 at 04:54:58PM +0800, Yu-Chien Peter Lin wrote: > On Thu, Oct 19, 2023 at 05:13:00PM +0100, Conor Dooley wrote: > > On Thu, Oct 19, 2023 at 10:01:19PM +0800, Yu Chien Peter Lin wrote: > >=20 > > $subject: perf: RISC-V: Move T-Head PMU to CPU feature alternative fram= ework > >=20 > > IMO, this should be "RISC-V, perf:" or just "RISC-V" as the changes > > being made to the arch code are far more meaningful than those > > elsewhere. >=20 > OK will update the subject to "RISC-V:" >=20 > > > The custom PMU extension was developed to support perf event sampling > > > prior to the ratification of Sscofpmf. Instead of utilizing the stand= ard > > > bits and CSR of Sscofpmf, a set of custom CSRs is added. So we may > > > consider it as a CPU feature rather than an erratum. > > >=20 > > > T-Head cores need to append "xtheadpmu" to the riscv,isa-extensions > > > for each cpu node in device tree, and enable CONFIG_THEAD_CUSTOM_PMU > > > for proper functioning as of this commit. > >=20 > > And in doing so, you regress break perf for existing DTs :( > > You didn't add the property to existing DTS in-kernel either, so if this > > series was applied, perf would just entirely stop working, no? >=20 > Only `perf record/top` stop working I think. >=20 > There are too many users out there, and don't have the boards to > test, so leave those DTS unchanged, it would be great if T-Head > community could help to check/update their DTS. So, there are too many users to add xtheadpmu to the devicetrees, but not too many users to make changes that will cause a regression? I'm not following the logic here, sorry. > > > Signed-off-by: Yu Chien Peter Lin > > > --- > > > Hi All, > > >=20 > > > This is in preparation for introducing other PMU alternative. > > > We follow Conor's suggestion [1] to use cpu feature alternative > > > framework rather than errta, if you want to stick with errata > > > alternative or have other issues, please let me know. Thanks. > >=20 > > Personally, I like this conversion, but it is going to regress support > > for perf on any T-Head cores which may be a bitter pill to get people to > > actually accept... > > Perhaps we could add this "improved" detection in parallel, and > > eventually remove the m*id based stuff in the future. > >=20 > > > [1] https://patchwork.kernel.org/project/linux-riscv/patch/2023090702= 1635.1002738-4-peterlin@andestech.com/#25503860 > > >=20 > > > Changes v1 -> v2: > > > - New patch > > > --- > > > @@ -805,7 +816,8 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *p= mu, struct platform_device *pde > > > if (riscv_isa_extension_available(NULL, SSCOFPMF)) { > > > riscv_pmu_irq_num =3D RV_IRQ_PMU; > > > riscv_pmu_use_irq =3D true; > > > - } else if (IS_ENABLED(CONFIG_ERRATA_THEAD_PMU) && > > > + } else if (riscv_isa_extension_available(NULL, XTHEADPMU) && > > > + IS_ENABLED(CONFIG_THEAD_CUSTOM_PMU) && > > > riscv_cached_mvendorid(0) =3D=3D THEAD_VENDOR_ID && > > > riscv_cached_marchid(0) =3D=3D 0 && > > > riscv_cached_mimpid(0) =3D=3D 0) { > >=20 > > Can all of the m*id checks be removed, since the firmware is now > > explicitly telling us that the T-Head PMU is supported? >=20 > I can only comfirm that boards with "allwinner,sun20i-d1" compatible > string uses the T-Head PMU device callbacks. I'm not sure how that is an answer to my question. Thanks, Conor. --XvYVzaew7WL+CCDC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZTJC0AAKCRB4tDGHoIJi 0nHaAP9s0/KCk/++o9jSsTNdeG7318oIWBROwIxsdrZtV6H4SQD7BoW0i5nWJUh4 W9BZgM6pk4vdZ+gv3m1w/T8J/I4KlQQ= =q6XB -----END PGP SIGNATURE----- --XvYVzaew7WL+CCDC--