All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"paulus@samba.org" <paulus@samba.org>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>
Subject: Re: perf_mmap__write_tail() and control dependencies
Date: Fri, 24 Jul 2015 16:36:20 +0100	[thread overview]
Message-ID: <20150724153620.GF12569@arm.com> (raw)
In-Reply-To: <20150724153316.GL19282@twins.programming.kicks-ass.net>

On Fri, Jul 24, 2015 at 04:33:16PM +0100, Peter Zijlstra wrote:
> On Fri, Jul 24, 2015 at 08:29:05AM -0700, Paul E. McKenney wrote:
> > The ring-buffer code uses control dependencies, and the shiny new
> > READ_ONCE_CTRL() is now in mainline.  I was idly curious about whether
> > the write side could use smp_store_release(), and I found this:
> > 
> > static inline void perf_mmap__write_tail(struct perf_mmap *md, u64 tail)
> > {
> > 	struct perf_event_mmap_page *pc = md->base;
> > 
> > 	/*
> > 	 * ensure all reads are done before we write the tail out.
> > 	 */
> > 	mb();
> > 	pc->data_tail = tail;
> > }
> > 
> > I see mb() rather than smp_mb().  Did I find the correct code for the
> > write side?  If so, why mb() rather than smp_mb()?  To serialize against
> > MMIO interactions with hardware counters or some such?
> 
> This is userspace, it doesn't patch itself depending on if its run on an
> SMP machine or not.

Yup, and that's why mb() expands to dmb instead of dsb in
tools/arch/arm64/include/asm/barrier.h (I see there's an XXX: comment
there asking about the difference).

Will

  parent reply	other threads:[~2015-07-24 15:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 15:29 perf_mmap__write_tail() and control dependencies Paul E. McKenney
2015-07-24 15:33 ` Peter Zijlstra
2015-07-24 15:35   ` Peter Zijlstra
2015-07-24 15:36   ` Will Deacon [this message]
2015-07-24 15:49     ` 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=20150724153620.GF12569@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.