From: Michael Ellerman <mpe@ellerman.id.au>
To: rostedt@goodmis.org
Cc: <linux-kernel@vger.kernel.org>,
mingo@redhat.com, paulmck@linux.vnet.ibm.com,
Andrew Morton <akpm@osdl.org>,
tglx@linutronix.de, mathieu.desnoyers@efficios.com,
xiakaixu@huawei.com
Subject: [PATCH] tracing: Allow raw_syscall tracepoints to work from boot
Date: Wed, 14 Jan 2015 09:35:17 +1100 [thread overview]
Message-ID: <1421188517-18312-1-git-send-email-mpe@ellerman.id.au> (raw)
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()")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
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?
Should we also clear it in the unregfunc? I can't see how that would
ever be needed in practice?
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 3490407dc7b7..43a03e22c16c 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -496,6 +496,12 @@ void syscall_regfunc(void)
if (!sys_tracepoint_refcount) {
read_lock(&tasklist_lock);
+ /*
+ * If we run very early in boot then we need to hit init_task
+ * directly so that pid 1 will inherit the TIF flag.
+ */
+ set_tsk_thread_flag(&init_task, TIF_SYSCALL_TRACEPOINT);
+
for_each_process_thread(p, t) {
set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT);
}
--
2.1.0
next reply other threads:[~2015-01-13 22:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-13 22:35 Michael Ellerman [this message]
2015-01-14 18:03 ` Steven Rostedt
2015-01-15 6:10 ` Michael Ellerman
2015-01-15 13:58 ` Steven Rostedt
2015-01-15 22:47 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1421188517-18312-1-git-send-email-mpe@ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=xiakaixu@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®