linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] tools: memory-model: Prepare for data-race detection
@ 2019-04-22 16:17 Alan Stern
  2019-04-24  8:22 ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Stern @ 2019-04-22 16:17 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: LKMM Maintainers -- Akira Yokosawa, Andrea Parri, Boqun Feng,
	Daniel Lustig, David Howells, Jade Alglave, Luc Maranget,
	Nicholas Piggin, Peter Zijlstra, Will Deacon,
	Kernel development list, Joel Fernandes

This patch makes some slight alterations to linux-kernel.cat in
preparation for adding support for data-race detection to the
Linux-Kernel Memory Model.

	The definitions of relations involved in Acquire, Release, and
	unlock-lock ordering are moved up earlier in the source file.

	The rmb relation is factored through the new R4rmb class: the
	class of reads to which rmb will apply.

	The definition of the fence relation is moved earlier, and it
	is split up into read- and write-fences (rmb and wmb) and all
	the others.

This should not make any functional changes.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

---


 tools/memory-model/linux-kernel.cat |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Index: usb-devel/tools/memory-model/linux-kernel.cat
===================================================================
--- usb-devel.orig/tools/memory-model/linux-kernel.cat
+++ usb-devel/tools/memory-model/linux-kernel.cat
@@ -26,8 +26,14 @@ include "lock.cat"
 (* Basic relations *)
 (*******************)
 
+(* Release Acquire *)
+let acq-po = [Acquire] ; po ; [M]
+let po-rel = [M] ; po ; [Release]
+let po-unlock-rf-lock-po = po ; [UL] ; rf ; [LKR] ; po
+
 (* Fences *)
-let rmb = [R \ Noreturn] ; fencerel(Rmb) ; [R \ Noreturn]
+let R4rmb = R \ Noreturn	(* Reads for which rmb works *)
+let rmb = [R4rmb] ; fencerel(Rmb) ; [R4rmb]
 let wmb = [W] ; fencerel(Wmb) ; [W]
 let mb = ([M] ; fencerel(Mb) ; [M]) |
 	([M] ; fencerel(Before-atomic) ; [RMW] ; po? ; [M]) |
@@ -36,13 +42,10 @@ let mb = ([M] ; fencerel(Mb) ; [M]) |
 	([M] ; po ; [UL] ; (co | po) ; [LKW] ;
 		fencerel(After-unlock-lock) ; [M])
 let gp = po ; [Sync-rcu | Sync-srcu] ; po?
-
 let strong-fence = mb | gp
 
-(* Release Acquire *)
-let acq-po = [Acquire] ; po ; [M]
-let po-rel = [M] ; po ; [Release]
-let po-unlock-rf-lock-po = po ; [UL] ; rf ; [LKR] ; po
+let nonrw-fence = strong-fence | po-rel | acq-po
+let fence = nonrw-fence | wmb | rmb
 
 (**********************************)
 (* Fundamental coherence ordering *)
@@ -65,7 +68,6 @@ let rwdep = (dep | ctrl) ; [W]
 let overwrite = co | fr
 let to-w = rwdep | (overwrite & int)
 let to-r = addr | (dep ; rfi)
-let fence = strong-fence | wmb | po-rel | rmb | acq-po
 let ppo = to-r | to-w | fence | (po-unlock-rf-lock-po & int)
 
 (* Propagation: Ordering from release operations and strong fences. *)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] tools: memory-model: Prepare for data-race detection
  2019-04-22 16:17 [PATCH 1/3] tools: memory-model: Prepare for data-race detection Alan Stern
@ 2019-04-24  8:22 ` Paul E. McKenney
  2019-04-24 14:24   ` Alan Stern
  0 siblings, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2019-04-24  8:22 UTC (permalink / raw)
  To: Alan Stern
  Cc: LKMM Maintainers -- Akira Yokosawa, Andrea Parri, Boqun Feng,
	Daniel Lustig, David Howells, Jade Alglave, Luc Maranget,
	Nicholas Piggin, Peter Zijlstra, Will Deacon,
	Kernel development list, Joel Fernandes

