[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160422160857.GA3369@insomnia>
Date: Sat, 23 Apr 2016 00:08:57 +0800
From: Boqun Feng <boqun.feng@...il.com>
To: Will Deacon <will.deacon@....com>
Cc: Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org, waiman.long@....com,
mingo@...hat.com, paulmck@...ux.vnet.ibm.com,
torvalds@...ux-foundation.org, dave@...olabs.net
Subject: Re: [RFC][PATCH 3/3] locking,arm64: Introduce cmpwait()
On Tue, Apr 12, 2016 at 05:59:41PM +0100, Will Deacon wrote:
[...]
> > +static inline void __cmpwait(volatile void *ptr, unsigned long val, int size)
> > +{
> > + switch (size) {
> > + case 1: return __cmpwait_case_1(ptr, val);
> > + case 2: return __cmpwait_case_2(ptr, val);
> > + case 4: return __cmpwait_case_4(ptr, val);
> > + case 8: return __cmpwait_case_8(ptr, val);
> > + default: BUILD_BUG();
> > + }
> > +
> > + unreachable();
> > +}
> > +
> > +#define cmpwait(ptr, val) \
> > + __cmpwait((ptr), (unsigned long)(val), sizeof(*(ptr)))
>
> We might want to call this cmpwait_relaxed, in case we decide to add
> fenced versions in the future. Or just make it cmpwait_acquire and
> remove the smp_rmb() from smp_cond_load_acquire(). Dunno.
>
How about replace smp_rmb() with a smp_acquire_barrier__after_cmpwait()?
This barrier is designed to provide an ACQUIRE ordering when combining a
cmpwait() .
And cmpwait() only has minimal ordering guarantee, but if it is actually
an ACQUIRE, then the corresponding smp_acquire_barrier__after_cmpwait()
is just empty.
We might need this special barrier on ppc, because we can implement it
with "isync" given that cmpwait() has control dependency and ctrl+isync
is ACQUIRE on ppc.
Thoughts?
Regards,
Boqun
> Will
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists