#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);
{
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 */
#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)