From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Subject: [PATCH 13/18] ftrace: Fix function probe when more than one probe is added
Date: Fri, 10 May 2013 20:12:19 -0400 [thread overview]
Message-ID: <20130511001305.698613784@goodmis.org> (raw)
In-Reply-To: 20130511001206.477862307@goodmis.org
[-- Attachment #1: Type: text/plain, Size: 3935 bytes --]
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
When the first function probe is added and the function tracer
is updated the functions are modified to call the probe.
But when a second function is added, it updates the function
records to have the second function also update, but it fails
to update the actual function itself.
This prevents the second (or third or forth and so on) probes
from having their functions called.
# echo vfs_symlink:enable_event:sched:sched_switch > set_ftrace_filter
# echo vfs_unlink:enable_event:sched:sched_switch > set_ftrace_filter
# cat trace
# tracer: nop
#
# entries-in-buffer/entries-written: 0/0 #P:4
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
# touch /tmp/a
# rm /tmp/a
# cat trace
# tracer: nop
#
# entries-in-buffer/entries-written: 0/0 #P:4
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
# ln -s /tmp/a
# cat trace
# tracer: nop
#
# entries-in-buffer/entries-written: 414/414 #P:4
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
<idle>-0 [000] d..3 2847.923031: sched_switch: prev_comm=swapper/0 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=bash next_pid=2786 next_prio=120
<...>-3114 [001] d..4 2847.923035: sched_switch: prev_comm=ln prev_pid=3114 prev_prio=120 prev_state=x ==> next_comm=swapper/1 next_pid=0 next_prio=120
bash-2786 [000] d..3 2847.923535: sched_switch: prev_comm=bash prev_pid=2786 prev_prio=120 prev_state=S ==> next_comm=kworker/0:1 next_pid=34 next_prio=120
kworker/0:1-34 [000] d..3 2847.923552: sched_switch: prev_comm=kworker/0:1 prev_pid=34 prev_prio=120 prev_state=S ==> next_comm=swapper/0 next_pid=0 next_prio=120
<idle>-0 [002] d..3 2847.923554: sched_switch: prev_comm=swapper/2 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=sshd next_pid=2783 next_prio=120
sshd-2783 [002] d..3 2847.923660: sched_switch: prev_comm=sshd prev_pid=2783 prev_prio=120 prev_state=S ==> next_comm=swapper/2 next_pid=0 next_prio=120
Still need to update the functions even though the probe itself
does not need to be registered again when added a new probe.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/ftrace.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index dcca9fa..b549b0f 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2941,8 +2941,12 @@ static void __enable_ftrace_function_probe(void)
int ret;
int i;
- if (ftrace_probe_registered)
+ if (ftrace_probe_registered) {
+ /* still need to update the function call sites */
+ if (ftrace_enabled)
+ ftrace_run_update_code(FTRACE_UPDATE_CALLS);
return;
+ }
for (i = 0; i < FTRACE_FUNC_HASHSIZE; i++) {
struct hlist_head *hhd = &ftrace_func_hash[i];
--
1.7.10.4
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
next prev parent reply other threads:[~2013-05-11 0:13 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-11 0:12 [PATCH 00/18] tracing/kprobes: Update kprobes with new ftrace changes Steven Rostedt
2013-05-11 0:12 ` [PATCH 01/18] ring-buffer: Select IRQ_WORK Steven Rostedt
2013-05-11 0:12 ` [PATCH 02/18] tracing: Dont succeed if event_enable_func did not register anything Steven Rostedt
2013-05-11 0:12 ` [PATCH 03/18] tracing: Return error if register_ftrace_function_probe() fails for event_enable_func() Steven Rostedt
2013-05-11 0:12 ` [PATCH 04/18] ftrace: Have ftrace_regex_write() return either read or error Steven Rostedt
2013-05-11 0:12 ` [PATCH 05/18] ftrace, kprobes: Fix a deadlock on ftrace_regex_lock Steven Rostedt
2013-05-11 0:12 ` [PATCH 06/18] ftrace: Cleanup regex_lock and ftrace_lock around hash updating Steven Rostedt
2013-05-11 0:12 ` [PATCH 07/18] tracing/kprobes: Fix to increment return event probe hit-count Steven Rostedt
2013-05-11 0:12 ` [PATCH 08/18] tracing: Indicate enabled soft-mode in enable file Steven Rostedt
2013-05-11 0:12 ` [PATCH 09/18] tracing: Modify soft-mode only if theres no other referrer Steven Rostedt
2013-05-11 0:12 ` [PATCH 10/18] tracing: Add helper function trace_create_new_event() to remove duplicate code Steven Rostedt
2013-05-11 0:12 ` [PATCH 11/18] ftrace: Fix locking in register_ftrace_function_probe() Steven Rostedt
2013-05-11 0:12 ` [PATCH 12/18] ftrace: Fix the output of enabled_functions debug file Steven Rostedt
2013-05-11 0:12 ` Steven Rostedt [this message]
2013-05-11 0:12 ` [PATCH 14/18] tracing/kprobes: Use bool for retprobe checker Steven Rostedt
2013-05-11 0:12 ` [PATCH 15/18] tracing/kprobes: Increment probe hit-count even if it is used by perf Steven Rostedt
2013-05-11 0:12 ` [PATCH 16/18] tracing/kprobes: Pass trace_probe directly from dispatcher Steven Rostedt
2013-05-11 0:12 ` [PATCH 17/18] tracing/kprobes: Support ftrace_event_file base multibuffer Steven Rostedt
2013-05-11 0:12 ` [PATCH 18/18] tracing/kprobes: Support soft-mode disabling Steven Rostedt
2013-05-12 1:16 ` [PATCH 00/18] tracing/kprobes: Update kprobes with new ftrace changes Linus Torvalds
2013-05-12 2:11 ` Steven Rostedt
2013-05-12 2:22 ` Steven Rostedt
2013-05-12 12:50 ` Steven Rostedt
2013-05-12 18:56 ` Linus Torvalds
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=20130511001305.698613784@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@kernel.org \
--cc=torvalds@linux-foundation.org \
/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