Re: [patch v2 04/11] uaccess: Provide unsafe_atomic_store_release_user()

From: Peter Zijlstra

Date: Fri Mar 20 2026 - 05:11:53 EST


On Fri, Mar 20, 2026 at 12:24:25AM +0100, Thomas Gleixner wrote:

> --- 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 when plain stores have release semantics
> +config ARCH_STORE_IMPLIES_RELEASE
> + 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_STORE_IMPLIES_RELEASE)) \
> + 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)

Looking at this again after a sleep; does it make sense to rename this
config symbol to something like ARCH_MEMORY_ORDER_TSO or somesuch?

I mean, this is only going to be the 3 TSO architectures (x86, s390 and
sparc64) setting this anyway, might as well make a little more generic
config symbol for this.

OTOH, its easy enough to rename the config thing if it ever is needed
elsewhere I suppose.