All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Matt Fleming <mjf@gentoo.org>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Sam Ravnborg <sam@ravnborg.org>,
	Jim Radford <radford@galvanix.net>,
	Paul Mundt <lethal@linux-sh.org>,
	Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 4/5] ftrace: add ftrace_off_permanent
Date: Fri, 21 Nov 2008 15:29:36 -0500	[thread overview]
Message-ID: <20081121203100.878295527@goodmis.org> (raw)
In-Reply-To: 20081121202932.281682721@goodmis.org

[-- Attachment #1: 0004-ftrace-add-ftrace_off_permanent.patch --]
[-- Type: text/plain, Size: 2129 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Impact: feature to disable all of ftrace on anomalies

It case of a serious anomaly being detected (like something caught by
lockdep) it is a good idea to disable all tracing immediately, without
grabing any locks.

This patch adds ftrace_off_permanent that disables the tracers, function
tracing and ring buffers without a way to enable them again. This should
only be used when something serious has been detected.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 include/linux/ftrace.h |    2 ++
 kernel/trace/trace.c   |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index f1af1aa..efa5f27 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -257,6 +257,7 @@ extern int ftrace_dump_on_oops;
 
 extern void tracing_start(void);
 extern void tracing_stop(void);
+extern void ftrace_off_permanent(void);
 
 extern void
 ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
@@ -290,6 +291,7 @@ ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 0)));
 
 static inline void tracing_start(void) { }
 static inline void tracing_stop(void) { }
+static inline void ftrace_off_permanent(void) { }
 static inline int
 ftrace_printk(const char *fmt, ...)
 {
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 5653c6b..25b560f 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -639,6 +639,21 @@ static int trace_stop_count;
 static DEFINE_SPINLOCK(tracing_start_lock);
 
 /**
+ * ftrace_off_permanent - disable all ftrace code permanently
+ *
+ * This should only be called when a serious anomally has
+ * been detected.  This will turn off the function tracing,
+ * ring buffers, and other tracing utilites. It takes no
+ * locks and can be called from any context.
+ */
+void ftrace_off_permanent(void)
+{
+	tracing_disabled = 1;
+	ftrace_stop();
+	tracing_off_permanent();
+}
+
+/**
  * tracing_start - quick start of the tracer
  *
  * If tracing is enabled but was stopped by tracing_stop,
-- 
1.5.6.5

-- 

  parent reply	other threads:[~2008-11-21 20:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-21 20:29 [PATCH 0/5] ftrace: recordmcount for sh and arm, plus permanent disable API Steven Rostedt
2008-11-21 20:29 ` [PATCH 1/5] ftrace: Specify $alignment for sh architecture Steven Rostedt
2008-11-21 20:29 ` [PATCH 2/5] ftrace: mcountrecord.pl for arm Steven Rostedt
2008-11-21 20:29 ` [PATCH 3/5] ring-buffer: add tracing_off_permanent Steven Rostedt
2008-11-21 20:29 ` Steven Rostedt [this message]
2008-11-21 20:29 ` [PATCH 5/5] trace: fix compiler warning in branch profiler Steven Rostedt
2008-11-23 10:51 ` [PATCH 0/5] ftrace: recordmcount for sh and arm, plus permanent disable API Ingo Molnar

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=20081121203100.878295527@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mingo@elte.hu \
    --cc=mjf@gentoo.org \
    --cc=radford@galvanix.net \
    --cc=sam@ravnborg.org \
    --cc=srostedt@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.