See below. Michael Neuling <mi...@neuling.org> wrote on 10/23/2013 02:54:54 AM:
> > diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c > index cd55144..95768c6 100644 > --- a/kernel/events/ring_buffer.c > +++ b/kernel/events/ring_buffer.c > @@ -87,10 +87,10 @@ again: > goto out; > > /* > - * Publish the known good head. Rely on the full barrier implied > - * by atomic_dec_and_test() order the rb->head read and this > - * write. > + * Publish the known good head. We need a memory barrier to order the > + * order the rb->head read and this write. > */ > + smp_mb (); > rb->user_page->data_head = head; > > /* 1. As far as I understand, smp_mb() is superfluous in this case, smp_wmb() should be enough. (same for the space between the name of function and open parenthesis :-) ) 2. Again, as far as I understand from ./Documentation/atomic_ops.txt, it is mistake in architecture independent code to rely on memory barriers in atomic operations, all the more so in "local" operations. 3. The solution above is sub-optimal on architectures where memory barrier is part of "local", since we are going to execute two consecutive barriers. So, maybe, it would be better to use smp_mb__after_atomic_dec(). 4. I'm not sure, but I think there is another, unrelated potential problem in function perf_output_put_handle() - the write to "data_head" - kernel/events/ring_buffer.c: 77 /* 78 * Publish the known good head. Rely on the full barrier implied 79 * by atomic_dec_and_test() order the rb->head read and this 80 * write. 81 */ 82 rb->user_page->data_head = head; As data_head is 64-bit wide, the update should be done by an atomic64_set (). Regards, -- Victor _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev