Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp735877lqt; Tue, 19 Mar 2024 02:06:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQBXZOfQlfsItiSoNiNlwJas8fYXlZjJp6470EB361zicbJttC49RnQU0ftfHoCo8lmnd+M6645bnIu9K+T3kbYcm6gsoJ1TI9VB5Q0w== X-Google-Smtp-Source: AGHT+IGqxKN9cqvcSw7Hs8jC4T9R0yzPmxxwdwW++MzmuiMyFcHvskNAF/qJKpIGRON41VAcPuVR X-Received: by 2002:a05:6122:11a7:b0:4d3:31fc:4839 with SMTP id y7-20020a05612211a700b004d331fc4839mr8768932vkn.2.1710839207163; Tue, 19 Mar 2024 02:06:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710839207; cv=pass; d=google.com; s=arc-20160816; b=Ca1Fr5A/3WnUbasCLUXqkKwnJN+jETB8hGJfON/lR01DNgqV8vCmQTcpE7wsPkvAhl obJbwgKuiSQ7w7hOsrpqZZsjlDuI+/4Q7RzQkorqCe+yzmfAtIMmdkqqHQEsVUgqryHE UFpJXO7B/3cDj6aH89WCU8ymDQtAixI9egg5nwBFR93BApF2ySqTXnlRk/3A1oKoaZz/ C0WPUzKBRuUDD3C8druRzJkDmWHqNyUQWfVuKP5fmxWGGHeeiqfEEP+hUUKNRnWKCBiV vS19xnCCqUTwi8cZUNdRvoyqvll/I49RoujUxW8oMbH07b7dk/Z1W0GKC61T3YIj3CED HDJQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Besk0i9lF9pASA+SWwpUURawOL5FpQ1zrAOiGhmEKXw=; fh=V7+5MsvHW7d4FxA0Q9EicS3G/KXFqdJwcjV1MeOt3A8=; b=ymrgH3QSvZODtJyhnExHn9oxLmT7MAvPow7tTLbAcwkmcuofLnO2bmULZDt4jIMpTK sHxsVdVZ228jZ000VEiIa/FdBpJS52uGJh3ZA0+rl+sGEFfdfWTBCe8aPLcPJZkWpRCG QmvsUJr+f1lYwjMNh23tqEk99TI3bvV74S63OMAE6TEOwi1tJrylr0ESsdZm4nLQ8+2T tt70tSDTY5d9KOpWqUtbJyW2tRDN73nuxW+xWnN+KXjJdYirPSLdL1FgIJoUza1EMQYU W9LMYNR/x6imrFhkfHUVCEnzJHcQU1iPiL1P38BYGqmcGVfFzLRaYuSpqHRSsXpSREUR 8K0A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XMQ+YVGv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-107276-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107276-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j7-20020a05621419c700b00690b1b4d1bdsi10283498qvc.59.2024.03.19.02.06.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 02:06:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107276-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XMQ+YVGv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-107276-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107276-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 889971C21B50 for ; Tue, 19 Mar 2024 09:06:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB65B7C0B2; Tue, 19 Mar 2024 09:06:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XMQ+YVGv" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC7C07C081 for ; Tue, 19 Mar 2024 09:06:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710839200; cv=none; b=I+Ie1Km59I6xgMy4sGFTVl5Xf1Jl6zP+2OChAGR7WB4I8fvspwCWQfk8rjAmaLY7koPWX4dsyRz1aPdJkTFKWrMWJYQ0J3sxeEwSgHykb+ixCLeyOdTS4+P88E8+Y4hUW+uO0xzm2S8xx6Bt4ms5W/W1gUBW1KGXRs4fdazbItQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710839200; c=relaxed/simple; bh=Besk0i9lF9pASA+SWwpUURawOL5FpQ1zrAOiGhmEKXw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bEbcvx+PXd89SuW8XdVyO2o9nPxd254pA5R37XWnLabKK6VsjK00SJSHqvowWlZa+ZvWL1gG4cZ6wOuxw+vsTQo/PTlF2YYsulFvXa8ardRvlzWah8e4FLuB7Xg7TY4iGRSHxE/re2o52/XsknEttlC+L2NjI7gVobPs5EiuRjA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XMQ+YVGv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1106BC433F1; Tue, 19 Mar 2024 09:06:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710839200; bh=Besk0i9lF9pASA+SWwpUURawOL5FpQ1zrAOiGhmEKXw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XMQ+YVGvD4hcB+2Y4+3f0qdkBJoIg5HTTaVr/30L/4GgMd0+lxZkGvZdTuteIoelT ihx9YeykEO8pW9VyaXA4JjmMm+iARhl3+xD769AnMG306O1sZeBtngTGf2MKRdWFCj 6RYKqNllHa20nry/sVmekFz5ySVSZ5G4FY0QheDwQBGEz76stIXrKGYSzQxNCH5Hjo eOn3o5XULzT5H0xSdM+ai4skwHpr373CZdzvBt7WF6ZQs/1BbgUrHk19Rg13flOZFA 69i/MaVYx5vWLIpInSuTZj1EoI83Ube2loi326EnAa9+DcWgX7kaU+xMfDNkphQnNk t1BDNWM9sMzgw== Date: Tue, 19 Mar 2024 09:06:34 +0000 From: Conor Dooley To: Atish Patra Cc: Andrew Jones , Inochi Amaoto , Qingfang Deng , Paul Walmsley , Palmer Dabbelt , Albert Ou , Atish Patra , Anup Patel , Will Deacon , Mark Rutland , Conor Dooley , Heiko Stuebner , Guo Ren , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] perf: RISC-V: fix IRQ detection on T-Head C908 Message-ID: <20240319-worry-video-66589b3ed8ae@spud> References: <20240311063018.1886757-1-dqfext@gmail.com> <20240312-evil-resource-66370b68b9b4@spud> <20240315-73aa13079ef83a4559869084@orel> <2de56d8b-bc78-428b-9c09-4729b269fa41@rivosinc.com> <20240318-such-animal-bf33de12dc3a@spud> <4bdaaff1-13ec-48c2-b165-6a8255784aef@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jDYWah4eJAonImXm" Content-Disposition: inline In-Reply-To: <4bdaaff1-13ec-48c2-b165-6a8255784aef@rivosinc.com> --jDYWah4eJAonImXm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 18, 2024 at 05:48:13PM -0700, Atish Patra wrote: > On 3/18/24 16:48, Conor Dooley wrote: > > On Mon, Mar 18, 2024 at 03:46:54PM -0700, Atish Patra wrote: > > > For 2.b, either we can start defining pseudo extensions or adding > > > vendor/arch/impid checks. > > >=20 > > > @Conor: You seems to prefer the earlier approach instead of adding the > > > checks. Care to elaborate why do you think that's a better method com= pared > > > to a simple check ? > >=20 > > Because I don't think that describing these as "errata" in the first > > place is even accurate. This is not a case of a vendor claiming they > > have Sscofpmf support but the implementation is flawed. As far as I > > understand, this is a vendor creating a useful feature prior to the > > creation of a standard extension. > > A bit of a test for this could be "If the standard extension never > > existed, would this be considered a new feature or an implementation > > issue". I think this is pretty clearly in the former camp. > >=20 >=20 > So we have 3 cases. >=20 > 1. Pseudo extension: An vendor extension designed and/or implemented befo= re > the standard RVI extension was ratified but do not violate any standard > encoding space. >=20 > 2. Erratas: An genuine bug/design issue in the expected behavior from a > standard RVI extension (including violating standard encoding space) >=20 > 3. Vendor extension: A new or a variant of standard RVI extension which is > different enough from standard extension. >=20 > IMO, the line between #2 and #1 may get blurry as we going forward because > of the sheer number of small extensions RVI is comping up with (which is a > problem as well). Aye, I think some of that is verging on ridiculous. > Just to clarify: I am not too worried about this particular case as we kn= ow > that T-head's implementation predates the Sscofpmf extension. > But once we define a standard mechanism for this kind of situation, vendor > may start to abuse it. How do you envisage it being abused by a vendor? Pre-dating the standard extension does make this one fairly clear-cut, but are you worried about people coming along and claiming to implement XConorSscofpmf instead of Sscofpmf rather than suffer the "shame" of a broken implementation? All this stuff is going to be pretty case-by-case (to begin with at least) so I'm not too worried about that sort of abuse. > > I do not think we should be using m*id detection implementations of a > > feature prior to creation of a standard extension for the same purpose. > > To me the main difference between a case like this and VentanaCondOps/Z= icond > > is that we are the ones calling this an extension (hence my use of pseu= do) > > and not the vendor of the IP. If T-Head were to publish a document tomo= rrow > > on the T-Head github repo for official vendor extensions, that differen= ce > > would not even exist any longer. > >=20 >=20 > Exactly! If vendor publishes these as an extension or an errata, that's a > binding agreement to call it in a specific way. I don't agree that we are bound to call it the way that the vendor does. We should just review these sorts of things on a case-by-case basis, committing to doing what the vendor says is abusable. > > I also do not believe that it is a "simple" check. The number of > > implementations that could end up using this PMU could just balloon > > if T-Head has no intention of switching to Sscofpmf. If they don't > > balloon in this case, there's nothing stopping them ballooning in a >=20 > Ideally, they shouldn't as it a simple case of CSR number & IRQ number. > If they care to implement AIA, then they must change it to standard sscof= pmf > as the current IRQ violates the AIA spec. But who knows if they care to > implement AIA or not. What kinda "worried" me here is that the c908 implements /both/ Zicbom and the T-Head CMO instructions and /both/ Svpbmt and their original misuse of the reserved bits but they do not support Sscofpmf. Maybe it just was not feasible to migrate entirely (but they did for vector) or to support both interrupt numbers and to alias the CSR, but it seemed like the opportunity to standardise a bunch of other stuff was taken, but this particular extension was not. That's why I was worried that we'd see some ballooning in these specific checks. > > similar case in the future. We should let the platform firmware tell=20 > > explicitly, be that via DT or ACPI, what features are supported rather > > than try to reverse engineer it ourselves via m*id. > >=20 > Fair enough. >=20 >=20 > > That leads into another general issue I have with using m*id detection, > > which I think I have mentioned several times on the list - it prevents = the > > platform (hypervisor, emulator or firmware) from disabling that feature. > >=20 >=20 > If that is the only concern, platform can just disable the actual > extension(i.e. sscofpmf in this case) to disable that feature for that > particular vendor. Right. Maybe I wasn't clear that this is a problem with using m*id for /detection/ of extensions and not with using m*id to work around implementation issues with the extension. In the latter case, you're applying a fixup only when the actual extension is communicated to be present, which leaves that control in the hands of the platform. > > If I had a time machine back to when the T-Head perf or cmo stuff was > > submitted, I was try to avoid any of it being merged with the m*id > > detection method. > >=20 > > > I agree that don't have the crystal ball and may be proven wrong in t= he > > > future (I will be definitely happy about that!). But given the divers= ity of > > > RISC-V ecosystem, I feel that may be our sad reality. > >=20 > > I don't understand what this comment is referring to, it lacks context > > as to what the sad reality actually is. > >=20 > > I hope that all made sense and explained why I am against this method > > for detecting what I believe to be features rather than errata, > > Conor. > >=20 >=20 > Yes.Thanks again for the clarification. Again, I am not opposed to the id= ea. > I just wanted to understand if this is the best option we have right now. --jDYWah4eJAonImXm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZflVmgAKCRB4tDGHoIJi 0uTJAP4tm/qyPBI8P5hE3evFbYiu1vAiujb+43plrJuxa47r3wEAlCRQB/ZNIQsx +sADJZ94egfK/DR3Hm3z77uDJVFY/Qk= =qQhH -----END PGP SIGNATURE----- --jDYWah4eJAonImXm--