Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3164639lqo; Wed, 15 May 2024 01:20:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUOccfpuMkfrt72rGvAZm8HYwMhKooJo5bC8H3Uuf2u76aeK4QEUQnJHyBEH1SN0w9OODXXHJiBKsRUnF2eiDX6Kls/iWj0AANVcHJ56g== X-Google-Smtp-Source: AGHT+IFU13frpCg0tQuW/7mhIzNl7q9GhOM4f/HsWonHjWlt0UAWbJ5TTN/d2LFws86c0PHqpNMs X-Received: by 2002:a17:906:b858:b0:a59:afba:d0af with SMTP id a640c23a62f3a-a5a2d536d60mr1011294066b.4.1715761225648; Wed, 15 May 2024 01:20:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715761225; cv=pass; d=google.com; s=arc-20160816; b=m/YVnTzHvD7/wJEwTq+qGdx0ptx2kqLWgn0iLV05Ol6bpfT7+Tn+JuJEMr/cWIckQ5 PWDKQzm5Egc6bekn4v/+cBQ/gFpED9CwR8aczbARWXJa9rUk9fO3sOf4DdZmGj2K253T vKfH4JLgGWToIuIpZhjfaoW/KswFzZLRahvNpqGoKg0x/CbABZScrs5bY0pOHpGI0YMu wz+N4Tadpew8Xy3mMR6ouwU0E5TN6Pu+KknFK+O1MKLZ4eqcURdg8JSt3Z+1m0/kKpxX wBcjOQQkIdGDBVx1UX9Nmk9p4H7YUX62mP/41vtZcCNxpNHSFNm2HPRiQhoz1yTLByFH O+oQ== 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=Dmm8GsRj7QumcLAkd0vcySitYO6Q5ITTV/LvTu1AbGg=; fh=y88exYlilyS39lxBPJyisPhIsyrNXNhPGs1VAC60vtk=; b=CPWGe90JiEi5ofzNCoAXZjwSKa2sz9zuF+s4BRH3JJ5anh9ae30hHM8KcDgBj9UjuZ 2sXxBc6eb138i3m84gb3TKvmngWb281xtMzkvEIKY4zqj87WnXu6PX9Loqv6x7OdbFPE Gx1MjOPv0qBp5FfdzBCxRdPUEDGcvjU8WkIE20lWlr0j6L0J569ClN5emD8Rbfo3A6Ez k8V9a+4dEjdBi77HNu9PNF7uNJTvT77eWi9Dh/Vc22Q82sAdgjA0wH1SHh/o6eHyet7x e555V79CGUL2xOb7jyERO/RzklmyRAHlS5cXKWTSyHt4BaMMLDvqTjnBWZTNbbsuWQcS +EFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=dYUJuOCI; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-179645-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179645-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a179463c5si722108966b.75.2024.05.15.01.20.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 01:20:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179645-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=dYUJuOCI; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-179645-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179645-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 412F11F2175F for ; Wed, 15 May 2024 08:20:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7491F4E1A8; Wed, 15 May 2024 08:20:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="dYUJuOCI" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 344A84C627; Wed, 15 May 2024 08:20:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715761215; cv=none; b=RMThYnWb0tBCHwj639qy8C2QioBuahhvcGP4XRnWfCJcrcp97o3i6fc5baO6Fzq0VL6nLyB4Q4gqFQx8ABLoTkift9nN0cf6fzeCzJCQRMcqKx/0VAYXa/G4yC+t9WV1E49CSmN0Mq7E2muLvYQ6jHUnllkDUwFFUxFwOX6pbsU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715761215; c=relaxed/simple; bh=ISlf6Oang1bIb3NO5GiCyu6dI90A4hgSsCEF1qXyjhM=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ArqaBRabbKNZVfYxQj1zyy75bk2LUH0N+NymIFHeLLPkbiHH+35QM2p2q0RdsIc2qJlxyT25PNBqOhNmCXFcYVnW0f5gFGlBHMmaY/yt3x8QVo2+T++I72Uz9Op8NaYU4aJPWC072oW09Kw8xIt3SS4HDmB12uy+6hLSafPe454= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=dYUJuOCI; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1715761214; x=1747297214; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=ISlf6Oang1bIb3NO5GiCyu6dI90A4hgSsCEF1qXyjhM=; b=dYUJuOCIkC+YxbJ878n4kUTHelvSPJhhx7nD8jrs7Ug8CGYSj8RiB7ko 4UkTICBt1MTSiYabgz1X2qVIxJQr1CjtrM+wICF/xzqS9JEeBZdGKIgdT GuD5csHaSzrYeeBKhn4obpGG2etxGkgD8M/oXyjdiXN2VlMV/+J+PLfB6 m8k6JJM2CGNNWK8fYktQ4QiwW+jjjtkf17wCbxcbZ83wOxtpKL2YMMznP rxlN+Eg5pOgBHwp9gUYPsJdOpXdhx4+bVy+hL4T8lPcHiNyItIXPP7uWK sS8IPcgem3BxXaZ0txymcdzAUdMuXk/eZ5i9jjVPHIUT8nlKzaMm6CapB A==; X-CSE-ConnectionGUID: abhP6raiRY2CWqedFddvng== X-CSE-MsgGUID: 4iB1jHs7SKKoyuFQP8+Gpg== X-IronPort-AV: E=Sophos;i="6.08,161,1712646000"; d="asc'?scan'208";a="255643733" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 15 May 2024 01:20:13 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 15 May 2024 01:20:04 -0700 Received: from wendy (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 15 May 2024 01:20:00 -0700 Date: Wed, 15 May 2024 09:19:46 +0100 From: Conor Dooley To: Andrew Jones CC: "Wang, Xiao W" , "paul.walmsley@sifive.com" , "palmer@dabbelt.com" , "aou@eecs.berkeley.edu" , "luke.r.nels@gmail.com" , "xi.wang@gmail.com" , "bjorn@kernel.org" , "ast@kernel.org" , "daniel@iogearbox.net" , "andrii@kernel.org" , "martin.lau@linux.dev" , "eddyz87@gmail.com" , "song@kernel.org" , "yonghong.song@linux.dev" , "john.fastabend@gmail.com" , "kpsingh@kernel.org" , "sdf@google.com" , "haoluo@google.com" , "jolsa@kernel.org" , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "bpf@vger.kernel.org" , "pulehui@huawei.com" , "Li, Haicheng" , "conor@kernel.org" , Ben Dooks Subject: Re: [PATCH v2] riscv, bpf: Optimize zextw insn with Zba extension Message-ID: <20240515-cone-getting-d17037b51e97@wendy> References: <20240511023436.3282285-1-xiao.w.wang@intel.com> <20240513-5c6f04fb4a29963c63d09aa2@orel> <20240514-944dec90b2c531d8b6c783f7@orel> 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="PCtwkfT5UTiocbOE" Content-Disposition: inline In-Reply-To: <20240514-944dec90b2c531d8b6c783f7@orel> --PCtwkfT5UTiocbOE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 14, 2024 at 03:37:02PM +0200, Andrew Jones wrote: > On Tue, May 14, 2024 at 07:36:04AM GMT, Wang, Xiao W wrote: > > > From: Andrew Jones >> > > > +config RISCV_ISA_ZBA > > > > + bool "Zba extension support for bit manipulation instructions" > > > > + depends on TOOLCHAIN_HAS_ZBA > > >=20 > > > We handcraft the instruction, so why do we need toolchain support? > >=20 > > Good point, we don't need toolchain support for this bpf jit case. > >=20 > > >=20 > > > > + depends on RISCV_ALTERNATIVE > > >=20 > > > Also, while riscv_has_extension_likely() will be accelerated with > > > RISCV_ALTERNATIVE, it's not required. > >=20 > > Agree, it's not required. For this bpf jit case, we should drop these t= wo dependencies. > >=20 > > BTW, Zbb is used in bpf jit, the usage there also doesn't depend on too= lchain and > > RISCV_ALTERNATIVE, but the Kconfig for RISCV_ISA_ZBB has forced the dep= endencies > > due to Zbb assembly programming elsewhere. > > Maybe we could just dynamically check the existence of RISCV_ISA_ZB* be= fore jit code > > emission? or introduce new config options for bpf jit? I prefer the fir= st method and > > welcome any comments. >=20 > My preferences is to remove as much of the TOOLCHAIN_HAS_ stuff as > possible. We should audit the extensions which have them to see if > they're really necessary. While I think it is reasonable to allow the "RISCV_ISA_ZBB" option to control whether or not bpf is allowed to use it for optimisations, only allowing bpf to do that if there's toolchain support feels odd to me.. Maybe we need to sorta steal from Charlie's patchset and introduce some hidden options that have the toolchain dep that are used by the alternative macros etc? I'll have a poke at how bad that looks I think. > I don't mind depending on RISCV_ALTERNATIVE, > since it's almost required for riscv at this point anyway. As you say, using on riscv_has_extension_likely() doesn't mean you depend on alternatives so effectively all this does is rule out use with XIP, since alternatives are selected when !XIP. Does BPF even work for XIP? --PCtwkfT5UTiocbOE Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZkRwIgAKCRB4tDGHoIJi 0oNrAP9q45vV3szU20JF9S6wc6DveShfdByLH9gPMYtr7jfQJwEAgOlRs5bh/aUj XQBTHLztm+XoKiwl2Q24JAHreZtb9Ac= =/lH/ -----END PGP SIGNATURE----- --PCtwkfT5UTiocbOE--