linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	linux-arch@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Jiri Kosina <jkosina@suse.cz>,
	Josh Poimboeuf <notifications@github.com>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: [RFA][PATCH 04/27] ftrace-graph: Remove dependency of ftrace_stop() from ftrace_graph_stop()
Date: Thu, 26 Jun 2014 12:52:25 -0400	[thread overview]
Message-ID: <20140626165848.568062800@goodmis.org> (raw)
In-Reply-To: 20140626165221.736847419@goodmis.org

[-- Attachment #1: 0004-ftrace-graph-Remove-dependency-of-ftrace_stop-from-f.patch --]
[-- Type: text/plain, Size: 3451 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

ftrace_stop() is going away as it disables parts of function tracing
that affects users that should not be affected. But ftrace_graph_stop()
is built on ftrace_stop(). Here's another example of killing all of
function tracing because something went wrong with function graph
tracing.

Instead of disabling all users of function tracing on function graph
error, disable only function graph tracing.

A new function is created called ftrace_graph_is_dead(). This is called
in strategic paths to prevent function graph from doing more harm and
allowing at least a warning to be printed before the system crashes.

NOTE: ftrace_stop() is still used until all the archs are converted over
to use ftrace_graph_is_dead(). After that, ftrace_stop() will be removed.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/linux/ftrace.h               |  1 +
 kernel/trace/ftrace.c                |  5 -----
 kernel/trace/trace_functions_graph.c | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 11e18fd58b1a..ec059c343e78 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -750,6 +750,7 @@ extern char __irqentry_text_end[];
 extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
 				trace_func_graph_ent_t entryfunc);
 
+extern bool ftrace_graph_is_dead(void);
 extern void ftrace_graph_stop(void);
 
 /* The current handlers in use */
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 3a6d44c76af7..823984c20262 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5439,9 +5439,4 @@ void ftrace_graph_exit_task(struct task_struct *t)
 
 	kfree(ret_stack);
 }
-
-void ftrace_graph_stop(void)
-{
-	ftrace_stop();
-}
 #endif
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 4de3e57f723c..3604690be70b 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -15,6 +15,38 @@
 #include "trace.h"
 #include "trace_output.h"
 
+static bool kill_ftrace_graph;
+
+/**
+ * ftrace_graph_is_dead - returns true if ftrace_graph_stop() was called
+ *
+ * ftrace_graph_stop() is called when a severe error is detected in
+ * the function graph tracing. This function is called by the critical
+ * paths of function graph to keep those paths from doing any more harm.
+ */
+bool ftrace_graph_is_dead(void)
+{
+	return kill_ftrace_graph;
+}
+
+/**
+ * ftrace_graph_stop - set to permanently disable function graph tracincg
+ *
+ * In case of an error int function graph tracing, this is called
+ * to try to keep function graph tracing from causing any more harm.
+ * Usually this is pretty severe and this is called to try to at least
+ * get a warning out to the user.
+ */
+void ftrace_graph_stop(void)
+{
+	kill_ftrace_graph = true;
+	/*
+	 * ftrace_stop() will be removed when all archs are updated to
+	 * use ftrace_graph_is_dead()
+	 */
+	ftrace_stop();
+}
+
 /* When set, irq functions will be ignored */
 static int ftrace_graph_skip_irqs;
 
@@ -92,6 +124,9 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth,
 	unsigned long long calltime;
 	int index;
 
+	if (unlikely(ftrace_graph_is_dead()))
+		return -EBUSY;
+
 	if (!current->ret_stack)
 		return -EBUSY;
 
-- 
2.0.0

  parent reply	other threads:[~2014-06-26 16:59 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 16:52 [RFA][PATCH 00/27] ftrace: Remove ftrace_start/stop() and friends Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 01/27] x86, power, suspend: Annotate restore_processor_state() with notrace Steven Rostedt
