Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp711177lqs; Fri, 14 Jun 2024 03:34:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1xZzvpQvZ2gZ7x/ASXUDXsssCyLUXYf3BJBpnQwOGzTPTsyIaHwguOQ/t0waGVDlQ3ey02o27RSLGON1y0tXG8bhKU6gldyZOemD4Og== X-Google-Smtp-Source: AGHT+IFC0XkOiFYysfDmxS3VZJOmO9MjOSTA25ZwwwQrbpAT3u+t5li35+SJ+ICy4O9MKbFlUoTs X-Received: by 2002:ac8:588f:0:b0:441:1354:642b with SMTP id d75a77b69052e-442168ebc60mr18512791cf.25.1718361296538; Fri, 14 Jun 2024 03:34:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718361296; cv=pass; d=google.com; s=arc-20160816; b=zNf+bsybTcciVrkjpovC9PTTo9VPt4zE+KSa4kCsHPzR2CFP0FcADEF2/1QncQ3FFh BAOWj67PYbwojuEHwnVqy3COwl/GFyrRoK96fY81MPG1avujbjYKQcN3majOFZ4Z3uQm ha59BirNHPwxZ0utEiS2JMYGqWOt9aa3PmHeLU8cjlaGbB5ZJuR6+ERK0hyDv0zAlzl/ MN3exxj85r7p2GTKbLc70nlXzRR1ipEFattSkuSUsJB7vHxgWj9a+zg7j71ucUCG4UO4 qy2gHhLwM9yCT8yWANc4yKGBHmbX3yohGdki7Tpztf6B2rmE2h2mTVqpsytRFieETC1m /eIQ== 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=htPyNmOJMca+ZQfEWZmNNVKHQ9JSkZ4LuVaTD0ZYBlw=; fh=1pIfcTc2PIWkfbMcXpEUgJLTwbcBfaYgfz/xmIPVRZ8=; b=pAVunog3ToEsdc83WeEuIp0HK09owJYYq4GE/S615bzCI5TuB5tYxYKkUkQfDhD4LH aUUXI82e0vkVIIGVw7+Sc6mPZ8MhzzVjXVW5f3+wBOIuy1bvFYpqq7FUMk3oR8EnTpRX IRCdctOOU3ozlncDccE2yfQkXTkfWaABW+Ofl0LuKxbuLH8gAfUzfBsFcjrzFupH4XpI BJJ5/VhMyYOe0cYgrH7P9LPi8k+ZtOQGiB6qgivnBoA/I61blWNvbubrGXuxDsCCPjA1 WAkPkGFhZuG5Ie1WX0i76wXGFzQne1os9gqJabYxujsaIFc7ftO4sOJggQ2/QCVrdhnh VUEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=a1D3eZ6X; 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-214793-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214793-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-441f2eaa7b2si37617811cf.385.2024.06.14.03.34.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 03:34:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214793-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=@microchip.com header.s=mchp header.b=a1D3eZ6X; 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-214793-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214793-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 204E51C26BB5 for ; Fri, 14 Jun 2024 10:33:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A9C21940AB; Fri, 14 Jun 2024 10:32:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="a1D3eZ6X" 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 F141D13B5AC for ; Fri, 14 Jun 2024 10:32:17 +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=1718361140; cv=none; b=IFM7lF5GaBbEfJPJlu+WeOVHesvEYG2kPdyhNgF7H0Iz44Z3Zqziu0W0NdRiaW0hdMScoEY71xTtcKX+2bD6vmiMmXSYKYOdsBMDi5stwr5qs/UpmtmQwn977Y7rJePfvLONYyu4GWUBfw/W80EA6MNAyOxw35jXoTtQucvbCcg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718361140; c=relaxed/simple; bh=CfpSNYRxPzF3eP5B/0FeJ6z/uAilyYbezSPoYSHcqWI=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qGdtnmTu8MgjHz3FcgTQhTA684pUAISgSn6GEngoGySNVx4Y0r+aNQT9WpldbxW2ICPu2v5oZofKoZlAtppDou74Bj/XzEJP2KiCkOLKiK+cssy5vIP97GPQjVqPHkoSXkQkaaNloeIDf3uMc1o/Ckrn0Q3HrQA0mCTes4bdG2M= 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=a1D3eZ6X; 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=1718361139; x=1749897139; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=CfpSNYRxPzF3eP5B/0FeJ6z/uAilyYbezSPoYSHcqWI=; b=a1D3eZ6XRytd7y+a1Gf/k49h3xNY71SpOicXuV2EqKiiWPHpHlO9RiOJ fEqZjU1LPhaFISqOEifCrp88q7ZGGGJnbQpwacosrOfY8+ogA6x6S51Bj VHFqkKByzR1r2ZFsGOMjDqj/EunLo1ucU9bvSdK/zGkaYu+YfdOfdEJFv B3Z2tJKHCCI1FWUOGhtKlNz1CBXleeObdTxETUsk2YXXmZXHoiCB/JSEz 5TbRkQG1rvYj7eSJSCIV2EZFrQkTt0aqq1Y4gSlu5KZH2xs+94D0EhsD8 QRgRyPt2RdViqYtvszdD00cklw/hM45u2A2kzsKHBdK705/B46WGKlPkT g==; X-CSE-ConnectionGUID: nFBF+wvcSOK6O7fDHKZSVQ== X-CSE-MsgGUID: F2wRbsnVRvqFmTnNJb1XtA== X-IronPort-AV: E=Sophos;i="6.08,237,1712646000"; d="asc'?scan'208";a="27543976" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 Jun 2024 03:32:17 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) 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; Fri, 14 Jun 2024 03:31:46 -0700 Received: from wendy (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Fri, 14 Jun 2024 03:31:44 -0700 Date: Fri, 14 Jun 2024 11:31:27 +0100 From: Conor Dooley To: Samuel Holland CC: , Palmer Dabbelt , Andrew Jones , Conor Dooley , , Deepak Gupta Subject: Re: [PATCH v2 1/3] riscv: Enable cbo.zero only when all harts support Zicboz Message-ID: <20240614-parasail-lived-b771878e869b@wendy> References: <20240613171447.3176616-1-samuel.holland@sifive.com> <20240613171447.3176616-2-samuel.holland@sifive.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="z5ZL1EgnfI55oztK" Content-Disposition: inline In-Reply-To: <20240613171447.3176616-2-samuel.holland@sifive.com> --z5ZL1EgnfI55oztK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 13, 2024 at 10:14:39AM -0700, Samuel Holland wrote: > Currently, we enable cbo.zero for usermode on each hart that supports > the Zicboz extension. This means that the [ms]envcfg CSR value may > differ between harts. Other features, such as pointer masking and CFI, > require setting [ms]envcfg bits on a per-thread basis. The combination > of these two adds quite some complexity and overhead to context > switching, as we would need to maintain two separate masks for the > per-hart and per-thread bits. Andrew Jones, who originally added Zicboz > support, writes[1][2]: >=20 > I've approached Zicboz the same way I would approach all > extensions, which is to be per-hart. I'm not currently aware of > a platform that is / will be composed of harts where some have > Zicboz and others don't, but there's nothing stopping a platform > like that from being built. >=20 > So, how about we add code that confirms Zicboz is on all harts. > If any hart does not have it, then we complain loudly and disable > it on all the other harts. If it was just a hardware description > bug, then it'll get fixed. If there's actually a platform which > doesn't have Zicboz on all harts, then, when the issue is reported, > we can decide to not support it, support it with defconfig, or > support it under a Kconfig guard which must be enabled by the user. >=20 > Let's follow his suggested solution and require the extension to be > available on all harts, so the envcfg CSR value does not need to change > when a thread migrates between harts. Since we are doing this for all > extensions with fields in envcfg, the CSR itself only needs to be saved/ > restored when it is present on all harts. >=20 > This should not be a regression as no known hardware has asymmetric > Zicboz support, but if anyone reports seeing the warning, we will > re-evaluate our solution. >=20 > Link: https://lore.kernel.org/linux-riscv/20240322-168f191eeb8479b2ea169a= 5e@orel/ [1] > Link: https://lore.kernel.org/linux-riscv/20240323-28943722feb57a41fb0ff4= 88@orel/ [2] > Reviewed-by: Deepak Gupta > Signed-off-by: Samuel Holland Reviewed-by: Conor Dooley --z5ZL1EgnfI55oztK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZmwb/wAKCRB4tDGHoIJi 0ldKAQDTQ/APmkNX8IRH/02s56jNsFUXa0qY9IeWFnaEdYB/GgD/Z0+wxcrVz8Xs /vyJ79gnZtJJN6bFUsf3dif12uOlPgk= =oFvk -----END PGP SIGNATURE----- --z5ZL1EgnfI55oztK--