Browse Source

Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  ftrace: prevent recursion
  tracing, doc: update mmiotrace documentation
  x86, mmiotrace: fix buffer overrun detection
  function tracing: fix wrong position computing of stack_trace
Linus Torvalds 16 years ago
parent
commit
7bbc67fbf6

+ 4 - 2
Documentation/tracers/mmiotrace.txt

@@ -37,7 +37,7 @@ $ echo mmiotrace > /debug/tracing/current_tracer
 $ cat /debug/tracing/trace_pipe > mydump.txt &
 $ cat /debug/tracing/trace_pipe > mydump.txt &
 Start X or whatever.
 Start X or whatever.
 $ echo "X is up" > /debug/tracing/trace_marker
 $ echo "X is up" > /debug/tracing/trace_marker
-$ echo none > /debug/tracing/current_tracer
+$ echo nop > /debug/tracing/current_tracer
 Check for lost events.
 Check for lost events.
 
 
 
 
@@ -66,7 +66,7 @@ which action. It is recommended to place descriptive markers about what you
 do.
 do.
 
 
 Shut down mmiotrace (requires root privileges):
 Shut down mmiotrace (requires root privileges):
-$ echo none > /debug/tracing/current_tracer
+$ echo nop > /debug/tracing/current_tracer
 The 'cat' process exits. If it does not, kill it by issuing 'fg' command and
 The 'cat' process exits. If it does not, kill it by issuing 'fg' command and
 pressing ctrl+c.
 pressing ctrl+c.
 
 
@@ -81,7 +81,9 @@ are:
 $ cat /debug/tracing/trace_entries
 $ cat /debug/tracing/trace_entries
 gives you a number. Approximately double this number and write it back, for
 gives you a number. Approximately double this number and write it back, for
 instance:
 instance:
+$ echo 0 > /debug/tracing/tracing_enabled
 $ echo 128000 > /debug/tracing/trace_entries
 $ echo 128000 > /debug/tracing/trace_entries
+$ echo 1 > /debug/tracing/tracing_enabled
 Then start again from the top.
 Then start again from the top.
 
 
 If you are doing a trace for a driver project, e.g. Nouveau, you should also
 If you are doing a trace for a driver project, e.g. Nouveau, you should also

+ 1 - 1
kernel/trace/ring_buffer.c

@@ -1215,7 +1215,7 @@ ring_buffer_lock_reserve(struct ring_buffer *buffer,
 
 
  out:
  out:
 	if (resched)
 	if (resched)
-		preempt_enable_notrace();
+		preempt_enable_no_resched_notrace();
 	else
 	else
 		preempt_enable_notrace();
 		preempt_enable_notrace();
 	return NULL;
 	return NULL;

+ 7 - 9
kernel/trace/trace_mmiotrace.c

@@ -18,12 +18,14 @@ struct header_iter {
 
 
 static struct trace_array *mmio_trace_array;
 static struct trace_array *mmio_trace_array;
 static bool overrun_detected;
 static bool overrun_detected;
+static unsigned long prev_overruns;
 
 
 static void mmio_reset_data(struct trace_array *tr)
 static void mmio_reset_data(struct trace_array *tr)
 {
 {
 	int cpu;
 	int cpu;
 
 
 	overrun_detected = false;
 	overrun_detected = false;
+	prev_overruns = 0;
 	tr->time_start = ftrace_now(tr->cpu);
 	tr->time_start = ftrace_now(tr->cpu);
 
 
 	for_each_online_cpu(cpu)
 	for_each_online_cpu(cpu)
@@ -128,16 +130,12 @@ static void mmio_close(struct trace_iterator *iter)
 
 
 static unsigned long count_overruns(struct trace_iterator *iter)
 static unsigned long count_overruns(struct trace_iterator *iter)
 {
 {
-	int cpu;
 	unsigned long cnt = 0;
 	unsigned long cnt = 0;
-/* FIXME: */
-#if 0
-	for_each_online_cpu(cpu) {
-		cnt += iter->overrun[cpu];
-		iter->overrun[cpu] = 0;
-	}
-#endif
-	(void)cpu;
+	unsigned long over = ring_buffer_overruns(iter->tr->buffer);
+
+	if (over > prev_overruns)
+		cnt = over - prev_overruns;
+	prev_overruns = over;
 	return cnt;
 	return cnt;
 }
 }
 
 

+ 15 - 9
kernel/trace/trace_stack.c

@@ -184,11 +184,16 @@ static struct file_operations stack_max_size_fops = {
 static void *
 static void *
 t_next(struct seq_file *m, void *v, loff_t *pos)
 t_next(struct seq_file *m, void *v, loff_t *pos)
 {
 {
-	long i = (long)m->private;
+	long i;
 
 
 	(*pos)++;
 	(*pos)++;
 
 
-	i++;
+	if (v == SEQ_START_TOKEN)
+		i = 0;
+	else {
+		i = *(long *)v;
+		i++;
+	}
 
 
 	if (i >= max_stack_trace.nr_entries ||
 	if (i >= max_stack_trace.nr_entries ||
 	    stack_dump_trace[i] == ULONG_MAX)
 	    stack_dump_trace[i] == ULONG_MAX)
@@ -201,12 +206,15 @@ t_next(struct seq_file *m, void *v, loff_t *pos)
 
 
 static void *t_start(struct seq_file *m, loff_t *pos)
 static void *t_start(struct seq_file *m, loff_t *pos)
 {
 {
-	void *t = &m->private;
+	void *t = SEQ_START_TOKEN;
 	loff_t l = 0;
 	loff_t l = 0;
 
 
 	local_irq_disable();
 	local_irq_disable();
 	__raw_spin_lock(&max_stack_lock);
 	__raw_spin_lock(&max_stack_lock);
 
 
+	if (*pos == 0)
+		return SEQ_START_TOKEN;
+
 	for (; t && l < *pos; t = t_next(m, t, &l))
 	for (; t && l < *pos; t = t_next(m, t, &l))
 		;
 		;
 
 
@@ -235,10 +243,10 @@ static int trace_lookup_stack(struct seq_file *m, long i)
 
 
 static int t_show(struct seq_file *m, void *v)
 static int t_show(struct seq_file *m, void *v)
 {
 {
-	long i = *(long *)v;
+	long i;
 	int size;
 	int size;
 
 
-	if (i < 0) {
+	if (v == SEQ_START_TOKEN) {
 		seq_printf(m, "        Depth   Size      Location"
 		seq_printf(m, "        Depth   Size      Location"
 			   "    (%d entries)\n"
 			   "    (%d entries)\n"
 			   "        -----   ----      --------\n",
 			   "        -----   ----      --------\n",
@@ -246,6 +254,8 @@ static int t_show(struct seq_file *m, void *v)
 		return 0;
 		return 0;
 	}
 	}
 
 
+	i = *(long *)v;
+
 	if (i >= max_stack_trace.nr_entries ||
 	if (i >= max_stack_trace.nr_entries ||
 	    stack_dump_trace[i] == ULONG_MAX)
 	    stack_dump_trace[i] == ULONG_MAX)
 		return 0;
 		return 0;
@@ -275,10 +285,6 @@ static int stack_trace_open(struct inode *inode, struct file *file)
 	int ret;
 	int ret;
 
 
 	ret = seq_open(file, &stack_trace_seq_ops);
 	ret = seq_open(file, &stack_trace_seq_ops);
-	if (!ret) {
-		struct seq_file *m = file->private_data;
-		m->private = (void *)-1;
-	}
 
 
 	return ret;
 	return ret;
 }
 }