[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201003161159.GA3601096@google.com>
Date: Sat, 3 Oct 2020 12:11:59 -0400
From: joel@...lfernandes.org
To: "Paul E. McKenney" <paulmck@...nel.org>
Cc: Alan Stern <stern@...land.harvard.edu>, parri.andrea@...il.com,
will@...nel.org, peterz@...radead.org, boqun.feng@...il.com,
npiggin@...il.com, dhowells@...hat.com, j.alglave@....ac.uk,
luc.maranget@...ia.fr, akiyks@...il.com, dlustig@...dia.com,
viro@...iv.linux.org.uk, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org
Subject: Re: Litmus test for question from Al Viro
On Sat, Oct 03, 2020 at 12:08:46PM -0400, joel@...lfernandes.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(&v->b))
> r1 = v;
> v->a = 0;
> spin_unlock(l);
>
> *out_0_r1 = !!r1;
> }
>
> static void code1(struct v_struct* v,spinlock_t* l,int* out_1_r1) {
>
> struct v_struct *r1; /* to_free */
>
> r1 = v;
> if (READ_ONCE(v->a)) {
> spin_lock(l);
> if (v->a)
> r1 = NULL;
> smp_store_release(&v->b, 0);
> spin_unlock(l);
> }
>
> *out_1_r1 = !!r1;
> }
>
> Results on both arm64 and x86:
>
> Histogram (2 states)
> 19080852:>0:r1=1; 1:r1=0;
> 20919148:>0:r1=0; 1:r1=1;
> No
>
> Witnesses
> Positive: 0, Negative: 40000000
> Condition exists (0:r1=1 /\ 1:r1=1) is NOT validated
> Hash=4a8c15603ffb5ab464195ea39ccd6382
> Observation AL+test Never 0 40000000
> Time AL+test 6.24
>
> I guess I could do an alloc and free of v_struct. However, I just checked for
> whether the to_free in Al's example could ever be NULL for both threads.
Sorry, here I meant "ever be non-NULL".
So basically I was trying to experimentally confirm that to_free could never
be non-NULL in both code0 and code1 threads.
Powered by blists - more mailing lists