Skip to content

Commit 23d1cfc

Browse files
committed
ring-buffer: Show what clock function is used on timestamp errors
The testing for tracing was triggering a timestamp count issue that was always off by one. This has been happening for some time but has never been reported by anyone else. It was finally discovered to be an issue with the "uptime" (jiffies) clock that happened to be traced and the internal recursion caused the discrepancy. This would have been much easier to solve if the clock function being used was displayed when the error was detected. Add the clock function to the error output. Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Link: https://patch.msgid.link/20260323202212.479bb288@gandalf.local.home Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent dc1d940 commit 23d1cfc

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

kernel/trace/ring_buffer.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4506,18 +4506,20 @@ static void check_buffer(struct ring_buffer_per_cpu *cpu_buffer,
45064506
ret = rb_read_data_buffer(bpage, tail, cpu_buffer->cpu, &ts, &delta);
45074507
if (ret < 0) {
45084508
if (delta < ts) {
4509-
buffer_warn_return("[CPU: %d]ABSOLUTE TIME WENT BACKWARDS: last ts: %lld absolute ts: %lld\n",
4510-
cpu_buffer->cpu, ts, delta);
4509+
buffer_warn_return("[CPU: %d]ABSOLUTE TIME WENT BACKWARDS: last ts: %lld absolute ts: %lld clock:%pS\n",
4510+
cpu_buffer->cpu, ts, delta,
4511+
cpu_buffer->buffer->clock);
45114512
goto out;
45124513
}
45134514
}
45144515
if ((full && ts > info->ts) ||
45154516
(!full && ts + info->delta != info->ts)) {
4516-
buffer_warn_return("[CPU: %d]TIME DOES NOT MATCH expected:%lld actual:%lld delta:%lld before:%lld after:%lld%s context:%s\n",
4517+
buffer_warn_return("[CPU: %d]TIME DOES NOT MATCH expected:%lld actual:%lld delta:%lld before:%lld after:%lld%s context:%s\ntrace clock:%pS",
45174518
cpu_buffer->cpu,
45184519
ts + info->delta, info->ts, info->delta,
45194520
info->before, info->after,
4520-
full ? " (full)" : "", show_interrupt_level());
4521+
full ? " (full)" : "", show_interrupt_level(),
4522+
cpu_buffer->buffer->clock);
45214523
}
45224524
out:
45234525
atomic_dec(this_cpu_ptr(&checking));

0 commit comments

Comments
 (0)