Skip to content

Commit

Permalink
Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/sc…
Browse files Browse the repository at this point in the history
…m/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
  • Loading branch information
torvalds committed Nov 30, 2008
2 parents 66a45cc + 4f5a7f4 commit 7bbc67f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
6 changes: 4 additions & 2 deletions Documentation/tracers/mmiotrace.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $ echo mmiotrace > /debug/tracing/current_tracer
$ cat /debug/tracing/trace_pipe > mydump.txt &
Start X or whatever.
$ echo "X is up" > /debug/tracing/trace_marker
$ echo none > /debug/tracing/current_tracer
$ echo nop > /debug/tracing/current_tracer
Check for lost events.


Expand Down Expand Up @@ -66,7 +66,7 @@ which action. It is recommended to place descriptive markers about what you
do.

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
pressing ctrl+c.

Expand All @@ -81,7 +81,9 @@ are:
$ cat /debug/tracing/trace_entries
gives you a number. Approximately double this number and write it back, for
instance:
$ echo 0 > /debug/tracing/tracing_enabled
$ echo 128000 > /debug/tracing/trace_entries
$ echo 1 > /debug/tracing/tracing_enabled
Then start again from the top.

If you are doing a trace for a driver project, e.g. Nouveau, you should also
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ ring_buffer_lock_reserve(struct ring_buffer *buffer,

out:
if (resched)
preempt_enable_notrace();
preempt_enable_no_resched_notrace();
else
preempt_enable_notrace();
return NULL;
Expand Down
16 changes: 7 additions & 9 deletions kernel/trace/trace_mmiotrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ struct header_iter {

static struct trace_array *mmio_trace_array;
static bool overrun_detected;
static unsigned long prev_overruns;

static void mmio_reset_data(struct trace_array *tr)
{
int cpu;

overrun_detected = false;
prev_overruns = 0;
tr->time_start = ftrace_now(tr->cpu);

for_each_online_cpu(cpu)
Expand Down Expand Up @@ -128,16 +130,12 @@ static void mmio_close(struct trace_iterator *iter)

static unsigned long count_overruns(struct trace_iterator *iter)
{
int cpu;
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;
}

Expand Down
24 changes: 15 additions & 9 deletions kernel/trace/trace_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,16 @@ static struct file_operations stack_max_size_fops = {
static void *
t_next(struct seq_file *m, void *v, loff_t *pos)
{
long i = (long)m->private;
long i;

(*pos)++;

i++;
if (v == SEQ_START_TOKEN)
i = 0;
else {
i = *(long *)v;
i++;
}

if (i >= max_stack_trace.nr_entries ||
stack_dump_trace[i] == ULONG_MAX)
Expand All @@ -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)
{
void *t = &m->private;
void *t = SEQ_START_TOKEN;
loff_t l = 0;

local_irq_disable();
__raw_spin_lock(&max_stack_lock);

if (*pos == 0)
return SEQ_START_TOKEN;

for (; t && l < *pos; t = t_next(m, t, &l))
;

Expand Down Expand Up @@ -235,17 +243,19 @@ static int trace_lookup_stack(struct seq_file *m, long i)

static int t_show(struct seq_file *m, void *v)
{
long i = *(long *)v;
long i;
int size;

if (i < 0) {
if (v == SEQ_START_TOKEN) {
seq_printf(m, " Depth Size Location"
" (%d entries)\n"
" ----- ---- --------\n",
max_stack_trace.nr_entries);
return 0;
}

i = *(long *)v;

if (i >= max_stack_trace.nr_entries ||
stack_dump_trace[i] == ULONG_MAX)
return 0;
Expand Down Expand Up @@ -275,10 +285,6 @@ static int stack_trace_open(struct inode *inode, struct file *file)
int ret;

ret = seq_open(file, &stack_trace_seq_ops);
if (!ret) {
struct seq_file *m = file->private_data;
m->private = (void *)-1;
}

return ret;
}
Expand Down

0 comments on commit 7bbc67f

Please sign in to comment.