aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-02-18 18:33:57 -0500
committerSteven Rostedt <srostedt@redhat.com>2009-02-18 22:04:01 -0500
commit0c5119c1e655e0719a69601b1049acdd5ec1c125 (patch)
treee808e36e274afc7c6521f69194e6fc2597e189bd /kernel/trace
parent5b058bcde961bf28678a70e44c079107313543b6 (diff)
tracing: disable tracing while testing ring buffer
Impact: fix to prevent hard lockup on self tests If one of the tracers are broken and is constantly filling the ring buffer while the test of the ring buffer is running, it will hang the box. The reason is that the test is a consumer that will not stop till the ring buffer is empty. But if the tracer is broken and is constantly producing input to the buffer, this test will never end. The result is a lockup of the box. This happened when KALLSYMS was not defined and the dynamic ftrace test constantly filled the ring buffer, because the filter failed and all functions were being traced. Something was being called that constantly filled the buffer. Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_selftest.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 88c8eb70f54a..a7e0ef662f9f 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -57,11 +57,20 @@ static int trace_test_buffer(struct trace_array *tr, unsigned long *count)
57 57
58 cnt = ring_buffer_entries(tr->buffer); 58 cnt = ring_buffer_entries(tr->buffer);
59 59
60 /*
61 * The trace_test_buffer_cpu runs a while loop to consume all data.
62 * If the calling tracer is broken, and is constantly filling
63 * the buffer, this will run forever, and hard lock the box.
64 * We disable the ring buffer while we do this test to prevent
65 * a hard lock up.
66 */
67 tracing_off();
60 for_each_possible_cpu(cpu) { 68 for_each_possible_cpu(cpu) {
61 ret = trace_test_buffer_cpu(tr, cpu); 69 ret = trace_test_buffer_cpu(tr, cpu);
62 if (ret) 70 if (ret)
63 break; 71 break;
64 } 72 }
73 tracing_on();
65 __raw_spin_unlock(&ftrace_max_lock); 74 __raw_spin_unlock(&ftrace_max_lock);
66 local_irq_restore(flags); 75 local_irq_restore(flags);
67 76