Re: [PATCHv11 2.6.36-rc2-tip 3/15] 3: uprobes: Slot allocationfor Execution out of line(XOL)

From: Peter Zijlstra
Date: Fri Sep 03 2010 - 12:52:15 EST


On Fri, 2010-09-03 at 22:10 +0530, Srikar Dronamraju wrote:
> > > + mb();
> >
> > Where is the matching barrier?
>
> I dont want the compiler to reorder the instructions and do the
> assignment for user_bkpt to be done before we complete the copy above.
>
> If the assignment happens before we copy the content into the slot,
> someother thread that might hit the same probe actually things the slot
> is ready and tries to jump to that slot even before the slot is
> initialized.
>
> Please let me know if I could have done it differently.


If you want a compiler barrier, use barrier(), but here you seem to
describe a multi-threaded situation, in which case the observer thread
needs at least a rmb() in order for that mb() to mean anything other
than the compiler barrier it implies.

Also, use smp_* barriers.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/