diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-31 18:53:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-31 18:53:30 -0500 |
commit | f6490438fce5902f840d1f0f905295077c635e7a (patch) | |
tree | 4b40f6b9d42a6e237b45378206d95cbfddfeaf52 /kernel | |
parent | e81cfd214f97a26ca2b00564258ebcf099214cbb (diff) | |
parent | ba2607fe9c1f2d4ad5a3d4c4ae9117c5bfdca826 (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:
x86, ds, bts: cleanup/fix DS configuration
ring-buffer: reset timestamps when ring buffer is reset
trace: set max latency variable to zero on default
trace: stop all recording to ring buffer on ftrace_dump
trace: print ftrace_dump at KERN_EMERG log level
ring_buffer: reset write when reserve buffer fail
tracing/function-graph-tracer: fix a regression while suspend to disk
ring-buffer: fix alignment problem
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/ftrace.c | 27 | ||||
-rw-r--r-- | kernel/trace/ring_buffer.c | 15 | ||||
-rw-r--r-- | kernel/trace/trace.c | 5 | ||||
-rw-r--r-- | kernel/trace/trace_irqsoff.c | 1 | ||||
-rw-r--r-- | kernel/trace/trace_sched_wakeup.c | 1 |
5 files changed, 41 insertions, 8 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 2f32969c09df..7dcf6e9f2b04 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/clocksource.h> | 17 | #include <linux/clocksource.h> |
18 | #include <linux/kallsyms.h> | 18 | #include <linux/kallsyms.h> |
19 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
20 | #include <linux/suspend.h> | ||
20 | #include <linux/debugfs.h> | 21 | #include <linux/debugfs.h> |
21 | #include <linux/hardirq.h> | 22 | #include <linux/hardirq.h> |
22 | #include <linux/kthread.h> | 23 | #include <linux/kthread.h> |
@@ -1965,6 +1966,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, | |||
1965 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 1966 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
1966 | 1967 | ||
1967 | static atomic_t ftrace_graph_active; | 1968 | static atomic_t ftrace_graph_active; |
1969 | static struct notifier_block ftrace_suspend_notifier; | ||
1968 | 1970 | ||
1969 | int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace) | 1971 | int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace) |
1970 | { | 1972 | { |
@@ -2043,6 +2045,27 @@ static int start_graph_tracing(void) | |||
2043 | return ret; | 2045 | return ret; |
2044 | } | 2046 | } |
2045 | 2047 | ||
2048 | /* | ||
2049 | * Hibernation protection. | ||
2050 | * The state of the current task is too much unstable during | ||
2051 | * suspend/restore to disk. We want to protect against that. | ||
2052 | */ | ||
2053 | static int | ||
2054 | ftrace_suspend_notifier_call(struct notifier_block *bl, unsigned long state, | ||
2055 | void *unused) | ||
2056 | { | ||
2057 | switch (state) { | ||
2058 | case PM_HIBERNATION_PREPARE: | ||
2059 | pause_graph_tracing(); | ||
2060 | break; | ||
2061 | |||
2062 | case PM_POST_HIBERNATION: | ||
2063 | unpause_graph_tracing(); | ||
2064 | break; | ||
2065 | } | ||
2066 | return NOTIFY_DONE; | ||
2067 | } | ||
2068 | |||
2046 | int register_ftrace_graph(trace_func_graph_ret_t retfunc, | 2069 | int register_ftrace_graph(trace_func_graph_ret_t retfunc, |
2047 | trace_func_graph_ent_t entryfunc) | 2070 | trace_func_graph_ent_t entryfunc) |
2048 | { | 2071 | { |
@@ -2050,6 +2073,9 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc, | |||
2050 | 2073 | ||
2051 | mutex_lock(&ftrace_sysctl_lock); | 2074 | mutex_lock(&ftrace_sysctl_lock); |
2052 | 2075 | ||
2076 | ftrace_suspend_notifier.notifier_call = ftrace_suspend_notifier_call; | ||
2077 | register_pm_notifier(&ftrace_suspend_notifier); | ||
2078 | |||
2053 | atomic_inc(&ftrace_graph_active); | 2079 | atomic_inc(&ftrace_graph_active); |
2054 | ret = start_graph_tracing(); | 2080 | ret = start_graph_tracing(); |
2055 | if (ret) { | 2081 | if (ret) { |
@@ -2075,6 +2101,7 @@ void unregister_ftrace_graph(void) | |||
2075 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; | 2101 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; |
2076 | ftrace_graph_entry = ftrace_graph_entry_stub; | 2102 | ftrace_graph_entry = ftrace_graph_entry_stub; |
2077 | ftrace_shutdown(FTRACE_STOP_FUNC_RET); | 2103 | ftrace_shutdown(FTRACE_STOP_FUNC_RET); |
2104 | unregister_pm_notifier(&ftrace_suspend_notifier); | ||
2078 | 2105 | ||
2079 | mutex_unlock(&ftrace_sysctl_lock); | 2106 | mutex_unlock(&ftrace_sysctl_lock); |
2080 | } | 2107 | } |
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 8b0daf0662ef..bd38c5cfd8ad 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -246,7 +246,7 @@ static inline int test_time_stamp(u64 delta) | |||
246 | return 0; | 246 | return 0; |
247 | } | 247 | } |
248 | 248 | ||
249 | #define BUF_PAGE_SIZE (PAGE_SIZE - sizeof(struct buffer_data_page)) | 249 | #define BUF_PAGE_SIZE (PAGE_SIZE - offsetof(struct buffer_data_page, data)) |
250 | 250 | ||
251 | /* | 251 | /* |
252 | * head_page == tail_page && head == tail then buffer is empty. | 252 | * head_page == tail_page && head == tail then buffer is empty. |
@@ -1025,12 +1025,8 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer, | |||
1025 | } | 1025 | } |
1026 | 1026 | ||
1027 | if (next_page == head_page) { | 1027 | if (next_page == head_page) { |
1028 | if (!(buffer->flags & RB_FL_OVERWRITE)) { | 1028 | if (!(buffer->flags & RB_FL_OVERWRITE)) |
1029 | /* reset write */ | ||
1030 | if (tail <= BUF_PAGE_SIZE) | ||
1031 | local_set(&tail_page->write, tail); | ||
1032 | goto out_unlock; | 1029 | goto out_unlock; |
1033 | } | ||
1034 | 1030 | ||
1035 | /* tail_page has not moved yet? */ | 1031 | /* tail_page has not moved yet? */ |
1036 | if (tail_page == cpu_buffer->tail_page) { | 1032 | if (tail_page == cpu_buffer->tail_page) { |
@@ -1105,6 +1101,10 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer, | |||
1105 | return event; | 1101 | return event; |
1106 | 1102 | ||
1107 | out_unlock: | 1103 | out_unlock: |
1104 | /* reset write */ | ||
1105 | if (tail <= BUF_PAGE_SIZE) | ||
1106 | local_set(&tail_page->write, tail); | ||
1107 | |||
1108 | __raw_spin_unlock(&cpu_buffer->lock); | 1108 | __raw_spin_unlock(&cpu_buffer->lock); |
1109 | local_irq_restore(flags); | 1109 | local_irq_restore(flags); |
1110 | return NULL; | 1110 | return NULL; |
@@ -2174,6 +2174,9 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer) | |||
2174 | 2174 | ||
2175 | cpu_buffer->overrun = 0; | 2175 | cpu_buffer->overrun = 0; |
2176 | cpu_buffer->entries = 0; | 2176 | cpu_buffer->entries = 0; |
2177 | |||
2178 | cpu_buffer->write_stamp = 0; | ||
2179 | cpu_buffer->read_stamp = 0; | ||
2177 | } | 2180 | } |
2178 | 2181 | ||
2179 | /** | 2182 | /** |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index c580233add95..17bb88d86ac2 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | #define TRACE_BUFFER_FLAGS (RB_FL_OVERWRITE) | 41 | #define TRACE_BUFFER_FLAGS (RB_FL_OVERWRITE) |
42 | 42 | ||
43 | unsigned long __read_mostly tracing_max_latency = (cycle_t)ULONG_MAX; | 43 | unsigned long __read_mostly tracing_max_latency; |
44 | unsigned long __read_mostly tracing_thresh; | 44 | unsigned long __read_mostly tracing_thresh; |
45 | 45 | ||
46 | /* | 46 | /* |
@@ -3736,7 +3736,7 @@ static struct notifier_block trace_die_notifier = { | |||
3736 | * it if we decide to change what log level the ftrace dump | 3736 | * it if we decide to change what log level the ftrace dump |
3737 | * should be at. | 3737 | * should be at. |
3738 | */ | 3738 | */ |
3739 | #define KERN_TRACE KERN_INFO | 3739 | #define KERN_TRACE KERN_EMERG |
3740 | 3740 | ||
3741 | static void | 3741 | static void |
3742 | trace_printk_seq(struct trace_seq *s) | 3742 | trace_printk_seq(struct trace_seq *s) |
@@ -3770,6 +3770,7 @@ void ftrace_dump(void) | |||
3770 | dump_ran = 1; | 3770 | dump_ran = 1; |
3771 | 3771 | ||
3772 | /* No turning back! */ | 3772 | /* No turning back! */ |
3773 | tracing_off(); | ||
3773 | ftrace_kill(); | 3774 | ftrace_kill(); |
3774 | 3775 | ||
3775 | for_each_tracing_cpu(cpu) { | 3776 | for_each_tracing_cpu(cpu) { |
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index 7c2e326bbc8b..62a78d943534 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c | |||
@@ -380,6 +380,7 @@ static void stop_irqsoff_tracer(struct trace_array *tr) | |||
380 | 380 | ||
381 | static void __irqsoff_tracer_init(struct trace_array *tr) | 381 | static void __irqsoff_tracer_init(struct trace_array *tr) |
382 | { | 382 | { |
383 | tracing_max_latency = 0; | ||
383 | irqsoff_trace = tr; | 384 | irqsoff_trace = tr; |
384 | /* make sure that the tracer is visible */ | 385 | /* make sure that the tracer is visible */ |
385 | smp_wmb(); | 386 | smp_wmb(); |
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c index 43586b689e31..42ae1e77b6b3 100644 --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c | |||
@@ -333,6 +333,7 @@ static void stop_wakeup_tracer(struct trace_array *tr) | |||
333 | 333 | ||
334 | static int wakeup_tracer_init(struct trace_array *tr) | 334 | static int wakeup_tracer_init(struct trace_array *tr) |
335 | { | 335 | { |
336 | tracing_max_latency = 0; | ||
336 | wakeup_trace = tr; | 337 | wakeup_trace = tr; |
337 | start_wakeup_tracer(tr); | 338 | start_wakeup_tracer(tr); |
338 | return 0; | 339 | return 0; |