On Mon, Apr 22, 2019 at 12:17:45PM -0400, Alan Stern wrote:
> This patch makes some slight alterations to linux-kernel.cat in
> preparation for adding support for data-race detection to the
> Linux-Kernel Memory Model.
> 
> 	The definitions of relations involved in Acquire, Release, and
> 	unlock-lock ordering are moved up earlier in the source file.
> 
> 	The rmb relation is factored through the new R4rmb class: the
> 	class of reads to which rmb will apply.
> 
> 	The definition of the fence relation is moved earlier, and it
> 	is split up into read- and write-fences (rmb and wmb) and all
> 	the others.
> 
> This should not make any functional changes.
> 
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

Thank you, Alan, I have queued all three onto -rcu for review and testing.
FYI, I rebased my smp_mb__{before,after}_atomic() patch on top of yours
to avoid the conflict.

Which demonstrates non-commutativity of patches.  Your patches conflict
with mine, but mine does not conflict with yours.  ;-)

							Thanx, Paul

> ---
> 
> 
>  tools/memory-model/linux-kernel.cat |   16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> Index: usb-devel/tools/memory-model/linux-kernel.cat
> ===================================================================
> --- usb-devel.orig/tools/memory-model/linux-kernel.cat
> +++ usb-devel/tools/memory-model/linux-kernel.cat
> @@ -26,8 +26,14 @@ include "lock.cat"
>  (* Basic relations *)
>  (*******************)
>  
> +(* Release Acquire *)
> +let acq-po = [Acquire] ; po ; [M]
> +let po-rel = [M] ; po ; [Release]
> +let po-unlock-rf-lock-po = po ; [UL] ; rf ; [LKR] ; po
> +
>  (* Fences *)
> -let rmb = [R \ Noreturn] ; fencerel(Rmb) ; [R \ Noreturn]
> +let R4rmb = R \ Noreturn	(* Reads for which rmb works *)
> +let rmb = [R4rmb] ; fencerel(Rmb) ; [R4rmb]
>  let wmb = [W] ; fencerel(Wmb) ; [W]
>  let mb = ([M] ; fencerel(Mb) ; [M]) |
>  	([M] ; fencerel(Before-atomic) ; [RMW] ; po? ; [M]) |
> @@ -36,13 +42,10 @@ let mb = ([M] ; fencerel(Mb) ; [M]) |
>  	([M] ; po ; [UL] ; (co | po) ; [LKW] ;
>  		fencerel(After-unlock-lock) ; [M])
>  let gp = po ; [Sync-rcu | Sync-srcu] ; po?
> -
>  let strong-fence = mb | gp
>  
> -(* Release Acquire *)
> -let acq-po = [Acquire] ; po ; [M]
> -let po-rel = [M] ; po ; [Release]
> -let po-unlock-rf-lock-po = po ; [UL] ; rf ; [LKR] ; po
> +let nonrw-fence = strong-fence | po-rel | acq-po
> +let fence = nonrw-fence | wmb | rmb
>  
>  (**********************************)
>  (* Fundamental coherence ordering *)
> @@ -65,7 +68,6 @@ let rwdep = (dep | ctrl) ; [W]
>  let overwrite = co | fr
>  let to-w = rwdep | (overwrite & int)
>  let to-r = addr | (dep ; rfi)
> -let fence = strong-fence | wmb | po-rel | rmb | acq-po
>  let ppo = to-r | to-w | fence | (po-unlock-rf-lock-po & int)
>  
>  (* Propagation: Ordering from release operations and strong fences. *)
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] tools: memory-model: Prepare for data-race detection
  2019-04-24  8:22 ` Paul E. McKenney
@ 2019-04-24 14:24   ` Alan Stern
  2019-04-24 18:31     ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Stern @ 2019-04-24 14:24 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: LKMM Maintainers -- Akira Yokosawa, Andrea Parri, Boqun Feng,
	Daniel Lustig, David Howells, Jade Alglave, Luc Maranget,
	Nicholas Piggin, Peter Zijlstra, Will Deacon,
	Kernel development list, Joel Fernandes

