From: Boqun Feng <boqun.feng@gmail.com>
To: Will Deacon <will.deacon@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, waiman.long@hpe.com,
mingo@redhat.com, paulmck@linux.vnet.ibm.com,
torvalds@linux-foundation.org, dave@stgolabs.net
Subject: Re: [RFC][PATCH 3/3] locking,arm64: Introduce cmpwait()
Date: Sat, 23 Apr 2016 12:02:00 +0800 [thread overview]
Message-ID: <20160423040200.GE3369@insomnia> (raw)
In-Reply-To: <20160422165310.GN10289@arm.com>
[-- Attachment #1: Type: text/plain, Size: 1752 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-04-23 3:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-04 12:22 [RFC][PATCH 0/3] smp_cond_load_acquire + cmpwait Peter Zijlstra
2016-04-04 12:22 ` [RFC][PATCH 1/3] locking: Replace smp_cond_acquire with smp_cond_load_acquire Peter Zijlstra
2016-04-04 18:20 ` Waiman Long
2016-04-04 12:22 ` [RFC][PATCH 2/3] locking/qrwlock: Use smp_cond_load_acquire() Peter Zijlstra
2016-04-12 4:58 ` Davidlohr Bueso
2016-04-12 16:45 ` Waiman Long
2016-04-04 12:22 ` [RFC][PATCH 3/3] locking,arm64: Introduce cmpwait() Peter Zijlstra
2016-04-04 13:12 ` Peter Zijlstra
2016-04-12 16:59 ` Will Deacon
2016-04-13 12:52 ` Peter Zijlstra
2016-04-26 16:33 ` Will Deacon
2016-04-26 17:15 ` Will Deacon
2016-04-26 20:25 ` Peter Zijlstra
2016-04-22 16:08 ` Boqun Feng
2016-04-22 16:53 ` Will Deacon
2016-04-23 4:02 ` Boqun Feng [this message]
2016-04-23 2:37 ` Peter Zijlstra
2016-04-23 3:40 ` Boqun Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160423040200.GE3369@insomnia \
--to=boqun.feng@gmail.com \
--cc=dave@stgolabs.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.org \
--cc=waiman.long@hpe.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.