From: Peter Zijlstra <peterz@infradead.org>
To: Waiman Long <longman@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org,
Pan Xinhui <xinhui@linux.vnet.ibm.com>,
Boqun Feng <boqun.feng@gmail.com>,
Andrea Parri <parri.andrea@gmail.com>,
Will Deacon <will.deacon@arm.com>,
Paul McKenney <paulmck@linux.vnet.ibm.com>
Subject: Re: [RESEND PATCH v5] locking/pvqspinlock: Relax cmpxchg's to improve performance on some archs
Date: Wed, 9 Aug 2017 17:15:33 +0200 [thread overview]
Message-ID: <20170809151533.ipzeu7vmwi5ttcab@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20170809150603.6z43zkxnz3hew3jb@hirez.programming.kicks-ass.net>
On Wed, Aug 09, 2017 at 05:06:03PM +0200, Peter Zijlstra wrote:
> Now, ARM64 for instance plays funny games, it does something along the
> lines of:
>
> cmpxchg(ptr, old, new)
> {
> do {
> r = LL(ptr);
> if (r != old)
> return r; /* no barriers */
> r = new
> } while (SC_release(ptr, r));
> smp_mb();
> return r;
> }
>
> Thereby ordering things relative to the store on ptr, but the load can
> very much escape. The thinking is that if success, we must observe the
> latest value of ptr, but even in that case the load is not ordered and
> could happen before.
>
> However, since we're guaranteed to observe the latest value of ptr (on
> success) it doesn't matter if we reordered the load, there is no newer
> value possible.
>
> So heaps of tricky, but correct afaict. Will?
And could not PPC do something similar:
cmpxchg(ptr, old, new)
{
lwsync();
dp {
r = LL(ptr);
if (r != old)
return;
r = new;
} while (SC(ptr, r));
sync();
return r;
}
?
the lwsync would make it store-release on SC with similar reasoning as
above.
And lwsync allows 'stores reordered after loads', which allows the prior
smp_store_release() to leak past.
Or is the reason this doesn't work on PPC that its RCpc?
next prev parent reply other threads:[~2017-08-09 15:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-24 13:38 Waiman Long
2017-08-09 13:39 ` Waiman Long
2017-08-09 15:06 ` Peter Zijlstra
2017-08-09 15:15 ` Peter Zijlstra [this message]
2017-08-10 8:12 ` Boqun Feng
2017-08-10 9:13 ` Peter Zijlstra
2017-08-10 20:49 ` Paul E. McKenney
2017-08-10 11:50 ` Peter Zijlstra
2017-08-10 13:27 ` Waiman Long
2017-08-10 13:58 ` Waiman Long
2017-08-10 16:15 ` Peter Zijlstra
2017-08-10 16:22 ` Waiman Long
2017-08-10 18:18 ` Waiman Long
2017-08-11 9:06 ` Peter Zijlstra
2017-08-14 12:01 ` Will Deacon
2017-08-14 15:01 ` Waiman Long
2017-08-14 16:02 ` Will Deacon
2017-08-14 18:47 ` Peter Zijlstra
2017-08-15 18:40 ` Will Deacon
2017-08-21 10:55 ` Peter Zijlstra
2017-08-21 18:00 ` Will Deacon
2017-08-21 19:25 ` Peter Zijlstra
2017-08-21 19:42 ` Peter Zijlstra
2017-08-22 15:35 ` Waiman Long
2017-08-22 10:40 ` Will Deacon
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=20170809151533.ipzeu7vmwi5ttcab@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=parri.andrea@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=will.deacon@arm.com \
--cc=xinhui@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®