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 8DDA3C7EE23 for ; Fri, 24 Feb 2023 17:10:17 +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=EwB5vyfrq/7Y1bAa1nRJxLwYlL7LPuD+hB0XioyDxMo=; b=pubqdNNXK/mch/ rjJ0oHwqm5Esl06AJ28XeWTOHZBLkjFUwgCTxbk89qQVETewNhAefe9B5yzetPoBqh0NLPLacRwv5 FCOw/YvthmGYsteNXTJ/t2WgwdMJLSoEDVzPfJ8Tb5zXODugqm+DeNHKqx35of2Daeey2PKOzl8t2 acTFffcVGgqh36rWCwbSl0fQOdH3xllyLdUHi6dLram0gnNVkw7N1l22/Z5j19cJkBM0j1DMKW983 gY/TUrCFGjVo2epUh4ZT2ZsiUP47/65ISyjHSw3BuhAf/75nO8vU2F81DxZqJqCiQPM0gkfW65APf /Y0sNVXZSGYlTK+qX7tw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVbZP-003GA7-3y; Fri, 24 Feb 2023 17:09:19 +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 1pVbZL-003G8v-UI for linux-arm-kernel@lists.infradead.org; Fri, 24 Feb 2023 17:09:17 +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 896A3B81CA3; Fri, 24 Feb 2023 17:09:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DEF7C433D2; Fri, 24 Feb 2023 17:09:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677258552; bh=Y1w4EshUqB89XJSIM3ct+RjFO1wuleJfusWvDBubEOI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mjolz33sGbtlL3j/SfnAgcbX4cBwNc9Y3LhvA4GGXo1ETCq5Fj6muovjPXhHju0Xg F8Pjpm18HrpzkNOtLvtsR3CBbT3jx8ePBN+JsySsOe3Cym5XOEmF/ibL+1QB+YTo0d zgaJKJn+o6JoUtXOhKeyeK+0tp07N2L/D9uuwdUaw9VoBo7nyAFdwchOrmE+7g9msN SXuCpzoPO9ZWXv5P0Fm53sBZpO7ccOhtrbYNgxq5x5PauhsLpOXk4baXxq/IN4iG/6 EZf/YUIk+3iYXQH1T0gWyRC5cVbzT9cypPgiiFsSfZ4PoMB+a5XNx4wFWHjmrIo2sg tLxtbB0C0CZPA== Date: Fri, 24 Feb 2023 17:09:07 +0000 From: Will Deacon To: Catalin Marinas Cc: Richard Henderson , linux-arm-kernel@lists.infradead.org, Alex =?iso-8859-1?Q?Benn=E9e?= , Mark Rutland Subject: Re: Feature request for enabling SCTLR_ELx.nAA Message-ID: <20230224170906.GA30837@willie-the-truck> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230224_090916_162234_449E988D X-CRM114-Status: GOOD ( 25.70 ) 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 Thu, Feb 23, 2023 at 12:15:43PM +0000, Catalin Marinas wrote: > 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. I'd definitely want to see some numbers to justify the complexity of a new prctl(), but otherwise it sounds fine as long as it's opt-in and cleared on exec(). Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel