Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-08 Thread Paul E. McKenney
On Thu, Oct 08, 2020 at 10:01:48AM -0400, Alan Stern wrote: > On Wed, Oct 07, 2020 at 07:50:25PM -0700, Paul E. McKenney wrote: > > There are some distractions at the moment. > > > > Please see below. If this is not exactly correct, I will use "git rm" > > and let you submit the patch as you

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-08 Thread Alan Stern
On Wed, Oct 07, 2020 at 07:50:25PM -0700, Paul E. McKenney wrote: > There are some distractions at the moment. > > Please see below. If this is not exactly correct, I will use "git rm" > and let you submit the patch as you wish. > > Thanx, Paul > >

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-07 Thread Paul E. McKenney
On Wed, Oct 07, 2020 at 10:25:37PM -0400, Alan Stern wrote: > On Wed, Oct 07, 2020 at 03:38:51PM -0700, Paul E. McKenney wrote: > > On Wed, Oct 07, 2020 at 03:40:50PM -0400, Alan Stern wrote: > > > On Wed, Oct 07, 2020 at 10:50:40AM -0700, Paul E. McKenney wrote: > > > > And here is the updated

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-07 Thread Alan Stern
On Wed, Oct 07, 2020 at 03:38:51PM -0700, Paul E. McKenney wrote: > On Wed, Oct 07, 2020 at 03:40:50PM -0400, Alan Stern wrote: > > On Wed, Oct 07, 2020 at 10:50:40AM -0700, Paul E. McKenney wrote: > > > And here is the updated version. > > > > > >

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-07 Thread Paul E. McKenney
On Wed, Oct 07, 2020 at 03:40:50PM -0400, Alan Stern wrote: > On Wed, Oct 07, 2020 at 10:50:40AM -0700, Paul E. McKenney wrote: > > And here is the updated version. > > > > Thanx, Paul > > > >

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-07 Thread Alan Stern
On Wed, Oct 07, 2020 at 10:50:40AM -0700, Paul E. McKenney wrote: > And here is the updated version. > > Thanx, Paul > > > > commit

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-07 Thread Paul E. McKenney
On Tue, Oct 06, 2020 at 01:05:25PM -0400, Alan Stern wrote: > On Tue, Oct 06, 2020 at 09:39:54AM -0700, Paul E. McKenney wrote: > > On Mon, Oct 05, 2020 at 03:48:34PM -0400, Alan Stern wrote: > > > On Mon, Oct 05, 2020 at 12:18:01PM -0700, Paul E. McKenney wrote: > > > > Aside from naming and

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-06 Thread Alan Stern
On Tue, Oct 06, 2020 at 09:39:54AM -0700, Paul E. McKenney wrote: > On Mon, Oct 05, 2020 at 03:48:34PM -0400, Alan Stern wrote: > > On Mon, Oct 05, 2020 at 12:18:01PM -0700, Paul E. McKenney wrote: > > > Aside from naming and comment, how about my adding the following? > > > > > >

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-06 Thread Paul E. McKenney
On Mon, Oct 05, 2020 at 03:48:34PM -0400, Alan Stern wrote: > On Mon, Oct 05, 2020 at 12:18:01PM -0700, Paul E. McKenney wrote: > > Aside from naming and comment, how about my adding the following? > > > > Thanx, Paul > > > >

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-05 Thread Alan Stern
On Mon, Oct 05, 2020 at 12:18:01PM -0700, Paul E. McKenney wrote: > Aside from naming and comment, how about my adding the following? > > Thanx, Paul > > > > C

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-05 Thread Paul E. McKenney
On Mon, Oct 05, 2020 at 02:19:49PM -0400, Alan Stern wrote: > On Mon, Oct 05, 2020 at 09:52:23AM -0700, Paul E. McKenney wrote: > > On Mon, Oct 05, 2020 at 11:53:10AM -0400, Alan Stern wrote: > > > I tested the new commit -- it does indeed fix the problem. > > > > Beat me to it, very good! ;-) >

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-05 Thread Alan Stern
On Mon, Oct 05, 2020 at 09:52:23AM -0700, Paul E. McKenney wrote: > On Mon, Oct 05, 2020 at 11:53:10AM -0400, Alan Stern wrote: > > I tested the new commit -- it does indeed fix the problem. > > Beat me to it, very good! ;-) > > But were you using the crypto-control-data litmus test? I was

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-05 Thread Paul E. McKenney
On Mon, Oct 05, 2020 at 11:53:10AM -0400, Alan Stern wrote: > On Mon, Oct 05, 2020 at 05:15:57PM +0200, Luc Maranget wrote: > > > On Sun, Oct 04, 2020 at 12:16:31AM +0900, Akira Yokosawa wrote: > > > > > P1(int *x, int *y) > > > > > { > > > > > WRITE_ONCE(*x, READ_ONCE(*y)); > > > > > > > >

Re: Litmus test for question from Al Viro

2020-10-05 Thread Paul E. McKenney
On Mon, Oct 05, 2020 at 10:44:22AM -0400, j...@joelfernandes.org wrote: > On Mon, Oct 05, 2020 at 07:03:53AM -0700, Paul E. McKenney wrote: > > On Sun, Oct 04, 2020 at 10:38:46PM -0400, Alan Stern wrote: > > > On Sun, Oct 04, 2020 at 04:31:46PM -0700, Paul E. McKenney wrote: > > > > Nice simple

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-05 Thread Paul E. McKenney
On Mon, Oct 05, 2020 at 05:15:57PM +0200, Luc Maranget wrote: > > On Sun, Oct 04, 2020 at 12:16:31AM +0900, Akira Yokosawa wrote: > > > Hi Alan, > > > > > > Just a minor nit in the litmus test. > > > > > > On Sat, 3 Oct 2020 09:22:12 -0400, Alan Stern wrote: > > > > To expand on my statement

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-05 Thread Alan Stern
On Mon, Oct 05, 2020 at 05:15:57PM +0200, Luc Maranget wrote: > > On Sun, Oct 04, 2020 at 12:16:31AM +0900, Akira Yokosawa wrote: > > > > P1(int *x, int *y) > > > > { > > > > WRITE_ONCE(*x, READ_ONCE(*y)); > > > > > > Looks like this one-liner doesn't provide data-dependency of y -> x on

Re: Litmus test for question from Al Viro

2020-10-05 Thread Paul E. McKenney
On Mon, Oct 05, 2020 at 05:35:19PM +0200, Peter Zijlstra wrote: > On Mon, Oct 05, 2020 at 11:16:39AM -0400, Alan Stern wrote: > > On Mon, Oct 05, 2020 at 04:13:13PM +0100, Will Deacon wrote: > > > > The failure to recognize the dependency in P0 should be considered a > > > > combined limitation

Re: Litmus test for question from Al Viro

2020-10-05 Thread Peter Zijlstra
On Mon, Oct 05, 2020 at 11:16:39AM -0400, Alan Stern wrote: > On Mon, Oct 05, 2020 at 04:13:13PM +0100, Will Deacon wrote: > > > The failure to recognize the dependency in P0 should be considered a > > > combined limitation of the memory model and herd7. It's not a simple > > > mistake that can

Re: Litmus test for question from Al Viro

2020-10-05 Thread Alan Stern
On Mon, Oct 05, 2020 at 04:13:13PM +0100, Will Deacon wrote: > > The failure to recognize the dependency in P0 should be considered a > > combined limitation of the memory model and herd7. It's not a simple > > mistake that can be fixed by a small rewrite of herd7; rather it's a > > deliberate

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-05 Thread Luc Maranget
> On Sun, Oct 04, 2020 at 12:16:31AM +0900, Akira Yokosawa wrote: > > Hi Alan, > > > > Just a minor nit in the litmus test. > > > > On Sat, 3 Oct 2020 09:22:12 -0400, Alan Stern wrote: > > > To expand on my statement about the LKMM's weakness regarding control > > > constructs, here is a litmus

Re: Litmus test for question from Al Viro

2020-10-05 Thread Will Deacon
On Mon, Oct 05, 2020 at 10:23:51AM -0400, Alan Stern wrote: > On Mon, Oct 05, 2020 at 10:12:48AM +0100, Will Deacon wrote: > > On Mon, Oct 05, 2020 at 09:20:03AM +0100, Will Deacon wrote: > > > On Sun, Oct 04, 2020 at 10:38:46PM -0400, Alan Stern wrote: > > > > Considering the bug in herd7 pointed

Re: Litmus test for question from Al Viro

2020-10-05 Thread joel
On Mon, Oct 05, 2020 at 07:03:53AM -0700, Paul E. McKenney wrote: > On Sun, Oct 04, 2020 at 10:38:46PM -0400, Alan Stern wrote: > > On Sun, Oct 04, 2020 at 04:31:46PM -0700, Paul E. McKenney wrote: > > > Nice simple example! How about like this? > > > > > >

Re: Litmus test for question from Al Viro

2020-10-05 Thread Alan Stern
On Mon, Oct 05, 2020 at 07:03:53AM -0700, Paul E. McKenney wrote: > Updated as suggested by Will, like this? > > Thanx, Paul > > > > commit

Re: Litmus test for question from Al Viro

2020-10-05 Thread Alan Stern
On Mon, Oct 05, 2020 at 10:12:48AM +0100, Will Deacon wrote: > On Mon, Oct 05, 2020 at 09:20:03AM +0100, Will Deacon wrote: > > On Sun, Oct 04, 2020 at 10:38:46PM -0400, Alan Stern wrote: > > > Considering the bug in herd7 pointed out by Akira, we should rewrite P1 > > > as: > > > > > > P1(int

Re: Litmus test for question from Al Viro

2020-10-05 Thread Alan Stern
On Mon, Oct 05, 2020 at 09:20:03AM +0100, Will Deacon wrote: > On Sun, Oct 04, 2020 at 10:38:46PM -0400, Alan Stern wrote: > > Considering the bug in herd7 pointed out by Akira, we should rewrite P1 as: > > > > P1(int *x, int *y) > > { > > int r2; > > > > r = READ_ONCE(*y); > > (r2?)

Re: Litmus test for question from Al Viro

2020-10-05 Thread Paul E. McKenney
On Sun, Oct 04, 2020 at 10:38:46PM -0400, Alan Stern wrote: > On Sun, Oct 04, 2020 at 04:31:46PM -0700, Paul E. McKenney wrote: > > Nice simple example! How about like this? > > > > Thanx, Paul > > > >

Re: Litmus test for question from Al Viro

2020-10-05 Thread Paul E. McKenney
On Mon, Oct 05, 2020 at 10:12:48AM +0100, Will Deacon wrote: > On Mon, Oct 05, 2020 at 09:20:03AM +0100, Will Deacon wrote: > > On Sun, Oct 04, 2020 at 10:38:46PM -0400, Alan Stern wrote: > > > On Sun, Oct 04, 2020 at 04:31:46PM -0700, Paul E. McKenney wrote: > > > > Nice simple example! How

Re: Litmus test for question from Al Viro

2020-10-05 Thread Paul E. McKenney
On Mon, Oct 05, 2020 at 08:36:51AM +, David Laight wrote: > From: Paul E. McKenney > > Sent: 05 October 2020 00:32 > ... > > manual/kernel: Add a litmus test with a hidden dependency > > > > This commit adds a litmus test that has a data dependency that can be > > hidden by

Re: Litmus test for question from Al Viro

2020-10-05 Thread Will Deacon
On Mon, Oct 05, 2020 at 09:20:03AM +0100, Will Deacon wrote: > On Sun, Oct 04, 2020 at 10:38:46PM -0400, Alan Stern wrote: > > On Sun, Oct 04, 2020 at 04:31:46PM -0700, Paul E. McKenney wrote: > > > Nice simple example! How about like this? > > > > > >

RE: Litmus test for question from Al Viro

2020-10-05 Thread David Laight
From: Paul E. McKenney > Sent: 05 October 2020 00:32 ... > manual/kernel: Add a litmus test with a hidden dependency > > This commit adds a litmus test that has a data dependency that can be > hidden by control flow. In this test, both the taken and the not-taken > branches of an

Re: Litmus test for question from Al Viro

2020-10-05 Thread Will Deacon
On Sun, Oct 04, 2020 at 10:38:46PM -0400, Alan Stern wrote: > On Sun, Oct 04, 2020 at 04:31:46PM -0700, Paul E. McKenney wrote: > > Nice simple example! How about like this? > > > > Thanx, Paul > > > >

Re: Litmus test for question from Al Viro

2020-10-04 Thread Alan Stern
On Sun, Oct 04, 2020 at 04:31:46PM -0700, Paul E. McKenney wrote: > Nice simple example! How about like this? > > Thanx, Paul > > > > commit

Re: Litmus test for question from Al Viro

2020-10-04 Thread Paul E. McKenney
On Fri, Oct 02, 2020 at 10:35:45PM -0400, Jon Masters wrote: > On 10/1/20 12:15 PM, Alan Stern wrote: > > On Wed, Sep 30, 2020 at 09:51:16PM -0700, Paul E. McKenney wrote: > > > Hello! > > > > > > Al Viro posted the following query: > > > > > >

Re: Litmus test for question from Al Viro

2020-10-04 Thread Paul E. McKenney
On Sat, Oct 03, 2020 at 09:22:12AM -0400, Alan Stern wrote: > To expand on my statement about the LKMM's weakness regarding control > constructs, here is a litmus test to illustrate the issue. You might > want to add this to one of the archives. > > Alan > > C crypto-control-data > (* > * LB

Re: Litmus test for question from Al Viro

2020-10-04 Thread Paul E. McKenney
On Sat, Oct 03, 2020 at 12:11:59PM -0400, j...@joelfernandes.org wrote: > On Sat, Oct 03, 2020 at 12:08:46PM -0400, j...@joelfernandes.org wrote: > [...] > > static void code0(struct v_struct* v,spinlock_t* l,int* out_0_r1) { > > > > struct v_struct *r1; /* to_free */ > > > > r1

Re: Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-03 Thread Akira Yokosawa
On Sat, 3 Oct 2020 13:13:38 -0400, Alan Stern wrote: > On Sun, Oct 04, 2020 at 12:16:31AM +0900, Akira Yokosawa wrote: >> Hi Alan, >> >> Just a minor nit in the litmus test. >> >> On Sat, 3 Oct 2020 09:22:12 -0400, Alan Stern wrote: >>> To expand on my statement about the LKMM's weakness regarding

Bug in herd7 [Was: Re: Litmus test for question from Al Viro]

2020-10-03 Thread Alan Stern
On Sun, Oct 04, 2020 at 12:16:31AM +0900, Akira Yokosawa wrote: > Hi Alan, > > Just a minor nit in the litmus test. > > On Sat, 3 Oct 2020 09:22:12 -0400, Alan Stern wrote: > > To expand on my statement about the LKMM's weakness regarding control > > constructs, here is a litmus test to

Re: Litmus test for question from Al Viro

2020-10-03 Thread joel
On Sat, Oct 03, 2020 at 12:08:46PM -0400, j...@joelfernandes.org wrote: [...] > static void code0(struct v_struct* v,spinlock_t* l,int* out_0_r1) { > > struct v_struct *r1; /* to_free */ > > r1 = NULL; > spin_lock(l); > if (!smp_load_acquire(>b)) >

Re: Litmus test for question from Al Viro

2020-10-03 Thread joel
On Thu, Oct 01, 2020 at 02:30:48PM -0700, Paul E. McKenney wrote: > On Thu, Oct 01, 2020 at 12:15:29PM -0400, Alan Stern wrote: > > On Wed, Sep 30, 2020 at 09:51:16PM -0700, Paul E. McKenney wrote: > > > Hello! > > > > > > Al Viro posted the following query: > > > > > >

Re: Litmus test for question from Al Viro

2020-10-03 Thread Akira Yokosawa
Hi Alan, Just a minor nit in the litmus test. On Sat, 3 Oct 2020 09:22:12 -0400, Alan Stern wrote: > To expand on my statement about the LKMM's weakness regarding control > constructs, here is a litmus test to illustrate the issue. You might > want to add this to one of the archives. > >

Re: Litmus test for question from Al Viro

2020-10-03 Thread Alan Stern
To expand on my statement about the LKMM's weakness regarding control constructs, here is a litmus test to illustrate the issue. You might want to add this to one of the archives. Alan C crypto-control-data (* * LB plus crypto-control-data plus data * * Expected result: allowed * * This

Re: Litmus test for question from Al Viro

2020-10-02 Thread Jon Masters
On 10/1/20 12:15 PM, Alan Stern wrote: On Wed, Sep 30, 2020 at 09:51:16PM -0700, Paul E. McKenney wrote: Hello! Al Viro posted the following query: fun question regarding barriers, if you have time for that

Re: Litmus test for question from Al Viro

2020-10-02 Thread Alan Stern
On Thu, Oct 01, 2020 at 02:30:48PM -0700, Paul E. McKenney wrote: > > Not the way I would have done it, but okay. I would have modeled the > > kfree by setting a and b both to some sentinel value. > > Might be well worth pursuing! But how would you model the address > dependencies in that

Re: Litmus test for question from Al Viro

2020-10-01 Thread Paul E. McKenney
On Thu, Oct 01, 2020 at 12:15:29PM -0400, Alan Stern wrote: > On Wed, Sep 30, 2020 at 09:51:16PM -0700, Paul E. McKenney wrote: > > Hello! > > > > Al Viro posted the following query: > > > > > > > > fun question regarding

Re: Litmus test for question from Al Viro

2020-10-01 Thread Al Viro
On Thu, Oct 01, 2020 at 02:39:25PM -0400, Alan Stern wrote: > The problem with a plain write is that it isn't guaranteed to be atomic > in any sense. In principle, the compiler could generate code for CPU1 > which would write 0 to V->A more than once. > > Although I strongly doubt that any

Re: Litmus test for question from Al Viro

2020-10-01 Thread Alan Stern
On Thu, Oct 01, 2020 at 05:36:46PM +0100, Al Viro wrote: > On Thu, Oct 01, 2020 at 12:15:29PM -0400, Alan Stern wrote: > > > CPU1: > > > to_free = NULL > > > spin_lock() > > > if (!smp_load_acquire(>B)) > > > to_free = V > > > V->A = 0 > > >

Re: Litmus test for question from Al Viro

2020-10-01 Thread Al Viro
On Thu, Oct 01, 2020 at 12:15:29PM -0400, Alan Stern wrote: > > CPU1: > > to_free = NULL > > spin_lock() > > if (!smp_load_acquire(>B)) > > to_free = V > > V->A = 0 > > spin_unlock() > > kfree(to_free) > > > > CPU2: > >

Re: Litmus test for question from Al Viro

2020-10-01 Thread Alan Stern
On Wed, Sep 30, 2020 at 09:51:16PM -0700, Paul E. McKenney wrote: > Hello! > > Al Viro posted the following query: > > > > fun question regarding barriers, if you have time for that > V->A = V->B = 1; > > CPU1:

Litmus test for question from Al Viro

2020-09-30 Thread Paul E. McKenney
Hello! Al Viro posted the following query: fun question regarding barriers, if you have time for that V->A = V->B = 1; CPU1: to_free = NULL spin_lock() if (!smp_load_acquire(>B))