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>,
Pratyush Anand <panand@redhat.com>, <stable@vger.kernel.org>
Subject: [PATCH 5/5] ftrace: Fix ftrace enable ordering of sysctl ftrace_enabled
Date: Mon, 09 Mar 2015 12:03:58 -0400 [thread overview]
Message-ID: <20150309160547.327059950@goodmis.org> (raw)
In-Reply-To: <20150309160353.065685105@goodmis.org>
[-- Attachment #1: 0005-ftrace-Fix-ftrace-enable-ordering-of-sysctl-ftrace_e.patch --]
[-- Type: text/plain, Size: 2099 bytes --]
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
Some archs (specifically PowerPC), are sensitive with the ordering of
the enabling of the calls to function tracing and setting of the
function to use to be traced.
That is, update_ftrace_function() sets what function the ftrace_caller
trampoline should call. Some archs require this to be set before
calling ftrace_run_update_code().
Another bug was discovered, that ftrace_startup_sysctl() called
ftrace_run_update_code() directly. If the function the ftrace_caller
trampoline changes, then it will not be updated. Instead a call
to ftrace_startup_enable() should be called because it tests to see
if the callback changed since the code was disabled, and will
tell the arch to update appropriately. Most archs do not need this
notification, but PowerPC does.
The problem could be seen by the following commands:
# echo 0 > /proc/sys/kernel/ftrace_enabled
# echo function > /sys/kernel/debug/tracing/current_tracer
# echo 1 > /proc/sys/kernel/ftrace_enabled
# cat /sys/kernel/debug/tracing/trace
The trace will show that function tracing was not active.
Cc: stable@vger.kernel.org # 2.6.27+
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/ftrace.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index ea520bb54d44..4f228024055b 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2710,7 +2710,7 @@ static void ftrace_startup_sysctl(void)
command = FTRACE_UPDATE_CALLS;
if (ftrace_graph_active)
command |= FTRACE_START_FUNC_RET;
- ftrace_run_update_code(command);
+ ftrace_startup_enable(command);
}
}
@@ -5580,12 +5580,12 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
if (ftrace_enabled) {
- ftrace_startup_sysctl();
-
/* we are starting ftrace again */
if (ftrace_ops_list != &ftrace_list_end)
update_ftrace_function();
+ ftrace_startup_sysctl();
+
} else {
/* stopping ftrace calls (just send to ftrace_stub) */
ftrace_trace_function = ftrace_stub;
--
2.1.4
next prev parent reply other threads:[~2015-03-09 16:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-09 16:03 [PATCH 0/5] [GIT PULL] seq-buf/ftrace: Various fixes Steven Rostedt
2015-03-09 16:03 ` [PATCH 1/5] seq_buf: Fix seq_buf_vprintf() truncation Steven Rostedt
2015-03-09 16:03 ` [PATCH 2/5] seq_buf: Fix seq_buf_bprintf() truncation Steven Rostedt
2015-03-09 16:03 ` [PATCH 3/5] ftrace: Clear REGS_EN and TRAMP_EN flags on disabling record via sysctl Steven Rostedt
2015-03-09 16:03 ` [PATCH 4/5] ftrace: Fix en(dis)able graph caller when en(dis)abling " Steven Rostedt
2015-03-09 16:03 ` Steven Rostedt [this message]
2015-03-10 1:14 ` [PATCH 0/5] [GIT PULL] seq-buf/ftrace: Various fixes Linus Torvalds
2015-03-10 1:36 ` Steven Rostedt
2015-03-10 1:43 ` Linus Torvalds
2015-03-10 2:03 ` Steven Rostedt
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=20150309160547.327059950@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=panand@redhat.com \
--cc=stable@vger.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
Powered by JetHome