Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121036
b: refs/heads/master
c: 944ac42
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Oct 27, 2008
1 parent 72af9ce commit 48a12bc
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f4a2a0d9a4226846693b5b4462d4350c1bfd58ea
refs/heads/master: 944ac4259e39801c843a915c3da8194ac9af0440
2 changes: 2 additions & 0 deletions trunk/include/linux/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ static inline void __ftrace_enabled_restore(int enabled)
#endif

#ifdef CONFIG_TRACING
extern int ftrace_dump_on_oops;

extern void
ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);

Expand Down
10 changes: 10 additions & 0 deletions trunk/kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,16 @@ static struct ctl_table kern_table[] = {
.proc_handler = &ftrace_enable_sysctl,
},
#endif
#ifdef CONFIG_TRACING
{
.ctl_name = CTL_UNNUMBERED,
.procname = "ftrace_dump_on_opps",
.data = &ftrace_dump_on_oops,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec,
},
#endif
#ifdef CONFIG_MODULES
{
.ctl_name = KERN_MODPROBE,
Expand Down
29 changes: 26 additions & 3 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,28 @@ static cpumask_t __read_mostly tracing_buffer_mask;

static int tracing_disabled = 1;

/*
* ftrace_dump_on_oops - variable to dump ftrace buffer on oops
*
* If there is an oops (or kernel panic) and the ftrace_dump_on_oops
* is set, then ftrace_dump is called. This will output the contents
* of the ftrace buffers to the console. This is very useful for
* capturing traces that lead to crashes and outputing it to a
* serial console.
*
* It is default off, but you can enable it with either specifying
* "ftrace_dump_on_oops" in the kernel command line, or setting
* /proc/sys/kernel/ftrace_dump_on_oops to true.
*/
int ftrace_dump_on_oops;

static int __init set_ftrace_dump_on_oops(char *str)
{
ftrace_dump_on_oops = 1;
return 1;
}
__setup("ftrace_dump_on_oops", set_ftrace_dump_on_oops);

long
ns2usecs(cycle_t nsec)
{
Expand Down Expand Up @@ -3021,7 +3043,8 @@ EXPORT_SYMBOL_GPL(__ftrace_printk);
static int trace_panic_handler(struct notifier_block *this,
unsigned long event, void *unused)
{
ftrace_dump();
if (ftrace_dump_on_oops)
ftrace_dump();
return NOTIFY_OK;
}

Expand All @@ -3037,7 +3060,8 @@ static int trace_die_handler(struct notifier_block *self,
{
switch (val) {
case DIE_OOPS:
ftrace_dump();
if (ftrace_dump_on_oops)
ftrace_dump();
break;
default:
break;
Expand Down Expand Up @@ -3078,7 +3102,6 @@ trace_printk_seq(struct trace_seq *s)
trace_seq_reset(s);
}


void ftrace_dump(void)
{
static DEFINE_SPINLOCK(ftrace_dump_lock);
Expand Down

0 comments on commit 48a12bc

Please sign in to comment.