linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@ozlabs.org, Christopher M Riedl <cmr@informatik.wtf>,
	ajd@linux.ibm.com, bauerman@linux.ibm.com
Subject: Re: [PATCH v2 3/3] powerpc/spinlocks: Fix oops in shared-processor spinlocks
Date: Tue, 6 Aug 2019 10:57:00 -0500	[thread overview]
Message-ID: <20190806155700.GP31406@gate.crashing.org> (raw)
In-Reply-To: <87r25yv6cc.fsf@concordia.ellerman.id.au>

On Tue, Aug 06, 2019 at 10:14:27PM +1000, Michael Ellerman wrote:
> Christopher M Riedl <cmr@informatik.wtf> writes:
> > Yep, and that's no good. Hmm, executing the barrier() in the non-shared-processor
> > case probably hurts performance here?
> 
> It's only a "compiler barrier", so it shouldn't generate any code.
> 
> But it does have the effect of telling the compiler it can't optimise
> across that barrier, which can be important.

This is

#define barrier() __asm__ __volatile__("": : :"memory")

It doesn't tell the compiler "not to optimise" across the barrier.  It
tells the compiler that all memory accesses before the barrier should
stay before it, and all accesses after the barrier should stay after it,
because it says the "barrier" can access and/or change any memory.

This does not tell the hardware not to move those accesses around.  It
also doesn't say anything about things that are not in memory.  Not
everything you think is in memory, is.  What is and isn't in memory can
change during compilation.


[ This message brought to you by the "Stamp Out Optimisation Barrier"
  campaign. ]


Segher

      parent reply	other threads:[~2019-08-06 15:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02  4:22 [PATCH v2 0/3] Fix oops in shared-processor spinlocks Christopher M. Riedl
2019-08-02  4:22 ` [PATCH v2 1/3] powerpc/spinlocks: Refactor SHARED_PROCESSOR Christopher M. Riedl
2019-08-02  4:22 ` [PATCH v2 2/3] powerpc/spinlocks: Rename SPLPAR-only spinlocks Christopher M. Riedl
2019-08-02  4:22 ` [PATCH v2 3/3] powerpc/spinlocks: Fix oops in shared-processor spinlocks Christopher M. Riedl
2019-08-02 11:38   ` Michael Ellerman
2019-08-02 15:12     ` Christopher M Riedl
2019-08-06 12:14       ` Michael Ellerman
2019-08-06 12:31         ` Christopher M Riedl
2019-08-06 15:57         ` Segher Boessenkool [this message]

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=20190806155700.GP31406@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=ajd@linux.ibm.com \
    --cc=bauerman@linux.ibm.com \
    --cc=cmr@informatik.wtf \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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).