[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131106152346.GJ26785@twins.programming.kicks-ass.net>
Date: Wed, 6 Nov 2013 16:23:46 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Vince Weaver <vince@...ter.net>
Cc: mingo@...nel.org, hpa@...or.com, anton@...ba.org,
mathieu.desnoyers@...ymtl.ca, linux-kernel@...r.kernel.org,
michael@...erman.id.au, paulmck@...ux.vnet.ibm.com,
benh@...nel.crashing.org, fweisbec@...il.com, VICTORK@...ibm.com,
tglx@...utronix.de, oleg@...hat.com, mikey@...ling.org,
linux-tip-commits@...r.kernel.org
Subject: Re: [tip:perf/core] tools/perf: Add required memory barriers
On Wed, Nov 06, 2013 at 04:10:55PM +0100, Peter Zijlstra wrote:
> On Wed, Nov 06, 2013 at 09:55:17AM -0500, Vince Weaver wrote:
> > Having perf in the kernel tree really makes it hard for you guys to keep a
> > clean API/ABI it seems.
>
> Lock free buffers are 'fun'.. The ABI can be described as:
>
> read pc->data_head
>
> // ensure no other reads get before this point and ->data_head
> // doesn't get re-read hereafter.
FWIW; this is where barrier() and ACCESS_ONCE() differ afaict, barrier()
only accomplishes that if the ->data_head read re-appears it must
re-issue it; whereas ACCESS_ONCE(), by marking it volatile, completely
avoids that read insertion from being possible.
Then again, the compiler should not lower the read over a compiler
barrier anyway, so on that account the insertion of the second read
would also be invalid.
So you're _probably_ good without the ACCESS_ONCE, but please ask a
compiler person, not me.
--
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