aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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