Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+6 -4
+6 -4
kernel/trace/ring_buffer.c
··· 4506 4506 ret = rb_read_data_buffer(bpage, tail, cpu_buffer->cpu, &ts, &delta); 4507 4507 if (ret < 0) { 4508 4508 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); 4511 4512 goto out; 4512 4513 } 4513 4514 } 4514 4515 if ((full && ts > info->ts) || 4515 4516 (!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", 4517 4518 cpu_buffer->cpu, 4518 4519 ts + info->delta, info->ts, info->delta, 4519 4520 info->before, info->after, 4520 - full ? " (full)" : "", show_interrupt_level()); 4521 + full ? " (full)" : "", show_interrupt_level(), 4522 + cpu_buffer->buffer->clock); 4521 4523 } 4522 4524 out: 4523 4525 atomic_dec(this_cpu_ptr(&checking));