Re: [PATCH] tracing: Allow raw_syscall tracepoints to work from boot

From: Steven Rostedt
Date: Wed Jan 14 2015 - 13:03:10 EST


On Wed, 14 Jan 2015 09:35:17 +1100
Michael Ellerman <mpe@xxxxxxxxxxxxxx> wrote:

> In commit 5f893b2639b2 "tracing: Move enabling tracepoints to just after
> rcu_init()", tracing was enabled earlier in boot.
>
> This broke tracing of the raw_syscall tracepoints from boot using the
> trace_event kernel parameter.
>
> When the registration function for the raw_syscall tracepoints runs, it
> iterates over all tasks setting TIF_SYSCALL_TRACEPOINT. However now that
> this happens earlier in boot, the loop has no effect because there are
> no tasks in existence other than init_task, which is skipped by the
> for_each_process_thread() macro.
>
> We can fix it by explicitly setting TIF_SYSCALL_TRACEPOINT for the
> init_task. That way when pid 1 is cloned from init_task it will inherit
> TIF_SYSCALL_TRACEPOINT.
>
> Fixes: 5f893b2639b2 ("tracing: Move enabling tracepoints to just after rcu_init()")

I don't like setting the swap task flag for syscall tracing, as nothing
will unset it.


> Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
> ---
> kernel/tracepoint.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
>
> It feels a bit naughty to be whacking init_task like this, but it also
> seems like the right fix?

No, I tried the following instead.

>
> Should we also clear it in the unregfunc? I can't see how that would
> ever be needed in practice?

It just seems hacky to set swapper in the first place.

Try my patch and let me know if it works for you?

-- Steve