From: Li Zefan <lizf@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/2] tracing: Add sysctl to enable/disable tracing on oops
Date: Wed, 09 Sep 2009 09:15:04 +0800 [thread overview]
Message-ID: <4AA70198.9070500@cn.fujitsu.com> (raw)
Currently we always disable tracing on oops, and this patch
adds a sysctl so one can choose to enable it.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
include/linux/kernel.h | 2 ++
kernel/panic.c | 3 ++-
kernel/sysctl.c | 10 ++++++++++
kernel/trace/ring_buffer.c | 2 ++
4 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index f61039e..5c4528f 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -516,12 +516,14 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
* Most likely, you want to use tracing_on/tracing_off.
*/
#ifdef CONFIG_RING_BUFFER
+extern int trace_on_oops;
void tracing_on(void);
void tracing_off(void);
/* trace_off_permanent stops recording with no way to bring it back */
void tracing_off_permanent(void);
int tracing_is_on(void);
#else
+#define trace_on_oops 0
static inline void tracing_on(void) { }
static inline void tracing_off(void) { }
static inline void tracing_off_permanent(void) { }
diff --git a/kernel/panic.c b/kernel/panic.c
index 512ab73..22ec502 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -301,7 +301,8 @@ int oops_may_print(void)
*/
void oops_enter(void)
{
- tracing_off();
+ if (!trace_on_oops)
+ tracing_off();
/* can't trust the integrity of the kernel anymore: */
debug_locks_off();
do_oops_enter_exit();
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index cdbe8d0..a768c15 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -537,6 +537,16 @@ static struct ctl_table kern_table[] = {
.proc_handler = &stack_trace_sysctl,
},
#endif
+#ifdef CONFIG_RING_BUFFER
+ {
+ .ctl_name = CTL_UNNUMBERED,
+ .procname = "trace_on_oops",
+ .data = &trace_on_oops,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ },
+#endif
#ifdef CONFIG_TRACING
{
.ctl_name = CTL_UNNUMBERED,
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 454e74e..fc10962 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -155,6 +155,8 @@ static unsigned long ring_buffer_flags __read_mostly = RB_BUFFERS_ON;
#define BUF_PAGE_HDR_SIZE offsetof(struct buffer_data_page, data)
+int trace_on_oops;
+
/**
* tracing_on - enable all tracing buffers
*
--
1.6.3
next reply other threads:[~2009-09-09 1:16 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-09 1:15 Li Zefan [this message]
2009-09-09 1:15 ` [PATCH 2/2] tracing/events: Add kexec tracepoints Li Zefan
2009-09-09 1:20 ` Daniel Walker
2009-09-09 1:26 ` Li Zefan
2009-09-09 4:59 ` Daniel Walker
2009-09-09 11:46 ` Steven Rostedt
2009-09-09 14:12 ` Daniel Walker
2009-09-09 15:19 ` Steven Rostedt
2009-09-09 15:58 ` Daniel Walker
2009-09-09 1:27 ` Eric W. Biederman
2009-09-09 1:39 ` Steven Rostedt
2009-09-09 2:02 ` Eric W. Biederman
2009-09-09 1:34 ` [PATCH 1/2] tracing: Add sysctl to enable/disable tracing on oops Steven Rostedt
2009-09-09 1:37 ` Li Zefan
2009-09-09 1:42 ` Steven Rostedt
2009-09-09 1:47 ` Li Zefan
2009-09-09 2:04 ` Steven Rostedt
2009-09-09 2:33 ` KOSAKI Motohiro
2009-09-09 2:40 ` Li Zefan
2009-09-09 2:53 ` Steven Rostedt
2009-09-09 4:19 ` KOSAKI Motohiro
2009-09-09 11:48 ` Steven Rostedt
2009-09-09 3:01 ` KOSAKI Motohiro
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=4AA70198.9070500@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.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