On 03/15, Roland McGrath wrote:
>
>
> > > Does that need a barrier pair here and in
> >
> > No, set_notify_resume()->test_and_set_tsk_thread_flag() implies mb(),
>
> Ah, ok.
>
> > > tracehook_notify_resume()?
> >
> > Ah. I think you are right, and I think it needs the barrier even without
> > this change. Say, UTRACE_REPORT does:
> >
> >     utrace->report = 1;
> >     set_notify_resume();
> >
> > Without mb() there is no guarantee that utrace_resume() will notice and
> > clear ->report.
>
> Wait, what?  You just said that set_notify_resume() already implies an mb().

Yes, but the other side lacks a barrier. UTRACE_REPORT does

        utrace->report = 1;
        wmb(); // actually mb, but wmb is enough
        set _TIF_NOTIFY_RESUME;

do_notify_resume()->utrace_resume()->start_report() path does

        if (_TIF_NOTIFY_RESUME)
                // !!! we need rmb in between !!!
                if (utrace->report)
                        ...

and it can miss ->report.

> But we don't want a solution that requires changing
> arch code.

Yes, agreed.

Oleg.

Reply via email to