Thread (37 messages) flat view 37 messages, 2 authors, 6h ago

Re: [PATCH v5 06/18] tracing/remotes: Add dmesg tracefs file

From: sashiko-bot@kernel.org
Date: 2026-08-12 16:42:57

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] When CONFIG_PRINTK is disabled, dmesg redirection stalls the event iterator perpetually because `pr_info` returns 0.
--
--- Patch [6]: [PATCH v5 06/18] tracing/remotes: Add dmesg tracefs file ---
commit b41c280df86084ff7600dad9b61a6fa3dbbdf1dd
Author: Vincent Donnefort [off-list ref]

tracing/remotes: Add dmesg tracefs file

When enabled, the dmesg tracefs file enables the redirection of all
events to dmesg. This is similar to tp_printk.
quoted hunk ↗ jump to hunk
diff --git a/kernel/trace/trace_remote.c b/kernel/trace/trace_remote.c
index 1fbe2f3f20e99..3a5e0d84c1722 100644
--- a/kernel/trace/trace_remote.c
+++ b/kernel/trace/trace_remote.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -882,6 +908,87 @@ static const struct file_operations trace_fops = {
 	.release	= trace_release,
 };
 
+static bool trace_remote_do_dmesg(struct trace_remote *remote)
+{
+	struct trace_remote_iterator *iter = smp_load_acquire(&remote->dmesg);
+	unsigned int max_events = 1000;
+
+	if (!iter)
+		return false;
+
+	trace_remote_iter_read_start(iter);
+
+	while (trace_remote_iter_read_event(iter)) {
+		trace_seq_init(&iter->seq);
+
+		trace_remote_iter_print_event(iter);
+		trace_seq_putc(&iter->seq, 0);
+		if (!pr_info("%s", seq_buf_str(&iter->seq.seq)))
+			break;
[Severity: Medium]
When CONFIG_PRINTK is disabled, pr_info() is defined as no_printk, which
unconditionally returns 0. Does this cause the loop to always break early
and skip the call to trace_remote_iter_move() below?

If so, it appears the background polling work would continually fail to drain
the trace remote buffer and run periodically without doing any work, as the
iterator never advances.
+
+		trace_remote_iter_move(iter);
+
+		if (!(--max_events))
+			break;
+	}
+
+	trace_remote_iter_read_finished(iter);
+
+	return !max_events;
+}
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812161340.2417322-1-vdonnefort@google.com?part=6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help