Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1385569
| From | Boqun Feng <boqun.feng@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC][PATCH 3/3] locking,arm64: Introduce cmpwait() |
| Date | 2016-04-23 06:00 +0200 |
| Message-ID | <rqWTE-4PU-3@gated-at.bofh.it> (permalink) |
| References | <rkbXs-31q-9@gated-at.bofh.it> <rkbXs-31q-7@gated-at.bofh.it> <rn9Ps-27p-23@gated-at.bofh.it> <rqLOy-4Dw-15@gated-at.bofh.it> <rqMAV-542-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Fri, Apr 22, 2016 at 05:53:11PM +0100, Will Deacon wrote:
> On Sat, Apr 23, 2016 at 12:08:57AM +0800, Boqun Feng wrote:
> > 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.
>
> Maybe, but that makes it difficult for me to use a load-acquire instruction
> for the ACQUIRE case.
>
You're right. I was missting that point. Please ignore this proposal.
So I think having a cmpwait_relaxed makes more sense for the people
knowing they could only rely on the control dependency? Or we actually
don't want to encourage this kind of people ;-)
Regards,
Boqun
> Will
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [RFC][PATCH 3/3] locking,arm64: Introduce cmpwait() Boqun Feng <boqun.feng@gmail.com> - 2016-04-22 18:10 +0200
Re: [RFC][PATCH 3/3] locking,arm64: Introduce cmpwait() Will Deacon <will.deacon@arm.com> - 2016-04-22 19:00 +0200
Re: [RFC][PATCH 3/3] locking,arm64: Introduce cmpwait() Boqun Feng <boqun.feng@gmail.com> - 2016-04-23 06:00 +0200
Re: [RFC][PATCH 3/3] locking,arm64: Introduce cmpwait() Peter Zijlstra <peterz@infradead.org> - 2016-04-23 04:40 +0200
Re: [RFC][PATCH 3/3] locking,arm64: Introduce cmpwait() Boqun Feng <boqun.feng@gmail.com> - 2016-04-23 05:40 +0200
csiph-web