lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150724153545.GN18673@twins.programming.kicks-ass.net>
Date:	Fri, 24 Jul 2015 17:35:45 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc:	will.deacon@....com, linux-kernel@...r.kernel.org,
	linux-arch@...r.kernel.org, paulus@...ba.org, rostedt@...dmis.org
Subject: Re: perf_mmap__write_tail() and control dependencies

On Fri, Jul 24, 2015 at 05:33:16PM +0200, Peter Zijlstra wrote:
> On Fri, Jul 24, 2015 at 08:29:05AM -0700, Paul E. McKenney wrote:
> > Hello, Peter,
> > 
> > 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.

Furthremore, reading the buffer is a much less frequent occurrence than
writing entries to it. So its less performance critical.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