From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 25D3DC636D6 for ; Thu, 23 Feb 2023 12:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1YWYhWBPQGds0PpnjEMSTgizmFRcy7cRX78puzTFshw=; b=KsNXB1isLcnBEB rgoyEanZ1jtRlRdlI7zLzVPH5pADX1AHq2wXntA5/SNlKzEYB1pXXfG6lHEM8gf79eLQe4hLl2qNP XVyMP07JiI/AYGoqs/voeR7Q+G2oniyoqIspzdlOGFTI8749RXX0lpQwrTZbfXxGWKQtAQQqG0E3Y XECvzWZuOxT8Z4JZ7adfAdyao0IP1NXfm+7psmTiJd5/mPM9ZXaVv7wK6Xd1FROfVKSh1mjxTDP9q sxlt+2i6oCtXYFmPXrgZjEciDlR8klQBM8DHnw2Gwn1XqoPpPnjoaDDQ79M11QdvY2acYJtJXnk1e ZoHujEFoXbZFyPzCM7XQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVAVv-00GGjv-Bd; Thu, 23 Feb 2023 12:15:55 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVAVq-00GGjN-I9 for linux-arm-kernel@lists.infradead.org; Thu, 23 Feb 2023 12:15:53 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E1734B81991; Thu, 23 Feb 2023 12:15:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AAB2C433D2; Thu, 23 Feb 2023 12:15:46 +0000 (UTC) Date: Thu, 23 Feb 2023 12:15:43 +0000 From: Catalin Marinas To: Richard Henderson Cc: linux-arm-kernel@lists.infradead.org, Alex =?iso-8859-1?Q?Benn=E9e?= , Will Deacon , Mark Rutland Subject: Re: Feature request for enabling SCTLR_ELx.nAA Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230223_041550_788387_ADAA5137 X-CRM114-Status: GOOD ( 17.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 22, 2023 at 01:17:55PM -1000, Richard Henderson wrote: > It would be helpful to have a prctl for enabling nAA. Since we already have > task->thread.sctlr_user, it would seem that this would not require any > additional overhead during __switch_to(). This shouldn't be difficult to add. > My use case is the QEMU JIT, and being able to make use of LDAR/STLR instead > of explicit DBM in some cases. At the moment, I can only make this > replacement when the address is provably aligned, which is tricky to do with > the time budget of a JIT, so the replacement rarely triggers. This ought to > make a difference when emulating strongly ordered guests like x86. It looks like in 4.17 (commit 7206dc93a58f, "arm64: Expose Arm v8.4 features") we exposed the LSE2 features as HWCAP_USCAT (unaligned single-copy atomicity) but that still restricts LDAR/STLR to a 16-byte boundary as there is no control for SCTLR_EL1.nAA. Given that allowing unaligned accesses could break atomicity, I wouldn't set this bit to 1 permanently, it helps catching tricky software bugs. So a prctl() makes more sense. If your intended use is just preserving the acquire/release semantics, I don't think these are affected by the atomicity rules even if they go across a 16-byte boundary. Adding Will and Mark for their view on this. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel