From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F4080236453 for ; Mon, 30 Mar 2026 13:33:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774877622; cv=none; b=SbImuwDmNsz03XS0C798u05EbWqL4GOnwP1vGHbn5Lc5bhZD1Tv0/hyjm3HeO1OA1VDxZ07MzBSF0rv+NQ1NXvpbEsgIn+oOoprca4kE2wLU/JP6nvjGK0u7g92KofB8OlXBd56TQdiBma1w7DsLiMmiaa8bv3E5x8E2Y2DeZ5Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774877622; c=relaxed/simple; bh=p5ZDUVuOYSFOyJ+0E34ls7P96pNOazFqqhnOWLrQAQQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=V+nXAdTimqzr/D02iHFmtsHXNStXaxiQx76mqxy2vboKaHBF1e9DDt0tFnULb1JU7iTPN6d0NhclhOfVK7MJbW+KcUgP41x+lCIVSp8pJK/QAGoZjNPBUNCJNowFtKzg98qXXxJlD+aqZ7kZFWBX2Mg1ojVy2X6VeXYgJpUuR+o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=OAFGAjtP; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="OAFGAjtP" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3D60F1DB5; Mon, 30 Mar 2026 06:33:33 -0700 (PDT) Received: from J2N7QTR9R3 (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CF23D3F7D8; Mon, 30 Mar 2026 06:33:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1774877619; bh=p5ZDUVuOYSFOyJ+0E34ls7P96pNOazFqqhnOWLrQAQQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OAFGAjtPKynVbJo2ym1hWEx2ums6hBQ4jqc81K3JpHqPic+PV9IGhcWR+TfftwLwH JL3zyR7EuI3MqPQKBBsX/tguCKQVQtAMF/vEFeoe1IKAdbtwv804rtPjDQicB8trDi G1pBcLj3D6jYtOxLuYeZ9LmdqjeGZNIAnOTfyyMs= Date: Mon, 30 Mar 2026 14:33:31 +0100 From: Mark Rutland To: Thomas Gleixner Cc: LKML , Mathieu Desnoyers , =?utf-8?B?QW5kcsOo?= Almeida , Sebastian Andrzej Siewior , Carlos O'Donell , Peter Zijlstra , Florian Weimer , Rich Felker , Torvald Riegel , Darren Hart , Ingo Molnar , Davidlohr Bueso , Arnd Bergmann , "Liam R . Howlett" , Uros Bizjak , Thomas =?utf-8?Q?Wei=C3=9Fschuh?= Subject: Re: [patch V3 05/14] uaccess: Provide unsafe_atomic_store_release_user() Message-ID: References: <20260330114212.927686587@kernel.org> <20260330120117.398431176@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260330120117.398431176@kernel.org> On Mon, Mar 30, 2026 at 02:02:25PM +0200, Thomas Gleixner wrote: > The upcoming support for unlocking robust futexes in the kernel requires > store release semantics. Syscalls do not imply memory ordering on all > architectures so the unlock operation requires a barrier. > > This barrier can be avoided when stores imply release like on x86. > > Provide a generic version with a smp_mb() before the unsafe_put_user(), > which can be overridden by architectures. > > Provide also a ARCH_MEMORY_ORDER_TOS Kconfig option, which can be selected > by architectures with Total Store Order (TSO), where store implies release, > so that the smp_mb() in the generic implementation can be avoided. > > Signed-off-by: Thomas Gleixner > Reviewed-by: André Almeida > --- > V3: Rename to CONFIG_ARCH_MEMORY_ORDER_TSO - Peter Looks like this was missed, or applied incompletely? There are a number of uses of "TOS" rather than "TSO", above, below, and in subsequent patches. Mark. > V2: New patch > --- > arch/Kconfig | 4 ++++ > include/linux/uaccess.h | 9 +++++++++ > 2 files changed, 13 insertions(+) > > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -403,6 +403,10 @@ config ARCH_32BIT_OFF_T > config ARCH_32BIT_USTAT_F_TINODE > bool > > +# Selected by architectures with Total Store Order (TOS) > +config ARCH_MEMORY_ORDER_TOS > + bool > + > config HAVE_ASM_MODVERSIONS > bool > help > --- a/include/linux/uaccess.h > +++ b/include/linux/uaccess.h > @@ -644,6 +644,15 @@ static inline void user_access_restore(u > #define user_read_access_end user_access_end > #endif > > +#ifndef unsafe_atomic_store_release_user > +# define unsafe_atomic_store_release_user(val, uptr, elbl) \ > + do { \ > + if (!IS_ENABLED(CONFIG_ARCH_MEMORY_ORDER_TOS)) \ > + smp_mb(); \ > + unsafe_put_user(val, uptr, elbl); \ > + } while (0) > +#endif > + > /* Define RW variant so the below _mode macro expansion works */ > #define masked_user_rw_access_begin(u) masked_user_access_begin(u) > #define user_rw_access_begin(u, s) user_access_begin(u, s) >