> 1. Can't we set ->reporting _after_ checking engine->flags ? > (unlikely)
I'm not sure...it is early the morning again. ;-) > 2. Is utrace_barrier() correct???? Note the example above, > it assumes that utrace_barrier() itself is the barrier > wrt reporting. But, is it? I don't think I understand the question. > > list_for_each_entry_safe(engine, next, &utrace->attached, entry) { > > - if (engine->flags & UTRACE_EVENT(REAP)) > > + if (engine->flags & UTRACE_EVENT(REAP)) { > > + /* > > + * These barriers order anything ->report_reap() > > + * does to be while ->reporting is set. That way > > + * any utrace_barrier() call that returns 0 is > > + * guaranteeing that the callback is complete. > > + */ > > + utrace->reporting = engine; > > + smp_mb(); > > engine->ops->report_reap(engine, target); > > + smp_mb(); > > + utrace->reporting = NULL; > > Agreed. Let's verify/explain the logic of each barrier before we put it in. > And yes, now it is important to clear ->ops _after_ calling > ->report_reap(), otherwise utrace_barrier() can take the lock. Right. Thanks, Roland