linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Paul McKenney <paulmck@linux.vnet.ibm.com>
Cc: Andrea Parri <parri.andrea@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	priyalee.kushwaha@intel.com, drozdziak1@gmail.com,
	Arnd Bergmann <arnd@arndb.de>,
	ldr709@gmail.com, Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Nicolas Pitre <nico@linaro.org>,
	Krister Johansen <kjlx@templeofstupid.com>,
	Vegard Nossum <vegard.nossum@oracle.com>,
	dcb314@hotmail.com, Wu Fengguang <fengguang.wu@intel.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Rik van Riel <riel@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Luc Maranget <luc.maranget@inria.fr>,
	Jade Alglave <j.alglave@ucl.ac.uk>
Subject: Re: [GIT PULL rcu/next] RCU commits for 4.13
Date: Tue, 27 Jun 2017 14:48:18 -0700	[thread overview]
Message-ID: <CA+55aFzbsT_XC6UJaaXrG9okGOZRvRKgj3hQTAEqdAae4E-X0w@mail.gmail.com> (raw)
In-Reply-To: <20170627205802.GY3721@linux.vnet.ibm.com>

On Tue, Jun 27, 2017 at 1:58 PM, Paul E. McKenney
<paulmck@linux.vnet.ibm.com> wrote:
>
> So what next?
>
> One option would be to weaken the definition of spin_unlock_wait() so
> that it had acquire semantics but not release semantics.  Alternatively,
> we could keep the full empty-critical-section semantics and add memory
> barriers to spin_unlock_wait() implementations, perhaps as shown in the
> patch below.  I could go either way, though I do have some preference
> for the stronger semantics.
>
> Thoughts?

I would prefer to just say

 - document that spin_unlock_wait() has acquire semantics

 - mindlessly add the smp_mb() to all users

 - let users then decide if they are ok with just acquire

That's partly because I think we actually have *fewer* users than we
have implementations of spin_unlock_wait(). So adding a few smp_mb()'s
in the users is actually likely the smaller change.

But it's also because then that allows people who *can* say that
acquire is sufficient to just use it. People who use
spin_unlock_wait() tend to have some odd performance reason to do so,
so I think allowing them to use the more light-weight memory ordering
if it works for them is a good idea.

But finally, it's partly because I think "acquire" semantics are
actually the saner ones that we can explain the logic for much more
clearly.

Basically, acquire semantics means that you are guaranteed to see any
changes that were done inside a previously locked region.

Doesn't that sound like sensible semantics?

Then, the argument for "smp_mb()" (before the spin_unlock_wait()) becomes:

 - I did a write that will affect any future lock takes

 - the smp_mb() now means that that write will be ordered wrt the
acquire that guarantees we've seen all old actions taken by a lock.

Does those kinds of semantics make sense to people?

                Linus

  reply	other threads:[~2017-06-27 21:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-12 21:37 [GIT PULL rcu/next] RCU commits for 4.13 Paul E. McKenney
2017-06-13  6:41 ` Ingo Molnar
2017-06-14  2:54 ` Andrea Parri
2017-06-14  4:33   ` Paul E. McKenney
2017-06-14 14:33     ` Andrea Parri
2017-06-14 20:23       ` Paul E. McKenney
2017-06-19 16:24         ` Andrea Parri
2017-06-27 20:58           ` Paul E. McKenney
2017-06-27 21:48             ` Linus Torvalds [this message]
2017-06-27 23:37               ` Paul E. McKenney
2017-06-28 15:31                 ` Alan Stern
2017-06-28 17:03                   ` Paul E. McKenney
2017-06-28 20:16                     ` Alan Stern
2017-06-28 23:54                       ` Paul E. McKenney
2017-06-29  0:05                         ` Linus Torvalds
2017-06-29  0:45                           ` Paul E. McKenney
2017-06-29  3:17                             ` Boqun Feng
2017-06-29 18:47                               ` Paul E. McKenney
2017-06-29 11:36                             ` Will Deacon
2017-06-29 11:38                           ` Will Deacon
2017-06-29 15:59                             ` Alan Stern
2017-06-29 18:11                               ` Paul E. McKenney
2017-06-30  2:51                                 ` Boqun Feng
2017-06-30  4:02                                   ` Paul E. McKenney
2017-06-30  5:16                                     ` Boqun Feng
2017-06-30 17:31                                       ` Paul E. McKenney
2017-06-29 18:46                             ` 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=CA+55aFzbsT_XC6UJaaXrG9okGOZRvRKgj3hQTAEqdAae4E-X0w@mail.gmail.com \
    --to=torvalds@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=dcb314@hotmail.com \
    --cc=drozdziak1@gmail.com \
    --cc=fengguang.wu@intel.com \
    --cc=fweisbec@gmail.com \
    --cc=j.alglave@ucl.ac.uk \
    --cc=josh@joshtriplett.org \
    --cc=kjlx@templeofstupid.com \
    --cc=ldr709@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luc.maranget@inria.fr \
    --cc=mingo@kernel.org \
    --cc=nico@linaro.org \
    --cc=parri.andrea@gmail.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=priyalee.kushwaha@intel.com \
    --cc=riel@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=stern@rowland.harvard.edu \
    --cc=tglx@linutronix.de \
    --cc=vegard.nossum@oracle.com \
    /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).