From: Ingo Molnar Date: Sat, 8 Nov 2008 08:34:35 +0000 (+0100) Subject: Merge branches 'tracing/ftrace', 'tracing/fastboot', 'tracing/nmisafe' and 'tracing... X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a6b0786f7f83bcc4d414a2977aaebe2941ebe1de;p=mv-sheeva.git Merge branches 'tracing/ftrace', 'tracing/fastboot', 'tracing/nmisafe' and 'tracing/urgent' into tracing/core --- a6b0786f7f83bcc4d414a2977aaebe2941ebe1de diff --cc include/linux/ftrace.h index 7a75fc6d41f,1b340e3fa24,703eb53cfa2..1f5608c1102 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@@@ -214,11 -182,8 -181,6 +212,11 @@@@ static inline void __ftrace_enabled_res #endif #ifdef CONFIG_TRACING +extern int ftrace_dump_on_oops; + ++extern void tracing_start(void); ++extern void tracing_stop(void); ++ extern void ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); diff --cc kernel/trace/ring_buffer.c index a2dea500882,cedf4e26828,3f338063864..6781e9aab2c --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@@@ -1526,11 -1532,10 -1547,23 +1541,24 @@@@ rb_get_reader_page(struct ring_buffer_p { struct buffer_page *reader = NULL; unsigned long flags; ++ int nr_loops = 0; -- spin_lock_irqsave(&cpu_buffer->lock, flags); ++ local_irq_save(flags); ++ __raw_spin_lock(&cpu_buffer->lock); again: ++ /* ++ * This should normally only loop twice. But because the ++ * start of the reader inserts an empty page, it causes ++ * a case where we will loop three times. There should be no ++ * reason to loop four times (that I know of). ++ */ ++ if (unlikely(++nr_loops > 3)) { ++ RB_WARN_ON(cpu_buffer, 1); ++ reader = NULL; ++ goto out; ++ } ++ reader = cpu_buffer->reader_page; /* If there's more to read, return this page */ diff --cc kernel/trace/trace.c index ff1e9ed9b58,e4c40c868d6,974973e39e8..d55ccfc8d67 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@@@ -71,36 -62,38 -62,7 +71,36 @@@@ static cpumask_t __read_mostly tracing #define for_each_tracing_cpu(cpu) \ for_each_cpu_mask(cpu, 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 tracing_set_tracer(char *buf); + +static int __init set_ftrace(char *str) +{ + tracing_set_tracer(str); + return 1; +} +__setup("ftrace", set_ftrace); + +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)