From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
jiangshanlai@gmail.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, tglx@linutronix.de, rostedt@goodmis.org,
dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com,
oleg@redhat.com
Subject: Re: [PATCH tip/core/rcu 1/9] rcu: Provide GP ordering in face of migrations and delays
Date: Fri, 6 Oct 2017 12:18:22 -0700 [thread overview]
Message-ID: <20171006191822.GI3521@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171006090723.qbcea5xnwpngrcxi@hirez.programming.kicks-ass.net>
On Fri, Oct 06, 2017 at 11:07:23AM +0200, Peter Zijlstra wrote:
> On Thu, Oct 05, 2017 at 11:22:04AM -0700, Paul E. McKenney wrote:
> > Hmmm... Here is what I was worried about:
> >
> > C C-PaulEMcKenney-W+RWC4+2017-10-05
> >
> > {
> > }
> >
> > P0(int *a, int *x)
> > {
> > WRITE_ONCE(*a, 1);
> > smp_mb(); /* Lock acquisition for rcu_node ->lock. */
> > WRITE_ONCE(*x, 1);
> > }
> >
> > P1(int *x, int *y, spinlock_t *l)
> > {
> > r3 = READ_ONCE(*x);
> > smp_mb(); /* Lock acquisition for rcu_node ->lock. */
> > spin_lock(l); /* Locking in complete(). */
> > WRITE_ONCE(*y, 1);
> > spin_unlock(l);
> > }
> >
> > P2(int *y, int *b, spinlock_t *l)
> > {
> > spin_lock(l); /* Locking in wait_for_completion. */
> > r4 = READ_ONCE(*y);
> > spin_unlock(l);
> > r1 = READ_ONCE(*b);
> > }
> >
> > P3(int *b, int *a)
> > {
> > WRITE_ONCE(*b, 1);
> > smp_mb();
> > r2 = READ_ONCE(*a);
> > }
> >
> > exists (1:r3=1 /\ 2:r4=1 /\ 2:r1=0 /\ 3:r2=0)
>
> /me goes and install this herd thing again.. I'm sure I had it running
> _somewhere_.. A well.
>
> C C-PaulEMcKenney-W+RWC4+2017-10-05
>
> {
> }
>
> P0(int *a, int *x)
> {
> WRITE_ONCE(*a, 1);
> smp_mb(); /* Lock acquisition for rcu_node ->lock. */
> WRITE_ONCE(*x, 1);
> }
>
> P1(int *x, int *y)
> {
> r3 = READ_ONCE(*x);
> smp_mb(); /* Lock acquisition for rcu_node ->lock. */
> smp_store_release(y, 1);
> }
>
> P2(int *y, int *b)
> {
> r4 = smp_load_acquire(y);
> r1 = READ_ONCE(*b);
> }
>
> P3(int *b, int *a)
> {
> WRITE_ONCE(*b, 1);
> smp_mb();
> r2 = READ_ONCE(*a);
> }
>
> exists (1:r3=1 /\ 2:r4=1 /\ 2:r1=0 /\ 3:r2=0)
>
>
> Is what I was thinking of, I think that is the minimal ordering
> complete()/wait_for_completion() need to provide.
OK, I will bite... What do the smp_store_release() and the
smp_load_acquire() correspond to? I see just plain locking in
wait_for_completion() and complete().
> (also, that r# numbering confuses the hell out of me, its not related to
> P nor to the variables)
Yeah, it is random, sorry!!!
> Test C-PaulEMcKenney-W+RWC4+2017-10-05 Allowed
> States 15
> 1:r3=0; 2:r1=0; 2:r4=0; 3:r2=0;
> 1:r3=0; 2:r1=0; 2:r4=0; 3:r2=1;
> 1:r3=0; 2:r1=0; 2:r4=1; 3:r2=0;
> 1:r3=0; 2:r1=0; 2:r4=1; 3:r2=1;
> 1:r3=0; 2:r1=1; 2:r4=0; 3:r2=0;
> 1:r3=0; 2:r1=1; 2:r4=0; 3:r2=1;
> 1:r3=0; 2:r1=1; 2:r4=1; 3:r2=0;
> 1:r3=0; 2:r1=1; 2:r4=1; 3:r2=1;
> 1:r3=1; 2:r1=0; 2:r4=0; 3:r2=0;
> 1:r3=1; 2:r1=0; 2:r4=0; 3:r2=1;
> 1:r3=1; 2:r1=0; 2:r4=1; 3:r2=1;
> 1:r3=1; 2:r1=1; 2:r4=0; 3:r2=0;
> 1:r3=1; 2:r1=1; 2:r4=0; 3:r2=1;
> 1:r3=1; 2:r1=1; 2:r4=1; 3:r2=0;
> 1:r3=1; 2:r1=1; 2:r4=1; 3:r2=1;
> No
> Witnesses
> Positive: 0 Negative: 15
> Condition exists (1:r3=1 /\ 2:r4=1 /\ 2:r1=0 /\ 3:r2=0)
> Observation C-PaulEMcKenney-W+RWC4+2017-10-05 Never 0 15
> Time C-PaulEMcKenney-W+RWC4+2017-10-05 0.04
> Hash=f7f8ad6eab33e90718a394bcb021557d
But yes, looking closer, this corresponds to the rule of thumb about
non-rf relations and full memory barriers. We have two non-rf relations
(P2->P3 and P3->P0), so we need two full barriers, one each between the
non-rf relations.
So I dropped that patch yesterday. The main thing I was missing was
that there is no ordering-free fastpath in wait_for_completion() and
complete(): Each unconditionally acquires the lock. So the smp_mb()
that I was trying to add doesn't need to be there.
Thanx, Paul
next prev parent reply other threads:[~2017-10-06 19:18 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-04 21:29 [PATCH tip/core/rcu 0/9] Miscellaneous fixes for v4.15 Paul E. McKenney
2017-10-04 21:29 ` [PATCH tip/core/rcu 1/9] rcu: Provide GP ordering in face of migrations and delays Paul E. McKenney
2017-10-05 9:41 ` Peter Zijlstra
2017-10-05 14:55 ` Paul E. McKenney
2017-10-05 15:39 ` Peter Zijlstra
2017-10-05 16:19 ` Paul E. McKenney
2017-10-05 16:25 ` Peter Zijlstra
2017-10-05 18:22 ` Paul E. McKenney
2017-10-06 9:07 ` Peter Zijlstra
2017-10-06 19:18 ` Paul E. McKenney [this message]
2017-10-06 20:15 ` Peter Zijlstra
2017-10-07 3:31 ` Paul E. McKenney
2017-10-07 9:29 ` Peter Zijlstra
2017-10-07 18:28 ` Paul E. McKenney
2017-10-09 8:16 ` Peter Zijlstra
2017-10-09 14:37 ` Andrea Parri
2017-10-09 23:15 ` Paul E. McKenney
2017-10-05 13:17 ` Steven Rostedt
2017-10-05 13:40 ` Peter Zijlstra
2017-10-05 14:13 ` Steven Rostedt
2017-10-04 21:29 ` [PATCH tip/core/rcu 2/9] rcu: Fix up pending cbs check in rcu_prepare_for_idle Paul E. McKenney
2017-10-04 21:29 ` [PATCH tip/core/rcu 3/9] rcu: Create call_rcu_tasks() kthread at boot time Paul E. McKenney
2017-10-04 21:29 ` [PATCH tip/core/rcu 4/9] irq_work: Map irq_work_on_queue() to irq_work_on() in !SMP Paul E. McKenney
2017-10-04 21:29 ` [PATCH tip/core/rcu 5/9] srcu: Add parameters to SRCU docbook comments Paul E. McKenney
2017-10-04 21:29 ` [PATCH tip/core/rcu 6/9] sched: Make resched_cpu() unconditional Paul E. McKenney
2017-10-04 21:29 ` [PATCH tip/core/rcu 7/9] rcu: Pretend ->boost_mtx acquired legitimately Paul E. McKenney
2017-10-05 9:50 ` Peter Zijlstra
2017-10-05 15:06 ` Paul E. McKenney
2017-10-04 21:29 ` [PATCH tip/core/rcu 8/9] rcu: Add extended-quiescent-state testing advice Paul E. McKenney
2017-10-04 21:29 ` [PATCH tip/core/rcu 9/9] rcu/segcblist: Include rcupdate.h Paul E. McKenney
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=20171006191822.GI3521@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome