[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJF2gTSTB7tXooj-7aVQK70rW0a6hKhK3Ljtcnfxjg5eobo8Pw@mail.gmail.com>
Date: Sat, 25 Nov 2023 09:35:21 +0800
From: Guo Ren <guoren@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: mark.rutland@....com, keescook@...omium.org, paulmck@...nel.org,
ubizjak@...il.com, tglx@...utronix.de,
linux-kernel@...r.kernel.org, Guo Ren <guoren@...ux.alibaba.com>
Subject: Re: [PATCH] locking/atomic: Add acquire and release fence for atomic(64)_read(set)
On Sat, Nov 25, 2023 at 12:32 AM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Fri, Nov 24, 2023 at 11:25:08AM -0500, guoren@...nel.org wrote:
> > From: Guo Ren <guoren@...ux.alibaba.com>
> >
> > The definitions of atomic(64)_read(set) are relax version, so
> > add acquire and release fence for them.
> >
> > Signed-off-by: Guo Ren <guoren@...ux.alibaba.com>
> > Signed-off-by: Guo Ren <guoren@...nel.org>
> > ---
>
> You lost the script change?
Sorry, it's my fault. I shouldn't have modify header file directly.
Here is the v2:
https://lore.kernel.org/all/20231125013025.3620560-1-guoren@kernel.org/
>
> > include/linux/atomic/atomic-arch-fallback.h | 14 +++++++++++---
> > 1 file changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/include/linux/atomic/atomic-arch-fallback.h b/include/linux/atomic/atomic-arch-fallback.h
> > index 18f5744dfb5d..9775900eeefd 100644
> > --- a/include/linux/atomic/atomic-arch-fallback.h
> > +++ b/include/linux/atomic/atomic-arch-fallback.h
> > @@ -460,7 +460,10 @@ raw_atomic_read_acquire(const atomic_t *v)
> > #if defined(arch_atomic_read_acquire)
> > return arch_atomic_read_acquire(v);
> > #elif defined(arch_atomic_read)
> > - return arch_atomic_read(v);
> > + int ret;
> > + ret = arch_atomic_read(v);
> > + __atomic_acquire_fence();
> > + return ret;
> > #else
> > int ret;
> >
> > @@ -509,6 +512,7 @@ raw_atomic_set_release(atomic_t *v, int i)
> > #if defined(arch_atomic_set_release)
> > arch_atomic_set_release(v, i);
> > #elif defined(arch_atomic_set)
> > + __atomic_release_fence();
> > arch_atomic_set(v, i);
> > #else
> > if (__native_word(atomic_t)) {
> > @@ -2576,7 +2580,10 @@ raw_atomic64_read_acquire(const atomic64_t *v)
> > #if defined(arch_atomic64_read_acquire)
> > return arch_atomic64_read_acquire(v);
> > #elif defined(arch_atomic64_read)
> > - return arch_atomic64_read(v);
> > + s64 ret;
> > + ret = arch_atomic64_read(v);
> > + __atomic_acquire_fence();
> > + return ret;
> > #else
> > s64 ret;
> >
> > @@ -2625,6 +2632,7 @@ raw_atomic64_set_release(atomic64_t *v, s64 i)
> > #if defined(arch_atomic64_set_release)
> > arch_atomic64_set_release(v, i);
> > #elif defined(arch_atomic64_set)
> > + __atomic_release_fence();
> > arch_atomic64_set(v, i);
> > #else
> > if (__native_word(atomic64_t)) {
> > @@ -4657,4 +4665,4 @@ raw_atomic64_dec_if_positive(atomic64_t *v)
> > }
> >
> > #endif /* _LINUX_ATOMIC_FALLBACK_H */
> > -// 202b45c7db600ce36198eb1f1fc2c2d5268ace2d
> > +// 3135f55051cf62b76664e528bf04337c44a14e72
> > --
> > 2.36.1
> >
--
Best Regards
Guo Ren
Powered by blists - more mailing lists