public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Will Deacon <will.deacon@arm.com>,
	linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [RESEND PATCH] documentation: memory-barriers: fix smp_mb__before_spinlock() semantics
Date: Wed, 1 Apr 2015 17:50:55 +0200	[thread overview]
Message-ID: <20150401155055.GC30586@redhat.com> (raw)
In-Reply-To: <20150401153108.GQ9023@linux.vnet.ibm.com>

On 04/01, Paul E. McKenney wrote:
>
> If Will agrees, like the following?

Looks good to me, thanks ;)

>     documentation: memory-barriers: Fix smp_mb__before_spinlock() semantics
>
>     Our current documentation claims that, when followed by an ACQUIRE,
>     smp_mb__before_spinlock() orders prior loads against subsequent loads
>     and stores, which isn't the intent.  This commit therefore fixes the
>     documentation to state that this sequence orders only prior stores
>     against subsequent loads and stores.
>
>     In addition, the original intent of smp_mb__before_spinlock() was to only
>     order prior loads against subsequent stores, however, people have started
>     using it as if it ordered prior loads against subsequent loads and stores.
>     This commit therefore also updates smp_mb__before_spinlock()'s header
>     comment to reflect this new reality.
>
>     Cc: Oleg Nesterov <oleg@redhat.com>
>     Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
>     Cc: Peter Zijlstra <peterz@infradead.org>
>     Signed-off-by: Will Deacon <will.deacon@arm.com>
>     Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
>
> diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
> index 6974f1c2b4e1..52c320e3f107 100644
> --- a/Documentation/memory-barriers.txt
> +++ b/Documentation/memory-barriers.txt
> @@ -1784,10 +1784,9 @@ for each construct.  These operations all imply certain barriers:
>
>       Memory operations issued before the ACQUIRE may be completed after
>       the ACQUIRE operation has completed.  An smp_mb__before_spinlock(),
> -     combined with a following ACQUIRE, orders prior loads against
> -     subsequent loads and stores and also orders prior stores against
> -     subsequent stores.  Note that this is weaker than smp_mb()!  The
> -     smp_mb__before_spinlock() primitive is free on many architectures.
> +     combined with a following ACQUIRE, orders prior stores against
> +     subsequent loads and stores. Note that this is weaker than smp_mb()!
> +     The smp_mb__before_spinlock() primitive is free on many architectures.
>
>   (2) RELEASE operation implication:
>
> diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
> index 3e18379dfa6f..0063b24b4f36 100644
> --- a/include/linux/spinlock.h
> +++ b/include/linux/spinlock.h
> @@ -120,7 +120,7 @@ do {								\
>  /*
>   * Despite its name it doesn't necessarily has to be a full barrier.
>   * It should only guarantee that a STORE before the critical section
> - * can not be reordered with a LOAD inside this section.
> + * can not be reordered with LOADs and STOREs inside this section.
>   * spin_lock() is the one-way barrier, this LOAD can not escape out
>   * of the region. So the default implementation simply ensures that
>   * a STORE can not move into the critical section, smp_wmb() should
>


  reply	other threads:[~2015-04-01 15:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31  8:39 [RESEND PATCH] documentation: memory-barriers: fix smp_mb__before_spinlock() semantics Will Deacon
2015-03-31 17:50 ` Oleg Nesterov
2015-04-01 15:31   ` Paul E. McKenney
2015-04-01 15:50     ` Oleg Nesterov [this message]
2015-04-01 16:13       ` Will Deacon
2015-04-01 16:27         ` Paul E. McKenney
2015-04-01 15:26 ` 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=20150401155055.GC30586@redhat.com \
    --to=oleg@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=will.deacon@arm.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