2014-06-26 16:52   ` Steven Rostedt
2014-06-28  0:02   ` Rafael J. Wysocki
2014-06-26 16:52 ` [RFA][PATCH 02/27] PM / Sleep: Remove ftrace_stop/start() from suspend and hibernate Steven Rostedt
2014-06-28  0:02   ` Rafael J. Wysocki
2014-06-26 16:52 ` [RFA][PATCH 03/27] tracing: Remove ftrace_stop/start() from reading the trace file Steven Rostedt
2014-06-26 16:52   ` Steven Rostedt
2014-06-26 16:52 ` Steven Rostedt [this message]
2014-06-26 16:52 ` [RFA][PATCH 05/27] ftrace/x86: Add call to ftrace_graph_is_dead() in function graph code Steven Rostedt
2014-07-15 15:47   ` H. Peter Anvin
2014-06-26 16:52 ` [RFA][PATCH 06/27] microblaze: ftrace: " Steven Rostedt
2014-07-03 16:34   ` Steven Rostedt
2014-07-03 16:34     ` Steven Rostedt
2014-07-09 14:03   ` Steven Rostedt
2014-07-18  8:19     ` Michal Simek
2014-07-18  8:19       ` Michal Simek
2014-06-26 16:52 ` [RFA][PATCH 07/27] MIPS: " Steven Rostedt
2014-07-02 14:31   ` Steven Rostedt
2014-07-02 14:31     ` Steven Rostedt
2014-07-09 15:48     ` James Hogan
2014-07-03 16:36   ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 08/27] parisc: " Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 09/27] powerpc/ftrace: " Steven Rostedt
2014-07-09 14:04   ` Steven Rostedt
2014-07-09 14:04     ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 10/27] sh: ftrace: " Steven Rostedt
2014-06-26 16:52   ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 11/27] ftrace-graph: Remove usage of ftrace_stop() in ftrace_graph_stop() Steven Rostedt
2014-06-26 16:52   ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 12/27] ftrace: Remove ftrace_start/stop() Steven Rostedt
2014-06-26 16:52   ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 13/27] ftrace: Do no disable function tracing on enabling function tracing Steven Rostedt
2014-06-26 16:52   ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 14/27] ftrace: Remove function_trace_stop check from list func Steven Rostedt
2014-06-26 16:52   ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 15/27] ftrace: Remove check for HAVE_FUNCTION_TRACE_MCOUNT_TEST Steven Rostedt
2014-06-26 16:52   ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 16/27] ftrace: x86: Remove check of obsolete variable function_trace_stop Steven Rostedt
2014-06-26 16:52   ` Steven Rostedt
2014-07-15 15:48   ` H. Peter Anvin
2014-06-26 16:52 ` [RFA][PATCH 17/27] tile: ftrace: " Steven Rostedt
2014-06-26 17:33   ` Steven Rostedt
2014-06-26 17:33     ` Steven Rostedt
2014-07-03 13:53   ` Chris Metcalf
2014-07-03 14:02     ` Steven Rostedt
2014-07-03 14:02       ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 18/27] sparc64,ftrace: " Steven Rostedt
2014-06-26 17:34   ` Steven Rostedt
2014-06-26 17:34     ` Steven Rostedt
2014-07-03 16:41   ` Steven Rostedt
2014-07-03 16:41     ` Steven Rostedt
2014-07-04  4:18     ` David Miller
2014-06-26 16:52 ` [RFA][PATCH 19/27] sh: ftrace: " Steven Rostedt
2014-06-26 17:35   ` Steven Rostedt
2014-06-26 17:35     ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 20/27] parisc: " Steven Rostedt
2014-06-26 16:52   ` Steven Rostedt
2014-06-26 17:35   ` Steven Rostedt
2014-06-29 21:20     ` Helge Deller
2014-06-30 14:11       ` Steven Rostedt
2014-06-30 14:11         ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 21/27] MIPS: " Steven Rostedt
2014-06-26 16:52   ` Steven Rostedt
2014-06-26 17:37   ` Steven Rostedt
2014-06-26 17:37     ` Steven Rostedt
2014-07-02 14:32   ` Steven Rostedt
2014-07-02 14:32     ` Steven Rostedt
2014-07-09 14:15   ` Steven Rostedt
2014-07-15 21:58   ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 22/27] microblaze: " Steven Rostedt
2014-06-26 17:38   ` Steven Rostedt
2014-06-26 17:38     ` Steven Rostedt
2014-07-09 14:16   ` Steven Rostedt
2014-07-09 14:16     ` Steven Rostedt
2014-07-15 21:51   ` Steven Rostedt
2014-07-18  8:17     ` Michal Simek
2014-07-18  8:17       ` Michal Simek
2014-06-26 16:52 ` [RFA][PATCH 23/27] metag: " Steven Rostedt
2014-06-26 17:38   ` Steven Rostedt
2014-06-26 17:38     ` Steven Rostedt
2014-07-02 13:34     ` James Hogan
2014-07-02 14:22       ` Steven Rostedt
2014-07-02 14:22         ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 24/27] Blackfin: " Steven Rostedt
2014-06-26 16:52   ` Steven Rostedt
2014-06-26 17:39   ` Steven Rostedt
2014-06-26 17:39     ` Steven Rostedt
2014-06-26 19:25   ` Mike Frysinger
2014-06-26 19:34     ` Steven Rostedt
2014-06-26 19:34       ` Steven Rostedt
2014-06-26 16:52 ` [RFA][PATCH 25/27] arm64, " Steven Rostedt
2014-06-26 17:40   ` Steven Rostedt
2014-06-26 17:40     ` Steven Rostedt
2014-06-27 12:44   ` Will Deacon
2014-07-01 11:33     ` AKASHI Takahiro
2014-06-26 16:52 ` [RFA][PATCH 26/27] s390/ftrace: remove " Steven Rostedt
2014-06-26 16:52   ` Steven Rostedt
2014-06-26 17:41   ` Steven Rostedt
2014-06-26 17:41     ` Steven Rostedt
2014-06-27  6:01     ` Heiko Carstens
2014-06-26 16:52 ` [RFA][PATCH 27/27] tracing: Remove function_trace_stop and HAVE_FUNCTION_TRACE_MCOUNT_TEST Steven Rostedt
2014-06-30  3:13 ` [RFA][PATCH 00/27] ftrace: Remove ftrace_start/stop() and friends Masami Hiramatsu
2014-06-30  3:13   ` Masami Hiramatsu
2014-06-30 14:16   ` Steven Rostedt
2014-06-30 14:16     ` Steven Rostedt
2014-07-01  0:58     ` Masami Hiramatsu

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=20140626165848.568062800@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jkosina@suse.cz \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=notifications@github.com \
    --cc=rjw@rjwysocki.net \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).