diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-07 17:10:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-07 17:10:10 -0400 |
commit | c93f216b5b985a12a18323e5ca2eb01db3d2f000 (patch) | |
tree | 45fa35b290005f8b241dd76b6342875b81432fc3 /kernel/trace | |
parent | c61b79b6ef266890954213a701d8f6021d8c1289 (diff) | |
parent | ab3c9c686e22ab264269337ce7b75d9760211198 (diff) |
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:
branch tracer, intel-iommu: fix build with CONFIG_BRANCH_TRACER=y
branch tracer: Fix for enabling branch profiling makes sparse unusable
ftrace: Correct a text align for event format output
Update /debug/tracing/README
tracing/ftrace: alloc the started cpumask for the trace file
tracing, x86: remove duplicated #include
ftrace: Add check of sched_stopped for probe_sched_wakeup
function-graph: add proper initialization for init task
tracing/ftrace: fix missing include string.h
tracing: fix incorrect return type of ns2usecs()
tracing: remove CALLER_ADDR2 from wakeup tracer
blktrace: fix pdu_len when tracing packet command requests
blktrace: small cleanup in blk_msg_write()
blktrace: NUL-terminate user space messages
tracing: move scripts/trace/power.pl to scripts/tracing/power.pl
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/blktrace.c | 7 | ||||
-rw-r--r-- | kernel/trace/trace.c | 21 | ||||
-rw-r--r-- | kernel/trace/trace.h | 2 | ||||
-rw-r--r-- | kernel/trace/trace_export.c | 2 | ||||
-rw-r--r-- | kernel/trace/trace_output.c | 2 | ||||
-rw-r--r-- | kernel/trace/trace_sched_switch.c | 3 | ||||
-rw-r--r-- | kernel/trace/trace_sched_wakeup.c | 8 |
7 files changed, 33 insertions, 12 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 947c5b3f90c4..b32ff446c3fb 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -327,10 +327,10 @@ static ssize_t blk_msg_write(struct file *filp, const char __user *buffer, | |||
327 | char *msg; | 327 | char *msg; |
328 | struct blk_trace *bt; | 328 | struct blk_trace *bt; |
329 | 329 | ||
330 | if (count > BLK_TN_MAX_MSG) | 330 | if (count >= BLK_TN_MAX_MSG) |
331 | return -EINVAL; | 331 | return -EINVAL; |
332 | 332 | ||
333 | msg = kmalloc(count, GFP_KERNEL); | 333 | msg = kmalloc(count + 1, GFP_KERNEL); |
334 | if (msg == NULL) | 334 | if (msg == NULL) |
335 | return -ENOMEM; | 335 | return -ENOMEM; |
336 | 336 | ||
@@ -339,6 +339,7 @@ static ssize_t blk_msg_write(struct file *filp, const char __user *buffer, | |||
339 | return -EFAULT; | 339 | return -EFAULT; |
340 | } | 340 | } |
341 | 341 | ||
342 | msg[count] = '\0'; | ||
342 | bt = filp->private_data; | 343 | bt = filp->private_data; |
343 | __trace_note_message(bt, "%s", msg); | 344 | __trace_note_message(bt, "%s", msg); |
344 | kfree(msg); | 345 | kfree(msg); |
@@ -642,7 +643,7 @@ static void blk_add_trace_rq(struct request_queue *q, struct request *rq, | |||
642 | if (blk_pc_request(rq)) { | 643 | if (blk_pc_request(rq)) { |
643 | what |= BLK_TC_ACT(BLK_TC_PC); | 644 | what |= BLK_TC_ACT(BLK_TC_PC); |
644 | __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, | 645 | __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, |
645 | sizeof(rq->cmd), rq->cmd); | 646 | rq->cmd_len, rq->cmd); |
646 | } else { | 647 | } else { |
647 | what |= BLK_TC_ACT(BLK_TC_FS); | 648 | what |= BLK_TC_ACT(BLK_TC_FS); |
648 | __blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9, | 649 | __blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9, |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index a0174a40c563..9d28476a9851 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/percpu.h> | 30 | #include <linux/percpu.h> |
31 | #include <linux/splice.h> | 31 | #include <linux/splice.h> |
32 | #include <linux/kdebug.h> | 32 | #include <linux/kdebug.h> |
33 | #include <linux/string.h> | ||
33 | #include <linux/ctype.h> | 34 | #include <linux/ctype.h> |
34 | #include <linux/init.h> | 35 | #include <linux/init.h> |
35 | #include <linux/poll.h> | 36 | #include <linux/poll.h> |
@@ -147,8 +148,7 @@ static int __init set_ftrace_dump_on_oops(char *str) | |||
147 | } | 148 | } |
148 | __setup("ftrace_dump_on_oops", set_ftrace_dump_on_oops); | 149 | __setup("ftrace_dump_on_oops", set_ftrace_dump_on_oops); |
149 | 150 | ||
150 | long | 151 | unsigned long long ns2usecs(cycle_t nsec) |
151 | ns2usecs(cycle_t nsec) | ||
152 | { | 152 | { |
153 | nsec += 500; | 153 | nsec += 500; |
154 | do_div(nsec, 1000); | 154 | do_div(nsec, 1000); |
@@ -1632,7 +1632,11 @@ static void test_cpu_buff_start(struct trace_iterator *iter) | |||
1632 | return; | 1632 | return; |
1633 | 1633 | ||
1634 | cpumask_set_cpu(iter->cpu, iter->started); | 1634 | cpumask_set_cpu(iter->cpu, iter->started); |
1635 | trace_seq_printf(s, "##### CPU %u buffer started ####\n", iter->cpu); | 1635 | |
1636 | /* Don't print started cpu buffer for the first entry of the trace */ | ||
1637 | if (iter->idx > 1) | ||
1638 | trace_seq_printf(s, "##### CPU %u buffer started ####\n", | ||
1639 | iter->cpu); | ||
1636 | } | 1640 | } |
1637 | 1641 | ||
1638 | static enum print_line_t print_trace_fmt(struct trace_iterator *iter) | 1642 | static enum print_line_t print_trace_fmt(struct trace_iterator *iter) |
@@ -1867,6 +1871,11 @@ __tracing_open(struct inode *inode, struct file *file) | |||
1867 | if (current_trace) | 1871 | if (current_trace) |
1868 | *iter->trace = *current_trace; | 1872 | *iter->trace = *current_trace; |
1869 | 1873 | ||
1874 | if (!alloc_cpumask_var(&iter->started, GFP_KERNEL)) | ||
1875 | goto fail; | ||
1876 | |||
1877 | cpumask_clear(iter->started); | ||
1878 | |||
1870 | if (current_trace && current_trace->print_max) | 1879 | if (current_trace && current_trace->print_max) |
1871 | iter->tr = &max_tr; | 1880 | iter->tr = &max_tr; |
1872 | else | 1881 | else |
@@ -1917,6 +1926,7 @@ __tracing_open(struct inode *inode, struct file *file) | |||
1917 | if (iter->buffer_iter[cpu]) | 1926 | if (iter->buffer_iter[cpu]) |
1918 | ring_buffer_read_finish(iter->buffer_iter[cpu]); | 1927 | ring_buffer_read_finish(iter->buffer_iter[cpu]); |
1919 | } | 1928 | } |
1929 | free_cpumask_var(iter->started); | ||
1920 | fail: | 1930 | fail: |
1921 | mutex_unlock(&trace_types_lock); | 1931 | mutex_unlock(&trace_types_lock); |
1922 | kfree(iter->trace); | 1932 | kfree(iter->trace); |
@@ -1960,6 +1970,7 @@ static int tracing_release(struct inode *inode, struct file *file) | |||
1960 | 1970 | ||
1961 | seq_release(inode, file); | 1971 | seq_release(inode, file); |
1962 | mutex_destroy(&iter->mutex); | 1972 | mutex_destroy(&iter->mutex); |
1973 | free_cpumask_var(iter->started); | ||
1963 | kfree(iter->trace); | 1974 | kfree(iter->trace); |
1964 | kfree(iter); | 1975 | kfree(iter); |
1965 | return 0; | 1976 | return 0; |
@@ -2358,9 +2369,9 @@ static const char readme_msg[] = | |||
2358 | "# mkdir /debug\n" | 2369 | "# mkdir /debug\n" |
2359 | "# mount -t debugfs nodev /debug\n\n" | 2370 | "# mount -t debugfs nodev /debug\n\n" |
2360 | "# cat /debug/tracing/available_tracers\n" | 2371 | "# cat /debug/tracing/available_tracers\n" |
2361 | "wakeup preemptirqsoff preemptoff irqsoff ftrace sched_switch none\n\n" | 2372 | "wakeup preemptirqsoff preemptoff irqsoff function sched_switch nop\n\n" |
2362 | "# cat /debug/tracing/current_tracer\n" | 2373 | "# cat /debug/tracing/current_tracer\n" |
2363 | "none\n" | 2374 | "nop\n" |
2364 | "# echo sched_switch > /debug/tracing/current_tracer\n" | 2375 | "# echo sched_switch > /debug/tracing/current_tracer\n" |
2365 | "# cat /debug/tracing/current_tracer\n" | 2376 | "# cat /debug/tracing/current_tracer\n" |
2366 | "sched_switch\n" | 2377 | "sched_switch\n" |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index cbc168f1e43d..e685ac2b2ba1 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -602,7 +602,7 @@ extern int trace_selftest_startup_branch(struct tracer *trace, | |||
602 | #endif /* CONFIG_FTRACE_STARTUP_TEST */ | 602 | #endif /* CONFIG_FTRACE_STARTUP_TEST */ |
603 | 603 | ||
604 | extern void *head_page(struct trace_array_cpu *data); | 604 | extern void *head_page(struct trace_array_cpu *data); |
605 | extern long ns2usecs(cycle_t nsec); | 605 | extern unsigned long long ns2usecs(cycle_t nsec); |
606 | extern int | 606 | extern int |
607 | trace_vbprintk(unsigned long ip, const char *fmt, va_list args); | 607 | trace_vbprintk(unsigned long ip, const char *fmt, va_list args); |
608 | extern int | 608 | extern int |
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 4d9952d3df50..07a22c33ebf3 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | #undef TRACE_FIELD_ZERO_CHAR | 41 | #undef TRACE_FIELD_ZERO_CHAR |
42 | #define TRACE_FIELD_ZERO_CHAR(item) \ | 42 | #define TRACE_FIELD_ZERO_CHAR(item) \ |
43 | ret = trace_seq_printf(s, "\tfield: char " #item ";\t" \ | 43 | ret = trace_seq_printf(s, "\tfield:char " #item ";\t" \ |
44 | "offset:%u;\tsize:0;\n", \ | 44 | "offset:%u;\tsize:0;\n", \ |
45 | (unsigned int)offsetof(typeof(field), item)); \ | 45 | (unsigned int)offsetof(typeof(field), item)); \ |
46 | if (!ret) \ | 46 | if (!ret) \ |
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index d72b9a63b247..64b54a59c55b 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -423,7 +423,7 @@ int trace_print_lat_context(struct trace_iterator *iter) | |||
423 | 423 | ||
424 | trace_find_cmdline(entry->pid, comm); | 424 | trace_find_cmdline(entry->pid, comm); |
425 | 425 | ||
426 | ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08lx]" | 426 | ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08llx]" |
427 | " %ld.%03ldms (+%ld.%03ldms): ", comm, | 427 | " %ld.%03ldms (+%ld.%03ldms): ", comm, |
428 | entry->pid, iter->cpu, entry->flags, | 428 | entry->pid, iter->cpu, entry->flags, |
429 | entry->preempt_count, iter->idx, | 429 | entry->preempt_count, iter->idx, |
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c index de35f200abd3..9117cea6f1ae 100644 --- a/kernel/trace/trace_sched_switch.c +++ b/kernel/trace/trace_sched_switch.c | |||
@@ -62,6 +62,9 @@ probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee, int success) | |||
62 | pc = preempt_count(); | 62 | pc = preempt_count(); |
63 | tracing_record_cmdline(current); | 63 | tracing_record_cmdline(current); |
64 | 64 | ||
65 | if (sched_stopped) | ||
66 | return; | ||
67 | |||
65 | local_irq_save(flags); | 68 | local_irq_save(flags); |
66 | cpu = raw_smp_processor_id(); | 69 | cpu = raw_smp_processor_id(); |
67 | data = ctx_trace->data[cpu]; | 70 | data = ctx_trace->data[cpu]; |
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c index 3c5ad6b2ec84..5bc00e8f153e 100644 --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c | |||
@@ -154,7 +154,7 @@ probe_wakeup_sched_switch(struct rq *rq, struct task_struct *prev, | |||
154 | if (unlikely(!tracer_enabled || next != wakeup_task)) | 154 | if (unlikely(!tracer_enabled || next != wakeup_task)) |
155 | goto out_unlock; | 155 | goto out_unlock; |
156 | 156 | ||
157 | trace_function(wakeup_trace, CALLER_ADDR1, CALLER_ADDR2, flags, pc); | 157 | trace_function(wakeup_trace, CALLER_ADDR0, CALLER_ADDR1, flags, pc); |
158 | tracing_sched_switch_trace(wakeup_trace, prev, next, flags, pc); | 158 | tracing_sched_switch_trace(wakeup_trace, prev, next, flags, pc); |
159 | 159 | ||
160 | /* | 160 | /* |
@@ -257,6 +257,12 @@ probe_wakeup(struct rq *rq, struct task_struct *p, int success) | |||
257 | data = wakeup_trace->data[wakeup_cpu]; | 257 | data = wakeup_trace->data[wakeup_cpu]; |
258 | data->preempt_timestamp = ftrace_now(cpu); | 258 | data->preempt_timestamp = ftrace_now(cpu); |
259 | tracing_sched_wakeup_trace(wakeup_trace, p, current, flags, pc); | 259 | tracing_sched_wakeup_trace(wakeup_trace, p, current, flags, pc); |
260 | |||
261 | /* | ||
262 | * We must be careful in using CALLER_ADDR2. But since wake_up | ||
263 | * is not called by an assembly function (where as schedule is) | ||
264 | * it should be safe to use it here. | ||
265 | */ | ||
260 | trace_function(wakeup_trace, CALLER_ADDR1, CALLER_ADDR2, flags, pc); | 266 | trace_function(wakeup_trace, CALLER_ADDR1, CALLER_ADDR2, flags, pc); |
261 | 267 | ||
262 | out_locked: | 268 | out_locked: |