diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-04-07 08:41:14 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-07 08:41:17 -0400 |
commit | 86665c75da41889f92b774f31ea5a9a436f392a8 (patch) | |
tree | 94b003ab677a64b7d0a6dcca1f636bbbc2a187c9 | |
parent | 93776a8ec746cf9d32c36e5a5b23d28d8be28826 (diff) | |
parent | 1bbe2a83ab68e5cf8c66c372c7cb3b51910c2cfe (diff) |
Merge branch 'tracing/urgent' into tracing/ftrace
-rw-r--r-- | arch/x86/kernel/ftrace.c | 1 | ||||
-rw-r--r-- | block/blk-core.c | 1 | ||||
-rw-r--r-- | include/linux/ftrace.h | 8 | ||||
-rw-r--r-- | include/linux/init_task.h | 2 | ||||
-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 | ||||
-rw-r--r-- | scripts/tracing/power.pl (renamed from scripts/trace/power.pl) | 0 |
12 files changed, 42 insertions, 15 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 61df77532120..70a10ca100f6 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -20,7 +20,6 @@ | |||
20 | 20 | ||
21 | #include <asm/cacheflush.h> | 21 | #include <asm/cacheflush.h> |
22 | #include <asm/ftrace.h> | 22 | #include <asm/ftrace.h> |
23 | #include <linux/ftrace.h> | ||
24 | #include <asm/nops.h> | 23 | #include <asm/nops.h> |
25 | #include <asm/nmi.h> | 24 | #include <asm/nmi.h> |
26 | 25 | ||
diff --git a/block/blk-core.c b/block/blk-core.c index 25572802dac2..ce0ea97f76d3 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -132,6 +132,7 @@ void blk_rq_init(struct request_queue *q, struct request *rq) | |||
132 | INIT_HLIST_NODE(&rq->hash); | 132 | INIT_HLIST_NODE(&rq->hash); |
133 | RB_CLEAR_NODE(&rq->rb_node); | 133 | RB_CLEAR_NODE(&rq->rb_node); |
134 | rq->cmd = rq->__cmd; | 134 | rq->cmd = rq->__cmd; |
135 | rq->cmd_len = BLK_MAX_CDB; | ||
135 | rq->tag = -1; | 136 | rq->tag = -1; |
136 | rq->ref_count = 1; | 137 | rq->ref_count = 1; |
137 | } | 138 | } |
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 9e0a8d245e55..6aea54d2dd3e 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -356,6 +356,9 @@ struct ftrace_graph_ret { | |||
356 | 356 | ||
357 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 357 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
358 | 358 | ||
359 | /* for init task */ | ||
360 | #define INIT_FTRACE_GRAPH .ret_stack = NULL | ||
361 | |||
359 | /* | 362 | /* |
360 | * Stack of return addresses for functions | 363 | * Stack of return addresses for functions |
361 | * of a thread. | 364 | * of a thread. |
@@ -429,10 +432,11 @@ static inline void unpause_graph_tracing(void) | |||
429 | { | 432 | { |
430 | atomic_dec(¤t->tracing_graph_pause); | 433 | atomic_dec(¤t->tracing_graph_pause); |
431 | } | 434 | } |
432 | #else | 435 | #else /* !CONFIG_FUNCTION_GRAPH_TRACER */ |
433 | 436 | ||
434 | #define __notrace_funcgraph | 437 | #define __notrace_funcgraph |
435 | #define __irq_entry | 438 | #define __irq_entry |
439 | #define INIT_FTRACE_GRAPH | ||
436 | 440 | ||
437 | static inline void ftrace_graph_init_task(struct task_struct *t) { } | 441 | static inline void ftrace_graph_init_task(struct task_struct *t) { } |
438 | static inline void ftrace_graph_exit_task(struct task_struct *t) { } | 442 | static inline void ftrace_graph_exit_task(struct task_struct *t) { } |
@@ -444,7 +448,7 @@ static inline int task_curr_ret_stack(struct task_struct *tsk) | |||
444 | 448 | ||
445 | static inline void pause_graph_tracing(void) { } | 449 | static inline void pause_graph_tracing(void) { } |
446 | static inline void unpause_graph_tracing(void) { } | 450 | static inline void unpause_graph_tracing(void) { } |
447 | #endif | 451 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
448 | 452 | ||
449 | #ifdef CONFIG_TRACING | 453 | #ifdef CONFIG_TRACING |
450 | #include <linux/sched.h> | 454 | #include <linux/sched.h> |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index af1de95e711e..dcfb93337e9a 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/irqflags.h> | 5 | #include <linux/irqflags.h> |
6 | #include <linux/utsname.h> | 6 | #include <linux/utsname.h> |
7 | #include <linux/lockdep.h> | 7 | #include <linux/lockdep.h> |
8 | #include <linux/ftrace.h> | ||
8 | #include <linux/ipc.h> | 9 | #include <linux/ipc.h> |
9 | #include <linux/pid_namespace.h> | 10 | #include <linux/pid_namespace.h> |
10 | #include <linux/user_namespace.h> | 11 | #include <linux/user_namespace.h> |
@@ -185,6 +186,7 @@ extern struct cred init_cred; | |||
185 | INIT_IDS \ | 186 | INIT_IDS \ |
186 | INIT_TRACE_IRQFLAGS \ | 187 | INIT_TRACE_IRQFLAGS \ |
187 | INIT_LOCKDEP \ | 188 | INIT_LOCKDEP \ |
189 | INIT_FTRACE_GRAPH \ | ||
188 | } | 190 | } |
189 | 191 | ||
190 | 192 | ||
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 2a81decf99bc..32653c8c6e26 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); |
@@ -1623,7 +1623,11 @@ static void test_cpu_buff_start(struct trace_iterator *iter) | |||
1623 | return; | 1623 | return; |
1624 | 1624 | ||
1625 | cpumask_set_cpu(iter->cpu, iter->started); | 1625 | cpumask_set_cpu(iter->cpu, iter->started); |
1626 | trace_seq_printf(s, "##### CPU %u buffer started ####\n", iter->cpu); | 1626 | |
1627 | /* Don't print started cpu buffer for the first entry of the trace */ | ||
1628 | if (iter->idx > 1) | ||
1629 | trace_seq_printf(s, "##### CPU %u buffer started ####\n", | ||
1630 | iter->cpu); | ||
1627 | } | 1631 | } |
1628 | 1632 | ||
1629 | static enum print_line_t print_trace_fmt(struct trace_iterator *iter) | 1633 | static enum print_line_t print_trace_fmt(struct trace_iterator *iter) |
@@ -1858,6 +1862,11 @@ __tracing_open(struct inode *inode, struct file *file) | |||
1858 | if (current_trace) | 1862 | if (current_trace) |
1859 | *iter->trace = *current_trace; | 1863 | *iter->trace = *current_trace; |
1860 | 1864 | ||
1865 | if (!alloc_cpumask_var(&iter->started, GFP_KERNEL)) | ||
1866 | goto fail; | ||
1867 | |||
1868 | cpumask_clear(iter->started); | ||
1869 | |||
1861 | if (current_trace && current_trace->print_max) | 1870 | if (current_trace && current_trace->print_max) |
1862 | iter->tr = &max_tr; | 1871 | iter->tr = &max_tr; |
1863 | else | 1872 | else |
@@ -1908,6 +1917,7 @@ __tracing_open(struct inode *inode, struct file *file) | |||
1908 | if (iter->buffer_iter[cpu]) | 1917 | if (iter->buffer_iter[cpu]) |
1909 | ring_buffer_read_finish(iter->buffer_iter[cpu]); | 1918 | ring_buffer_read_finish(iter->buffer_iter[cpu]); |
1910 | } | 1919 | } |
1920 | free_cpumask_var(iter->started); | ||
1911 | fail: | 1921 | fail: |
1912 | mutex_unlock(&trace_types_lock); | 1922 | mutex_unlock(&trace_types_lock); |
1913 | kfree(iter->trace); | 1923 | kfree(iter->trace); |
@@ -1951,6 +1961,7 @@ static int tracing_release(struct inode *inode, struct file *file) | |||
1951 | 1961 | ||
1952 | seq_release(inode, file); | 1962 | seq_release(inode, file); |
1953 | mutex_destroy(&iter->mutex); | 1963 | mutex_destroy(&iter->mutex); |
1964 | free_cpumask_var(iter->started); | ||
1954 | kfree(iter->trace); | 1965 | kfree(iter->trace); |
1955 | kfree(iter); | 1966 | kfree(iter); |
1956 | return 0; | 1967 | return 0; |
@@ -2349,9 +2360,9 @@ static const char readme_msg[] = | |||
2349 | "# mkdir /debug\n" | 2360 | "# mkdir /debug\n" |
2350 | "# mount -t debugfs nodev /debug\n\n" | 2361 | "# mount -t debugfs nodev /debug\n\n" |
2351 | "# cat /debug/tracing/available_tracers\n" | 2362 | "# cat /debug/tracing/available_tracers\n" |
2352 | "wakeup preemptirqsoff preemptoff irqsoff ftrace sched_switch none\n\n" | 2363 | "wakeup preemptirqsoff preemptoff irqsoff function sched_switch nop\n\n" |
2353 | "# cat /debug/tracing/current_tracer\n" | 2364 | "# cat /debug/tracing/current_tracer\n" |
2354 | "none\n" | 2365 | "nop\n" |
2355 | "# echo sched_switch > /debug/tracing/current_tracer\n" | 2366 | "# echo sched_switch > /debug/tracing/current_tracer\n" |
2356 | "# cat /debug/tracing/current_tracer\n" | 2367 | "# cat /debug/tracing/current_tracer\n" |
2357 | "sched_switch\n" | 2368 | "sched_switch\n" |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index fec6521ffa13..47aa6d0c97a0 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 aeac358ee231..0e70fb07ca78 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -433,7 +433,7 @@ int trace_print_lat_context(struct trace_iterator *iter) | |||
433 | 433 | ||
434 | trace_find_cmdline(entry->pid, comm); | 434 | trace_find_cmdline(entry->pid, comm); |
435 | 435 | ||
436 | ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08lx]" | 436 | ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08llx]" |
437 | " %ld.%03ldms (+%ld.%03ldms): ", comm, | 437 | " %ld.%03ldms (+%ld.%03ldms): ", comm, |
438 | entry->pid, iter->cpu, entry->flags, | 438 | entry->pid, iter->cpu, entry->flags, |
439 | entry->preempt_count, iter->idx, | 439 | 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: |
diff --git a/scripts/trace/power.pl b/scripts/tracing/power.pl index 4f729b3501e0..4f729b3501e0 100644 --- a/scripts/trace/power.pl +++ b/scripts/tracing/power.pl | |||