From: paulmck@linux.vnet.ibm.com (Paul E. McKenney)
To: linux-riscv@lists.infradead.org
Subject: [RFC PATCH] riscv/locking: Strengthen spin_lock() and spin_unlock()
Date: Thu, 22 Feb 2018 12:02:37 -0800 [thread overview]
Message-ID: <20180222200237.GK2855@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180222182717.GS25181@hirez.programming.kicks-ass.net>
On Thu, Feb 22, 2018 at 07:27:17PM +0100, Peter Zijlstra wrote:
> On Thu, Feb 22, 2018 at 10:13:17AM -0800, Paul E. McKenney wrote:
> > So we have something that is not all that rare in the Linux kernel
> > community, namely two conflicting more-or-less concurrent changes.
> > This clearly needs to be resolved, either by us not strengthening the
> > Linux-kernel memory model in the way we were planning to or by you
> > strengthening RISC-V to be no weaker than PowerPC for these sorts of
> > externally viewed release-acquire situations.
> >
> > Other thoughts?
>
> Like said in the other email, I would _much_ prefer to not go weaker
> than PPC, I find that PPC is already painfully weak at times.
And here are the four PowerPC litmus tests. As expected, a
release-acquire pair within a given process orders everything except
for prior stores against later loads, from the viewpoint of some other
process.
And yes, a few of the filenames are unfortunate.
Thanx, Paul
------------------------------------------------------------------------
PPC MP+o-r-a-o+o-rmb-o
""
(* 22-Feb-2018: ppcmem says "Never" *)
{
0:r1=1; 0:r4=x; 0:r5=y; 0:r6=z;
1:r1=1; 1:r4=x; 1:r5=y; 1:r6=z;
}
P0 | P1 ;
stw r1,0(r4) | lwz r7,0(r6) ;
lwsync | lwsync ;
stw r1,0(r5) | lwz r8,0(r4) ;
lwz r7,0(r5) | ;
lwsync | ;
stw r1,0(r6) | ;
exists
(1:r7=1 /\ 1:r8=0)
------------------------------------------------------------------------
PPC SB+o-r-a-o+o-rmb-o
""
(* 22-Feb-2018: ppcmem says "Sometimes" *)
{
0:r1=1; 0:r4=x; 0:r5=y; 0:r6=z;
1:r1=1; 1:r4=x; 1:r5=y; 1:r6=z;
}
P0 | P1 ;
stw r1,0(r4) | stw r1,0(r6) ;
lwsync | lwsync ;
stw r1,0(r5) | lwz r7,0(r4) ;
lwz r8,0(r5) | ;
lwsync | ;
lwz r7,0(r6) | ;
exists
(0:r7=0 /\ 1:r7=0)
------------------------------------------------------------------------
PPC LB+o-r-a-o+o-rmb-o
""
(* 22-Feb-2018: ppcmem says "Never" *)
{
0:r1=1; 0:r4=x; 0:r5=y; 0:r6=z;
1:r1=1; 1:r4=x; 1:r5=y; 1:r6=z;
}
P0 | P1 ;
lwz r7,0(r4) | lwz r7,0(r6) ;
lwsync | lwsync ;
stw r1,0(r5) | stw r1,0(r4) ;
lwz r8,0(r5) | ;
lwsync | ;
stw r1,0(r6) | ;
exists
(0:r7=1 /\ 1:r7=1)
------------------------------------------------------------------------
PPC MP+o-rmb-o+o-r-a-o.litmus
""
(* 22-Feb-2018: ppcmem says "Never" *)
{
0:r1=1; 0:r4=x; 0:r5=y; 0:r6=z;
1:r1=1; 1:r4=x; 1:r5=y; 1:r6=z;
}
P0 | P1 ;
lwz r7,0(r4) | stw r1,0(r6) ;
lwsync | lwsync ;
stw r1,0(r5) | stw r1,0(r4) ;
lwz r8,0(r5) | ;
lwsync | ;
lwz r9,0(r6) | ;
exists
(0:r7=1 /\ 0:r9=0)
WARNING: multiple messages have this Message-ID (diff)
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Daniel Lustig <dlustig@nvidia.com>,
Andrea Parri <parri.andrea@gmail.com>,
linux-kernel@vger.kernel.org, Palmer Dabbelt <palmer@sifive.com>,
Albert Ou <albert@sifive.com>,
Alan Stern <stern@rowland.harvard.edu>,
Will Deacon <will.deacon@arm.com>,
Boqun Feng <boqun.feng@gmail.com>,
Nicholas Piggin <npiggin@gmail.com>,
David Howells <dhowells@redhat.com>,
Jade Alglave <j.alglave@ucl.ac.uk>,
Luc Maranget <luc.maranget@inria.fr>,
Akira Yokosawa <akiyks@gmail.com>, Ingo Molnar <mingo@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-riscv@lists.infradead.org
Subject: Re: [RFC PATCH] riscv/locking: Strengthen spin_lock() and spin_unlock()
Date: Thu, 22 Feb 2018 12:02:37 -0800 [thread overview]
Message-ID: <20180222200237.GK2855@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180222182717.GS25181@hirez.programming.kicks-ass.net>
On Thu, Feb 22, 2018 at 07:27:17PM +0100, Peter Zijlstra wrote:
> On Thu, Feb 22, 2018 at 10:13:17AM -0800, Paul E. McKenney wrote:
> > So we have something that is not all that rare in the Linux kernel
> > community, namely two conflicting more-or-less concurrent changes.
> > This clearly needs to be resolved, either by us not strengthening the
> > Linux-kernel memory model in the way we were planning to or by you
> > strengthening RISC-V to be no weaker than PowerPC for these sorts of
> > externally viewed release-acquire situations.
> >
> > Other thoughts?
>
> Like said in the other email, I would _much_ prefer to not go weaker
> than PPC, I find that PPC is already painfully weak at times.
And here are the four PowerPC litmus tests. As expected, a
release-acquire pair within a given process orders everything except
for prior stores against later loads, from the viewpoint of some other
process.
And yes, a few of the filenames are unfortunate.
Thanx, Paul
------------------------------------------------------------------------
PPC MP+o-r-a-o+o-rmb-o
""
(* 22-Feb-2018: ppcmem says "Never" *)
{
0:r1=1; 0:r4=x; 0:r5=y; 0:r6=z;
1:r1=1; 1:r4=x; 1:r5=y; 1:r6=z;
}
P0 | P1 ;
stw r1,0(r4) | lwz r7,0(r6) ;
lwsync | lwsync ;
stw r1,0(r5) | lwz r8,0(r4) ;
lwz r7,0(r5) | ;
lwsync | ;
stw r1,0(r6) | ;
exists
(1:r7=1 /\ 1:r8=0)
------------------------------------------------------------------------
PPC SB+o-r-a-o+o-rmb-o
""
(* 22-Feb-2018: ppcmem says "Sometimes" *)
{
0:r1=1; 0:r4=x; 0:r5=y; 0:r6=z;
1:r1=1; 1:r4=x; 1:r5=y; 1:r6=z;
}
P0 | P1 ;
stw r1,0(r4) | stw r1,0(r6) ;
lwsync | lwsync ;
stw r1,0(r5) | lwz r7,0(r4) ;
lwz r8,0(r5) | ;
lwsync | ;
lwz r7,0(r6) | ;
exists
(0:r7=0 /\ 1:r7=0)
------------------------------------------------------------------------
PPC LB+o-r-a-o+o-rmb-o
""
(* 22-Feb-2018: ppcmem says "Never" *)
{
0:r1=1; 0:r4=x; 0:r5=y; 0:r6=z;
1:r1=1; 1:r4=x; 1:r5=y; 1:r6=z;
}
P0 | P1 ;
lwz r7,0(r4) | lwz r7,0(r6) ;
lwsync | lwsync ;
stw r1,0(r5) | stw r1,0(r4) ;
lwz r8,0(r5) | ;
lwsync | ;
stw r1,0(r6) | ;
exists
(0:r7=1 /\ 1:r7=1)
------------------------------------------------------------------------
PPC MP+o-rmb-o+o-r-a-o.litmus
""
(* 22-Feb-2018: ppcmem says "Never" *)
{
0:r1=1; 0:r4=x; 0:r5=y; 0:r6=z;
1:r1=1; 1:r4=x; 1:r5=y; 1:r6=z;
}
P0 | P1 ;
lwz r7,0(r4) | stw r1,0(r6) ;
lwsync | lwsync ;
stw r1,0(r5) | stw r1,0(r4) ;
lwz r8,0(r5) | ;
lwsync | ;
lwz r9,0(r6) | ;
exists
(0:r7=1 /\ 0:r9=0)
next prev parent reply other threads:[~2018-02-22 20:02 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-22 12:19 [RFC PATCH] riscv/locking: Strengthen spin_lock() and spin_unlock() Andrea Parri
2018-02-22 12:19 ` Andrea Parri
2018-02-22 12:44 ` Andrea Parri
2018-02-22 12:44 ` Andrea Parri
2018-02-22 13:40 ` Peter Zijlstra
2018-02-22 13:40 ` Peter Zijlstra
2018-02-22 14:12 ` Andrea Parri
2018-02-22 14:12 ` Andrea Parri
2018-02-22 17:27 ` Daniel Lustig
2018-02-22 17:27 ` Daniel Lustig
2018-02-22 18:13 ` Paul E. McKenney
2018-02-22 18:13 ` Paul E. McKenney
2018-02-22 18:27 ` Peter Zijlstra
2018-02-22 18:27 ` Peter Zijlstra
2018-02-22 19:47 ` Daniel Lustig
2018-02-22 19:47 ` Daniel Lustig
2018-02-23 11:16 ` Andrea Parri
2018-02-23 11:16 ` Andrea Parri
2018-02-26 10:39 ` Will Deacon
2018-02-26 10:39 ` Will Deacon
2018-02-26 14:21 ` Luc Maranget
2018-02-26 14:21 ` Luc Maranget
2018-02-26 16:06 ` Linus Torvalds
2018-02-26 16:06 ` Linus Torvalds
2018-02-26 16:24 ` Will Deacon
2018-02-26 16:24 ` Will Deacon
2018-02-26 17:00 ` Linus Torvalds
2018-02-26 17:00 ` Linus Torvalds
2018-02-26 17:10 ` Will Deacon
2018-02-26 17:10 ` Will Deacon
2018-03-06 13:00 ` Peter Zijlstra
2018-03-06 13:00 ` Peter Zijlstra
2018-02-27 5:06 ` Boqun Feng
2018-02-27 5:06 ` Boqun Feng
2018-02-27 10:16 ` Boqun Feng
2018-02-27 10:16 ` Boqun Feng
2018-03-01 15:11 ` Andrea Parri
2018-03-01 15:11 ` Andrea Parri
2018-03-01 21:54 ` Palmer Dabbelt
2018-03-01 21:54 ` Palmer Dabbelt
2018-03-01 22:21 ` Daniel Lustig
2018-03-01 22:21 ` Daniel Lustig
2018-02-22 20:02 ` Paul E. McKenney [this message]
2018-02-22 20:02 ` Paul E. McKenney
2018-02-22 18:21 ` Peter Zijlstra
2018-02-22 18:21 ` Peter Zijlstra
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=20180222200237.GK2855@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=linux-riscv@lists.infradead.org \
/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.