public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Will Deacon <will.deacon@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	"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 08:49:12 -0700	[thread overview]
Message-ID: <20150724154912.GL3717@linux.vnet.ibm.com> (raw)
In-Reply-To: <20150724153620.GF12569@arm.com>

On Fri, Jul 24, 2015 at 04:36:20PM +0100, Will Deacon wrote:
> 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).

Thank you both!  I will therefore refrain from attempting to restrict
READ_ONCE_CTRL() to pairing with smp_store_release().  ;-)

							Thanx, Paul

      reply	other threads:[~2015-07-24 15:49 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
2015-07-24 15:49     ` Paul E. McKenney [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=20150724154912.GL3717@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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