On Wed, 24 Apr 2019, Paul E. McKenney wrote:

> On Mon, Apr 22, 2019 at 12:17:45PM -0400, Alan Stern wrote:
> > This patch makes some slight alterations to linux-kernel.cat in
> > preparation for adding support for data-race detection to the
> > Linux-Kernel Memory Model.
> > 
> > 	The definitions of relations involved in Acquire, Release, and
> > 	unlock-lock ordering are moved up earlier in the source file.
> > 
> > 	The rmb relation is factored through the new R4rmb class: the
> > 	class of reads to which rmb will apply.
> > 
> > 	The definition of the fence relation is moved earlier, and it
> > 	is split up into read- and write-fences (rmb and wmb) and all
> > 	the others.
> > 
> > This should not make any functional changes.
> > 
> > Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> 
> Thank you, Alan, I have queued all three onto -rcu for review and testing.
> FYI, I rebased my smp_mb__{before,after}_atomic() patch on top of yours
> to avoid the conflict.
> 
> Which demonstrates non-commutativity of patches.  Your patches conflict
> with mine, but mine does not conflict with yours.  ;-)

:-)

Besides, who knows where we'll end up with the 
smp_mb__{before,after}_atomic stuff once Peter is done with it, anyway?

Alan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] tools: memory-model: Prepare for data-race detection
  2019-04-24 14:24   ` Alan Stern
@ 2019-04-24 18:31     ` Paul E. McKenney
  0 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2019-04-24 18:31 UTC (permalink / raw)
  To: Alan Stern
  Cc: LKMM Maintainers -- Akira Yokosawa, Andrea Parri, Boqun Feng,
	Daniel Lustig, David Howells, Jade Alglave, Luc Maranget,
	Nicholas Piggin, Peter Zijlstra, Will Deacon,
	Kernel development list, Joel Fernandes

On Wed, Apr 24, 2019 at 10:24:42AM -0400, Alan Stern wrote:
> On Wed, 24 Apr 2019, Paul E. McKenney wrote:
> 
> > On Mon, Apr 22, 2019 at 12:17:45PM -0400, Alan Stern wrote:
> > > This patch makes some slight alterations to linux-kernel.cat in
> > > preparation for adding support for data-race detection to the
> > > Linux-Kernel Memory Model.
> > > 
> > > 	The definitions of relations involved in Acquire, Release, and
> > > 	unlock-lock ordering are moved up earlier in the source file.
> > > 
> > > 	The rmb relation is factored through the new R4rmb class: the
> > > 	class of reads to which rmb will apply.
> > > 
> > > 	The definition of the fence relation is moved earlier, and it
> > > 	is split up into read- and write-fences (rmb and wmb) and all
> > > 	the others.
> > > 
> > > This should not make any functional changes.
> > > 
> > > Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> > 
> > Thank you, Alan, I have queued all three onto -rcu for review and testing.
> > FYI, I rebased my smp_mb__{before,after}_atomic() patch on top of yours
> > to avoid the conflict.
> > 
> > Which demonstrates non-commutativity of patches.  Your patches conflict
> > with mine, but mine does not conflict with yours.  ;-)
> 
> :-)
> 
> Besides, who knows where we'll end up with the 
> smp_mb__{before,after}_atomic stuff once Peter is done with it, anyway?

True enough!

							Thanx, Paul


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-24 18:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-22 16:17 [PATCH 1/3] tools: memory-model: Prepare for data-race detection Alan Stern
2019-04-24  8:22 ` Paul E. McKenney
2019-04-24 14:24   ` Alan Stern
2019-04-24 18:31     ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).