(Note I'm replying to 3/4 before 2/4.)

> IOW, nobody change change engine->ops or REAP bit in flags. Nobody can
> add the new engine or remove it from ->attached. We can do all work
> lockless and without barriers.

Makes sense.  In commit ac6e19c the body looks like this:
{
        struct utrace_engine *engine, *next;

        BUG_ON(!utrace->reap);

        splice_attaching(utrace);

        /*
         * Since we were called with @utrace->reap set, nobody can
         * set/clear UTRACE_EVENT(REAP) in @engine->flags or change
         * @engine->ops, and nobody can change @utrace->attached.
         */
        spin_unlock(&utrace->lock);

        list_for_each_entry_safe(engine, next, &utrace->attached, entry) {
                if (engine->flags & UTRACE_EVENT(REAP))
                        engine->ops->report_reap(engine, target);

                engine->ops = NULL;
                engine->flags = 0;
                list_del_init(&engine->entry);

                utrace_engine_put(engine);
        }
}

> Note that I changed the logic a bit, we set ->ops = NULL after
> ->report_reap(). Is it OK? If not, it is trivial to change.

I believe this only affects utrace_barrier.  See the next reply about that.
Can you think of another effect?


Thanks,
Roland

Reply via email to