[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110617183118.GA8375@redhat.com>
Date: Fri, 17 Jun 2011 20:31:18 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Tejun Heo <tj@...nel.org>
Cc: vda.linux@...glemail.com, jan.kratochvil@...hat.com,
linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
akpm@...ux-foundation.org, indan@....nu, bdonlan@...il.com,
pedro@...esourcery.com
Subject: Re: [PATCH 4/5] ptrace: implement TRAP_NOTIFY and use it for group
stop events
On 06/17, Tejun Heo wrote:
>
> Hello, Oleg.
>
> On Thu, Jun 16, 2011 at 09:51:38PM +0200, Oleg Nesterov wrote:
> > I already applied this series. But somehow I have the fuzzy feeling we
> > can simplify JOBCTL_TRAP_NOTIFY/JOBCTL_TRAP_STOP logic later. No, I can't
> > explain what I mean ;)
>
> Heh, yeah, please go ahead.
>
> > One question,
> >
> > > @@ -1797,8 +1824,10 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
> > > if (why == CLD_STOPPED && (current->jobctl & JOBCTL_STOP_PENDING))
> > > gstop_done = task_participate_group_stop(current);
> > >
> > > - /* any trap clears pending STOP trap */
> > > + /* any trap clears pending STOP trap, STOP trap clears NOTIFY */
> > > task_clear_jobctl_pending(current, JOBCTL_TRAP_STOP);
> > > + if (info && info->si_code >> 8 == PTRACE_EVENT_STOP)
> > > + task_clear_jobctl_pending(current, JOBCTL_TRAP_NOTIFY);
> >
> > OK, but can't we check why == CLD_STOPPED instead of PTRACE_EVENT_STOP?
>
> Yeap, sure. The reason why I used PTRACE_EVENT_STOP was because
> PTRACE_LISTEN needs the same test and it doesn't have access to @why.
> Maybe it's better to create ptrace_is_trap_stop(si)?
Sure, PTRACE_EVENT_STOP have to look at info (although we could add
another JOBCTL_ bit). But since ptrace_stop() checks CLD_STOPPED anyway
we could do
if (why == CLD_STOPPED) {
if (current->jobctl & JOBCTL_STOP_PENDING)
gstop_done = task_participate_group_stop(current);
task_clear_jobctl_pending(current, JOBCTL_TRAP_NOTIFY);
}
as a microcleanup. OK, please forget, this is minor.
> > In fact, can't we move all code above under 'if (why == CLD_STOPPED)' ?
> > JOBCTL_TRAP_STOP can't be set otherwise, no? I am almost sure I missed
> > something though.
>
> JOBCTL_TRAP_STOP should also be cleared on CLD_TRAPPED traps.
Yes, this is clear
> ie. If
> the ptracer does PTRACE_INTERRUPT
Ah, indeed, I forgot about PTRACE_INTERRUPT. Thanks.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists