public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Cc: Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 7/8] ftrace: add ftrace_kill_atomic
Date: Thu, 10 Jul 2008 20:58:15 -0400	[thread overview]
Message-ID: <20080711005951.157927213@goodmis.org> (raw)
In-Reply-To: 20080711005808.316194101@goodmis.org

[-- Attachment #1: ftrace-kill-atomic.patch --]
[-- Type: text/plain, Size: 1802 bytes --]

It has been suggested that I add a way to disable the function tracer
on an oops. This code adds a ftrace_kill_atomic. It is not meant to be
used in normal situations. It will disable the ftrace tracer, but will
not perform the nice shutdown that requires scheduling.

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

Index: linux-tip.git/include/linux/ftrace.h
===================================================================
--- linux-tip.git.orig/include/linux/ftrace.h	2008-07-03 17:30:24.000000000 -0400
+++ linux-tip.git/include/linux/ftrace.h	2008-07-10 11:55:15.000000000 -0400
@@ -89,6 +89,7 @@ void ftrace_enable_daemon(void);
 
 /* totally disable ftrace - can not re-enable after this */
 void ftrace_kill(void);
+void ftrace_kill_atomic(void);
 
 static inline void tracer_disable(void)
 {
Index: linux-tip.git/kernel/trace/ftrace.c
===================================================================
--- linux-tip.git.orig/kernel/trace/ftrace.c	2008-07-10 00:30:00.000000000 -0400
+++ linux-tip.git/kernel/trace/ftrace.c	2008-07-10 11:54:09.000000000 -0400
@@ -1602,6 +1602,21 @@ core_initcall(ftrace_dynamic_init);
 #endif /* CONFIG_DYNAMIC_FTRACE */
 
 /**
+ * ftrace_kill_atomic - kill ftrace from critical sections
+ *
+ * This function should be used by panic code. It stops ftrace
+ * but in a not so nice way. If you need to simply kill ftrace
+ * from a non-atomic section, use ftrace_kill.
+ */
+void ftrace_kill_atomic(void)
+{
+	ftrace_disabled = 1;
+	ftrace_enabled = 0;
+	ftraced_suspend = -1;
+	clear_ftrace_function();
+}
+
+/**
  * ftrace_kill - totally shutdown ftrace
  *
  * This is a safety measure. If something was detected that seems

-- 

  parent reply	other threads:[~2008-07-11  1:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-11  0:58 [PATCH 0/8] ftrace: updates Steven Rostedt
2008-07-11  0:58 ` [PATCH 1/8] ftrace: move sched_switch enable after markers Steven Rostedt
2008-07-11  0:58 ` [PATCH 2/8] ftrace: define function trace nop Steven Rostedt
2008-07-11  0:58 ` [PATCH 3/8] ftrace: trace schedule Steven Rostedt
2008-07-11  0:58 ` [PATCH 4/8] ftrace: check proper config for preempt type Steven Rostedt
2008-07-11  0:58 ` [PATCH 5/8] ftrace: start wakeup tracing after setting function tracer Steven Rostedt
2008-07-11  0:58 ` [PATCH 6/8] ftrace: use current CPU for function startup Steven Rostedt
2008-07-11  0:58 ` Steven Rostedt [this message]
2008-07-11  0:58 ` [PATCH 8/8] ftrace: separate out the function enabled variable Steven Rostedt
2008-07-11 13:50 ` [PATCH 0/8] ftrace: updates Ingo Molnar
2008-07-11 14:47   ` Ingo Molnar
2008-07-11 14:51     ` 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=20080711005951.157927213@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox