On 09/23, Oleg Nesterov wrote: > > On 09/21, Roland McGrath wrote: > > > > It's better to have a spurious report (preferably just spurious > > TIF_NOTIFY_RESUME with no actual callbacks) following any detach, > > or whatever it takes to ensure user_disable_single_step() always > > runs if user_enable_*_step did before and there is no engine around > > to see a report_quiesce callback pass. If there is a report_quiesce > > or report_signal callback pass where nobody returns UTRACE_*STEP, > > then we should never leave stepping enabled when we return to user mode. > > Hmm. I'll try to think more. Right now I don't really understand > how to do this correctly. > > OK, finish_callback_report() and utrace_control(DETACH) can set > TIF_NOTIFY_RESUME. But what if there are no more attached engines? > Looks like, utrace_resume(UTRACE_RESUME) needs to handle this special > case. And utrace_reset() shouldn't clear task->utrace_flags, otherwise > utrace_resume/utrace_get_signal won't be called. > > So, probably detach should set TIF_NOTIFY_RESUME, but utrace_reset() > should do user_disable_single_step() too if no more engines. Confused.
Or, detach can always do user_disable_single_step() and set TIF_NOTIFY_RESUME. If another engine wants stepping its report_quiesce() should re-ack UTRACE_SINGLESTEP anyway, otherwise it is buggy. > And in fact I don't understand why this is important. When it comes > to multiracing, any engine can hit the unwanted/unexpected trap > because another engine can ask for UTRACE_*STEP. The only really > important (I think) case is when the last engine detaches. Aaah. please ignore. Somehow I assumed every engine should hook SIGTRAP. Oleg.