public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: "Jonas Oberhauser" <jonas.oberhauser@huaweicloud.com>,
	"Alan Stern" <stern@rowland.harvard.edu>,
	linux-kernel@vger.kernel.org, "Boqun Feng" <boqun.feng@gmail.com>,
	"Jade Alglave" <j.alglave@ucl.ac.uk>,
	"Luc Maranget" <luc.maranget@inria.fr>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Will Deacon" <will.deacon@arm.com>,
	"Akira Yokosawa" <akiyks@gmail.com>,
	"Andrea Parri" <parri.andrea@gmail.com>,
	"Daniel Lustig" <dlustig@nvidia.com>,
	"David Howells" <dhowells@redhat.com>,
	"Jonas Oberhauser" <jonas.oberhauser@huawei.com>,
	linux-arch@vger.kernel.org, "Nicholas Piggin" <npiggin@gmail.com>,
	"Paul Heidekrüger" <paul.heidekrueger@in.tum.de>,
	"Will Deacon" <will@kernel.org>
Subject: Re: Litmus test names
Date: Sat, 8 Apr 2023 16:49:56 +0000	[thread overview]
Message-ID: <20230408164956.GA680332@google.com> (raw)
In-Reply-To: <d32901a8-3a07-440c-9089-36b37c3f04e5@paulmck-laptop>

On Fri, Apr 07, 2023 at 05:49:02PM -0700, Paul E. McKenney wrote:
> On Fri, Apr 07, 2023 at 03:05:01PM +0200, Jonas Oberhauser wrote:
> > 
> > 
> > On 4/7/2023 2:12 AM, Joel Fernandes wrote:
> > > 
> > > 
> > > > On Apr 6, 2023, at 6:34 PM, Paul E. McKenney <paulmck@kernel.org> wrote:
> > > > 
> > > > On Thu, Apr 06, 2023 at 05:36:13PM -0400, Alan Stern wrote:
> > > > > Paul:
> > > > > 
> > > > > I just saw that two of the files in
> > > > > tools/memory-model/litmus-tests have
> > > > > almost identical names:
> > > > > 
> > > > >  Z6.0+pooncelock+pooncelock+pombonce.litmus
> > > > >  Z6.0+pooncelock+poonceLock+pombonce.litmus
> > > > > 
> > > > > They differ only by a lower-case 'l' vs. a capital 'L'.  It's
> > > > > not at all
> > > > > easy to see, and won't play well in case-insensitive filesystems.
> > > > > 
> > > > > Should one of them be renamed?
> > > > 
> > > > Quite possibly!
> > > > 
> > > > The "L" denotes smp_mb__after_spinlock().  The only code difference
> > > > between these is that Z6.0+pooncelock+poonceLock+pombonce.litmus has
> > > > smp_mb__after_spinlock() and Z6.0+pooncelock+pooncelock+pombonce.litmus
> > > > does not.
> > > > 
> > > > Suggestions for a better name?  We could capitalize all the letters
> > > > in LOCK, I suppose...
> > 
> > I don't think capitalizing LOCK is helpful.
> 
> Greek font, then?  (Sorry, couldn't resist...)
> 
> > To be honest, almost all the names are extremely cryptic to newcomers like
> > me (like, what does Z6.0 mean? Is it some magic incantation?).
> > And that's not something that's easy to fix.
> 
> All too true on all counts.  Some of the names abbreviate the litmus
> test itself, and there are multiple encodings depending one who/what
> generated the test in question.  Others of the names relate to who came
> up with them or the code from which they are derived.
> 
> New allegedly universal naming schemes have a rather short half-life.
> 
> What would be cool would be a way to structurally compare litmus tests.
> I bet that there are quite a few duplicates, for example.
> 
> > The only use case I can think of for spending time improving the names is
> > that sometimes you wanna say something like "oh, this is like
> > Z6.0+pooncelock+pooncelockmb+pombonce". And then people can look up what
> > that is.
> > For that, it's important that the names are easy to disambiguate by humans,
> > and I think Joel's suggestion is an improvement.
> > (and it also fixes the issue brought up by Alan about case-insensitive file
> > systems)
> > 
> > > 
> > > Z6.0+pooncelock+pooncelockmb+pombonce.litmus ?
> 
> I am OK with this one, but then again, I was also OK with the original
> Z6.0+pooncelock+poonceLock+pombonce.litmus.  ;-)

FWIW, if I move that smp_mb_after..() a step lower, that also makes the test
work (see below).

If you may look over quickly my analysis of why this smp_mb_after..() is
needed, it is because what I marked as a and d below don't have an hb
relation right?

(*
  b ->rf c

  d ->co e

  e ->hb f

  basically the issue is a ->po b ->rf c ->po d    does not imply a ->hb d
*)

P0(int *x, int *y, spinlock_t *mylock)
{
	spin_lock(mylock);
	WRITE_ONCE(*x, 1); // a
	WRITE_ONCE(*y, 1); // b
	spin_unlock(mylock);
}

P1(int *y, int *z, spinlock_t *mylock)
{
	int r0;

	spin_lock(mylock);
	r0 = READ_ONCE(*y); // c
	smp_mb__after_spinlock(); // moving this a bit lower also works fwiw.
	WRITE_ONCE(*z, 1);  // d
	spin_unlock(mylock);
}

P2(int *x, int *z)
{
	int r1;

	WRITE_ONCE(*z, 2);  // e
	smp_mb();
	r1 = READ_ONCE(*x); // f
}

exists (1:r0=1 /\ z=2 /\ 2:r1=0)


> Would someone like to to a "git mv" send the resulting patch?

Yes I can do that in return as I am thankful in advance for the above
discussion. ;)

thanks,

 - Joel


  reply	other threads:[~2023-04-08 16:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 21:36 Litmus test names Alan Stern
2023-04-06 22:34 ` Paul E. McKenney
     [not found]   ` <3908932E-17D4-4B87-AB0C-D10564F10623@joelfernandes.org>
2023-04-07 13:05     ` Jonas Oberhauser
2023-04-08  0:49       ` Paul E. McKenney
2023-04-08 16:49         ` Joel Fernandes [this message]
2023-04-08 18:57           ` Jonas Oberhauser
2023-04-08 20:24             ` Paul E. McKenney
2023-04-09  4:29             ` Joel Fernandes
2023-04-10 10:43 ` David Laight
2023-04-10 13:27   ` 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=20230408164956.GA680332@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=jonas.oberhauser@huawei.com \
    --cc=jonas.oberhauser@huaweicloud.com \
    --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=paul.heidekrueger@in.tum.de \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=stern@rowland.harvard.edu \
    --cc=will.deacon@arm.com \
    --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