Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp555790lqt; Mon, 18 Mar 2024 16:48:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxWStWorn76ezazF0/A9QS1PwluiU9mFHxz3KTJwESfQrn7siZu9iZvK0LYtq8Zk9ayN90SEhDfI+8ToNxvoZ4KU2TBu8EsSHjPDjLfw== X-Google-Smtp-Source: AGHT+IGbdKCHpg+AQ18McYEWPG1Z7rlIk956gbjzJmqNoy5WAqNNfWSd+FmZBgFd4SFTnOQoR5fa X-Received: by 2002:a17:902:a3c7:b0:1de:ed38:e862 with SMTP id q7-20020a170902a3c700b001deed38e862mr10645382plb.19.1710805723026; Mon, 18 Mar 2024 16:48:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710805723; cv=pass; d=google.com; s=arc-20160816; b=qLpQEy0Z/X1Xs2ajW6RlliJqlhR/aaYSnM/duSwoAEGvCJDh5XZxEsbufRgY6m4Y3H 5tpO61FLyDvvPJ3eC64/1QHsYCjIPTizz2cnbT0jx0VumpQUg6A3Htwv+Ej/+27v/EgV CYvT/OE6Ko7Xz8INcgPNCFD1hyVSjSgcO1O84A/XpK17pjLimuG96KdiKFz5yUxb04Y0 CcN4TSgy4mwyHYEty2CUSrZhInxgW1kKK+6FuSTHQGkKkgIBW6IEgxhLtgcvBXuKRGQt qFmSuz+4+3Zr1n3ONGsVeDv32A/KhrbFpPR+0HDeUOhATV95jQ6Hzmo2WNjMu/8aflhz MncA== 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=HVw5hjLhzAcNZ92EUq6zVI1QQOznpFLNsoBhKUYE1+g=; fh=V7+5MsvHW7d4FxA0Q9EicS3G/KXFqdJwcjV1MeOt3A8=; b=U8JvSqiIAseYUyiELi5zzn818RUXuM84ivuVQTp/gZVFPuJElmPDC/PNSXyNCARqaF SUSdbtrlaGohCRCtHPRBOcn+XE7whosbxdiuB7Ln/OZc4JuniQlujm21Uh+y7HBGPa+z pW1ac5sdxNHBGLeUjdSFjKXGPayaSbcKXIgm1zJ8L07Y5Bp8PlEIfmj975FURk3Pce// 6sWWbo3xP6Q9jWQDULK8O3pfEzVWB2pIg7kZxI+3vxmoBNgzAT4Wq8YuDt2xoHGxkwtm kIlB1h96zDF5hjeZobLHf5EYDpWAQ+UTpgAtavD3BaryHQDtEokOb4xiPLrI9VLTHAzp gBSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tpVtI+ro; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106829-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106829-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o11-20020a170902d4cb00b001e012c2038esi3946437plg.557.2024.03.18.16.48.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 16:48:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106829-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tpVtI+ro; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106829-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106829-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AF6272823FD for ; Mon, 18 Mar 2024 23:48:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 507635F86E; Mon, 18 Mar 2024 23:48:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tpVtI+ro" 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 4F25C5F859 for ; Mon, 18 Mar 2024 23:48:36 +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=1710805717; cv=none; b=U3+CBvVvGyzliwusiIorYhUPqksEk8YdHX73kjxCkeeyaj/MoYNpWH/gEcXLqCLXt4ZetYPCI3O5SNz+IPo+PiZUZxPYZ8Aj+MIJsWiufIyxItvluGpjFgLPbQXsDWNm9ECuLG6ZMamWuRu2GCZc9bBOmO2A/hHaCwo5KC5igdw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710805717; c=relaxed/simple; bh=Cn6JLaHFakVOrCPLqDt4/1WgZyxDmKrIjDcII8XUGIg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oSwpw98QS8PNR+6UYnyKj8WhJx0mJrO5B7nZqtajRwu1Zuqk/1dJi7nPs7aRMG6uCZzjQtDaiVVNjoNVLP64cLnGTMILt3GMoPgX28LyBKEfiCsA55zrDZqrm0GslllQozixpZD2aUtu7pm8yAcQsTd+9+kE+tqwZZll0WxGJ8s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tpVtI+ro; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71F5FC433F1; Mon, 18 Mar 2024 23:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710805716; bh=Cn6JLaHFakVOrCPLqDt4/1WgZyxDmKrIjDcII8XUGIg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tpVtI+ro/2zMIR0B9qiL8hvLpHsmloDW2NP/k9jsl5O+ZLcT/YTJ/9xl5fZGzigqa 4lpgDM2qi1CtpYmPoucPaxFs7U0/Kt8EwqWaffnC/+6Ag9y0QO/Ims65lj9/r63FOD H1EDkS9pEIRmYPLwcGmecNbYvcDXFLWifXXVnC8Cqj2MZsrZesWx8IDI/0u+7qZLjr +Qo1KC35zJrrlY2zQeZaZrJxDEROIgq3ne5CsVYu/qaEIUvRoU/vqi+7SUJZcH3/bj /9tnKZBIbo/mB853fNvZCRh1F2q8YFhoniUcov1Khxm3W96SCE1RZdI/SDjUIE/FiN X2i+yqqk9INfQ== Date: Mon, 18 Mar 2024 23:48:31 +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: <20240318-such-animal-bf33de12dc3a@spud> References: <20240311063018.1886757-1-dqfext@gmail.com> <20240312-evil-resource-66370b68b9b4@spud> <20240315-73aa13079ef83a4559869084@orel> <2de56d8b-bc78-428b-9c09-4729b269fa41@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="7t9HXeunHB+b3F/8" Content-Disposition: inline In-Reply-To: <2de56d8b-bc78-428b-9c09-4729b269fa41@rivosinc.com> --7t9HXeunHB+b3F/8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 18, 2024 at 03:46:54PM -0700, Atish Patra wrote: > On 3/15/24 01:11, Andrew Jones wrote: > > On Wed, Mar 13, 2024 at 09:31:26AM +0800, Inochi Amaoto wrote: > > ... > > > IMHO, it may be better to use a new DT property like "riscv,cpu-errat= a" or > > > ",cpu-errata". It can achieve almost everything like using ps= eudo > > > isa. And the only cost I think is a small amount code to parse this. > > >=20 > >=20 > > What's the ACPI equivalent for this new DT property? If there isn't one, > > then the cost is also to introduce something to the ACPI spec and add t= he > > ACPI parsing code. > >=20 > > I'd much rather we call specified behaviors "extensions", whether they > > are vendor-specific or RVI standard, and then treat all extensions the > > same way in hardware descriptions and Linux. It'd also be best if errata > > in extension implementations were handled by replacing the extension in > > the hardware description with a new name which is specifically for the > > behavior Linux should expect. (Just because two extensions are almost t= he > > same doesn't mean we should say we have one and then have some second > > mechanism to say, "well, not really, instead of that, it's this". It's > > cleaner to just remove the extension it doesn't properly implement from > > its hardware description and create a name for the behavior it does hav= e.) > >=20 > > Errata in behaviors which don't have extension names (are hopefully few) > > and are where mvendorid and friends would need to be checked, but then = why > > not create a pseudo extension name, as Conor suggests, so the rest of > > Linux code can manage errata the same way it manages every other behavi= or? > >=20 > > The growth rate of the ISA bitmap is worth thinking about, though, since > > we have several copies of it (at least one "all harts" bitmap, one bitm= ap > > for each hart, another one for each vcpu, and then there's nested virt.= =2E.) > > We don't have enough extensions to worry about it now, but we can > > eventually try partitioning, using common maps for common bits, not > > storing bits which can be inferred from other bits, etc. >=20 > This is my biggest worry going forward. We already have a ever growing > standard RVI extension list. On top of that we have genuine vendor > extensions. IMHO, errata are bit different than extensions as there will = be > few vendor extensions in the future but many hardware erratas :) I dunno, I think there's going to be plenty of both. We may not see (or use) a lot of vendor extensions in mainline Linux, but they will exist. > If we start calling every hardware errata as an pseudo ISA extensions, we > will much bigger problem maintaining it in the future. I've explained to you at least once already that this is not my goal. Where there are genuine issues with the implementation of an extension creating a "pseudo" extension is not what I am suggesting we do. I have no problem with with the approach taken for the SiFive errata, for example. > We discussed this earlier during the Andes PMU extension series[1] as wel= l. > We have three types of extensions in discussions now. >=20 > 1. standard RVI extensions > 2. Vendor extensions > a. Genuine vendor extension > b. Vendor erratas which can be described as pseudo-extensions now > Keeping all these within a single ISA bitmap space seems very odd to me. > I think the feasible approach would be to partition the standard and vend= or > ISA extension space as you suggested. Let's be clear - partitioning the space is unrelated to the detection method. We can go ahead and partition the space and use "pseudo" extensions or we can have a unified space but use archid/impid for detection. Having a unified space is the simpler thing to implement right now, but it totally does not stop us breaking them out in the future. We could even gate these custom implementations behind config options if bloat is a concern - but multiplatform kernels are likely to enable all the options anyway. > 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 compared > to a simple check ? 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. 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/Zicond is that we are the ones calling this an extension (hence my use of pseudo) and not the vendor of the IP. If T-Head were to publish a document tomorrow on the T-Head github repo for official vendor extensions, that difference would not even exist any longer. 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 similar case in the future. We should let the platform firmware tell us explicitly, be that via DT or ACPI, what features are supported rather than try to reverse engineer it ourselves via m*id. 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. 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. > I agree that don't have the crystal ball and may be proven wrong in the > future (I will be definitely happy about that!). But given the diversity = of > RISC-V ecosystem, I feel that may be our sad reality. I don't understand what this comment is referring to, it lacks context as to what the sad reality actually is. 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. --7t9HXeunHB+b3F/8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZfjSzwAKCRB4tDGHoIJi 0hjTAQDU4iC54GGVQ58RwoBxuNpru5MnUhSu1JGRrSiUc83oCwEA83inmGv2dOAL hhn4SEc7b8EAwecO1yhS+VZqoKz/NAE= =nUaP -----END PGP SIGNATURE----- --7t9HXeunHB+b3F/8--