From: joel@joelfernandes.org
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Alan Stern <stern@rowland.harvard.edu>,
parri.andrea@gmail.com, will@kernel.org, peterz@infradead.org,
boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com,
j.alglave@ucl.ac.uk, luc.maranget@inria.fr, akiyks@gmail.com,
dlustig@nvidia.com, viro@zeniv.linux.org.uk,
linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Re: Litmus test for question from Al Viro
Date: Sat, 3 Oct 2020 12:11:59 -0400 [thread overview]
Message-ID: <20201003161159.GA3601096@google.com> (raw)
In-Reply-To: <20201003160846.GA3598977@google.com>
On Sat, Oct 03, 2020 at 12:08:46PM -0400, joel@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(&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.
next prev parent reply other threads:[~2020-10-03 16:12 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-01 4:51 Litmus test for question from Al Viro Paul E. McKenney
2020-10-01 16:15 ` Alan Stern
2020-10-01 16:36 ` Al Viro
2020-10-01 18:39 ` Alan Stern
2020-10-01 19:29 ` Al Viro
2020-10-01 21:30 ` Paul E. McKenney
2020-10-03 2:01 ` Alan Stern
2020-10-03 13:22 ` Alan Stern
2020-10-03 15:16 ` Akira Yokosawa
2020-10-03 17:13 ` Bug in herd7 [Was: Re: Litmus test for question from Al Viro] Alan Stern
2020-10-03 22:50 ` Akira Yokosawa
2020-10-04 1:40 ` [PATCH] tools: memory-model: Document that the LKMM can easily miss control dependencies Alan Stern
2020-10-04 21:07 ` joel
2020-10-04 23:12 ` Paul E. McKenney
2020-10-05 15:15 ` Bug in herd7 [Was: Re: Litmus test for question from Al Viro] Luc Maranget
2020-10-05 15:53 ` Alan Stern
2020-10-05 16:52 ` Paul E. McKenney
2020-10-05 18:19 ` Alan Stern
2020-10-05 19:18 ` Paul E. McKenney
2020-10-05 19:48 ` Alan Stern
2020-10-06 16:39 ` Paul E. McKenney
2020-10-06 17:05 ` Alan Stern
2020-10-07 17:50 ` Paul E. McKenney
2020-10-07 19:40 ` Alan Stern
2020-10-07 22:38 ` Paul E. McKenney
2020-10-08 2:25 ` Alan Stern
2020-10-08 2:50 ` Paul E. McKenney
2020-10-08 14:01 ` Alan Stern
2020-10-08 18:32 ` Paul E. McKenney
2020-10-05 15:54 ` Paul E. McKenney
2020-10-04 23:31 ` Litmus test for question from Al Viro Paul E. McKenney
2020-10-05 2:38 ` Alan Stern
2020-10-05 8:20 ` Will Deacon
2020-10-05 9:12 ` Will Deacon
2020-10-05 14:01 ` Paul E. McKenney
2020-10-05 14:23 ` Alan Stern
2020-10-05 15:13 ` Will Deacon
2020-10-05 15:16 ` Alan Stern
2020-10-05 15:35 ` Peter Zijlstra
2020-10-05 15:49 ` Paul E. McKenney
2020-10-05 14:16 ` Alan Stern
2020-10-05 14:03 ` Paul E. McKenney
2020-10-05 14:24 ` Alan Stern
2020-10-05 14:44 ` joel
2020-10-05 15:55 ` Paul E. McKenney
2020-10-05 8:36 ` David Laight
2020-10-05 13:59 ` Paul E. McKenney
2020-10-03 16:08 ` joel
2020-10-03 16:11 ` joel [this message]
2020-10-04 23:13 ` Paul E. McKenney
2020-10-03 2:35 ` Jon Masters
2020-10-04 23:32 ` 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=20201003161159.GA3601096@google.com \
--to=joel@joelfernandes.org \
--cc=akiyks@gmail.com \
--cc=boqun.feng@gmail.com \
--cc=dhowells@redhat.com \
--cc=dlustig@nvidia.com \
--cc=j.alglave@ucl.ac.uk \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luc.maranget@inria.fr \
--cc=npiggin@gmail.com \
--cc=parri.andrea@gmail.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=stern@rowland.harvard.edu \
--cc=viro@zeniv.linux.org.uk \
--cc=will@kernel.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 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).