From: Boqun Feng <boqun.feng@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Dan Lustig <dlustig@nvidia.com>, Will Deacon <will@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Peter Anvin <hpa@zytor.com>,
Andrea Parri <parri.andrea@gmail.com>,
Ingo Molnar <mingo@kernel.org>,
Vince Weaver <vincent.weaver@maine.edu>,
Thomas Gleixner <tglx@linutronix.de>,
Jiri Olsa <jolsa@redhat.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Stephane Eranian <eranian@google.com>,
palmer@dabbelt.com, paul.walmsley@sifive.com, mpe@ellerman.id.au
Subject: Re: [PATCH] tools/memory-model: Provide extra ordering for unlock+lock pair on the same CPU
Date: Fri, 1 Oct 2021 08:12:56 +0800 [thread overview]
Message-ID: <YVZSiCFAc2RdmeD9@boqun-archlinux> (raw)
In-Reply-To: <20210930204634.GB482974@rowland.harvard.edu>
On Thu, Sep 30, 2021 at 04:46:34PM -0400, Alan Stern wrote:
> On Thu, Sep 30, 2021 at 11:17:53AM -0700, Paul E. McKenney wrote:
> > On Thu, Sep 30, 2021 at 11:20:33AM -0400, Alan Stern wrote:
> > > On Thu, Sep 30, 2021 at 09:08:23PM +0800, Boqun Feng wrote:
> > > > A recent discussion[1] shows that we are in favor of strengthening the
> > > > ordering of unlock + lock on the same CPU: a unlock and a po-after lock
> > > > should provide the so-called RCtso ordering, that is a memory access S
> > > > po-before the unlock should be ordered against a memory access R
> > > > po-after the lock, unless S is a store and R is a load.
> > > >
> > > > The strengthening meets programmers' expection that "sequence of two
> > > > locked regions to be ordered wrt each other" (from Linus), and can
> > > > reduce the mental burden when using locks. Therefore add it in LKMM.
> > > >
> > > > [1]: https://lore.kernel.org/lkml/20210909185937.GA12379@rowland.harvard.edu/
> > > >
> > > > Co-developed-by: Alan Stern <stern@rowland.harvard.edu>
> > > > Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> > > > Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> > > > ---
> > > > Alan,
> > > >
> > > > I added the "Co-developed-by" and "Signed-off-by" tags since most of the
> > > > work is done by you. Feel free to let me know if you want to change
> > > > anything.
> > >
> > > It looks good to me. However, do we really want to add these litmus
> > > tests to the kernel source, or would it be better to keep them with
> > > the thousands of other tests in Paul's archives?
> >
> > Either way works for me. But if they are referred to from within the
> > kernel, it is best to have them in the kernel source. Which might be seen
> > as a reason to minimize referring to litmus tests from the kernel. ;-)
>
> In this case the litmus tests are not referred to within the kernel
> source.
>
I'm OK to drop the litmus tests, but the reason I add the two litmus
tests is that they directly describe one of our memory model rules. The
two litmus tests tells developers "you can use unlock+lock on the same
CPU to order READ->WRITE or WRITE->WRITE", so they are kind of part of
the manual of our memory model. Thoughts?
Regards,
Boqun
> Alan
next prev parent reply other threads:[~2021-10-01 0:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 13:08 [PATCH] tools/memory-model: Provide extra ordering for unlock+lock pair on the same CPU Boqun Feng
2021-09-30 15:20 ` Alan Stern
2021-09-30 18:17 ` Paul E. McKenney
2021-09-30 20:46 ` Alan Stern
2021-10-01 0:12 ` Boqun Feng [this message]
2021-10-01 1:30 ` Alan Stern
2021-10-01 6:03 ` Boqun Feng
2021-10-01 1:19 ` Boqun Feng
2021-10-08 5:30 ` Michael Ellerman
2021-10-08 6:54 ` Boqun Feng
2021-10-08 16:32 ` Palmer Dabbelt
2021-10-10 14:33 ` Boqun Feng
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=YVZSiCFAc2RdmeD9@boqun-archlinux \
--to=boqun.feng@gmail.com \
--cc=acme@redhat.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=dlustig@nvidia.com \
--cc=eranian@google.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=palmer@dabbelt.com \
--cc=parri.andrea@gmail.com \
--cc=paul.walmsley@sifive.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=stern@rowland.harvard.edu \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=vincent.weaver@maine.edu \
--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