diff options
author | Daniel Thompson <daniel.thompson@linaro.org> | 2014-11-06 07:41:56 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-11-13 21:27:25 -0500 |
commit | 8520dedbbf7578a397ecdfcf6ab83f775f914cfe (patch) | |
tree | fd60f0d3d8775a623ad5ac31042cd8ae4ba337c0 /kernel/trace | |
parent | c270cc75cd22b606c901e606fbb93b002c2a655f (diff) |
tracing: kdb: Fix kernel livelock with empty buffers
Currently kdb's ftdump command will livelock by constantly printk'ing
the empty string at KERN_EMERG level if it run when the ftrace system is
not in use. This occurs because trace_empty() never returns false when
the ring buffers are left at the start of a non-consuming read [launched
by ring_buffer_read_start()].
This patch changes the loop exit condition to use the result of
trace_find_next_entry_inc(). Effectively this switches the non-consuming
kdb dumper to follow the approach of the non-consuming userspace
interface [s_next()] rather than the consuming ftrace_dump().
Link: http://lkml.kernel.org/r/1415277716-19419-3-git-send-email-daniel.thompson@linaro.org
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace_kdb.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/trace/trace_kdb.c b/kernel/trace/trace_kdb.c index 8faa7ce58814..b0b1c44e923a 100644 --- a/kernel/trace/trace_kdb.c +++ b/kernel/trace/trace_kdb.c | |||
@@ -59,19 +59,19 @@ static void ftrace_dump_buf(int skip_lines, long cpu_file) | |||
59 | ring_buffer_read_start(iter.buffer_iter[cpu_file]); | 59 | ring_buffer_read_start(iter.buffer_iter[cpu_file]); |
60 | tracing_iter_reset(&iter, cpu_file); | 60 | tracing_iter_reset(&iter, cpu_file); |
61 | } | 61 | } |
62 | if (!trace_empty(&iter)) | 62 | |
63 | trace_find_next_entry_inc(&iter); | 63 | while (trace_find_next_entry_inc(&iter)) { |
64 | while (!trace_empty(&iter)) { | ||
65 | if (!cnt) | 64 | if (!cnt) |
66 | kdb_printf("---------------------------------\n"); | 65 | kdb_printf("---------------------------------\n"); |
67 | cnt++; | 66 | cnt++; |
68 | 67 | ||
69 | if (trace_find_next_entry_inc(&iter) != NULL && !skip_lines) | 68 | if (!skip_lines) { |
70 | print_trace_line(&iter); | 69 | print_trace_line(&iter); |
71 | if (!skip_lines) | ||
72 | trace_printk_seq(&iter.seq); | 70 | trace_printk_seq(&iter.seq); |
73 | else | 71 | } else { |
74 | skip_lines--; | 72 | skip_lines--; |
73 | } | ||
74 | |||
75 | if (KDB_FLAG(CMD_INTERRUPT)) | 75 | if (KDB_FLAG(CMD_INTERRUPT)) |
76 | goto out; | 76 | goto out; |
77 | } | 77 | } |