mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Tomas Glozar <tglozar@redhat.com>, John Kacur <jkacur@redhat.com>,
	Zhang Chujun <zhangchujun@cmss.chinamobile.com>,
	Zilin Guan <zilin@seu.edu.cn>
Subject: [GIT PULL] tracing: A few minor fixes for v6.18
Date: Fri, 7 Nov 2025 08:24:44 -0500	[thread overview]
Message-ID: <20251107082444.45c4536d@gandalf.local.home> (raw)


Linus,

Fixes for tracing:

- Check for reader catching up in ring_buffer_map_get_reader()

  If the reader catches up to the writer in the memory mapped ring buffer
  then calling rb_get_reader_page() will return NULL as there's no
  pages left. But this isn't checked for before calling rb_get_reader_page()
  and the return of NULL causes a warning.

  If it is detected that the reader caught up to the writer, then simply
  exit the routine.

- Fix memory leak in histogram create_field_var()

  The couple of the error paths in create_field_var() did not properly clean
  up what was allocated. Make sure everything is freed properly on error.

- Fix help message of tools latency_collector

  The help message incorrectly stated that "-t" was the same as "--threads"
  whereas "--threads" is actually represented by "-e".


Please pull the latest trace-v6.18-rc4 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace-v6.18-rc4

Tag SHA1: a9d5bb4a7261f61be9248ee46ff77fd0c6261970
Head SHA1: 53afec2c8fb2a562222948cb1c2aac48598578c9


Steven Rostedt (1):
      ring-buffer: Do not warn in ring_buffer_map_get_reader() when reader catches up

Zhang Chujun (1):
      tracing/tools: Fix incorrcet short option in usage text for --threads

Zilin Guan (1):
      tracing: Fix memory leaks in create_field_var()

----
 kernel/trace/ring_buffer.c                | 4 ++++
 kernel/trace/trace_events_hist.c          | 6 ++++--
 tools/tracing/latency/latency-collector.c | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)
---------------------------
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 1244d2c5c384..afcd3747264d 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -7344,6 +7344,10 @@ int ring_buffer_map_get_reader(struct trace_buffer *buffer, int cpu)
 		goto out;
 	}
 
+	/* Did the reader catch up with the writer? */
+	if (cpu_buffer->reader_page == cpu_buffer->commit_page)
+		goto out;
+
 	reader = rb_get_reader_page(cpu_buffer);
 	if (WARN_ON(!reader))
 		goto out;
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 1d536219b624..6bfaf1210dd2 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -3272,14 +3272,16 @@ static struct field_var *create_field_var(struct hist_trigger_data *hist_data,
 	var = create_var(hist_data, file, field_name, val->size, val->type);
 	if (IS_ERR(var)) {
 		hist_err(tr, HIST_ERR_VAR_CREATE_FIND_FAIL, errpos(field_name));
-		kfree(val);
+		destroy_hist_field(val, 0);
 		ret = PTR_ERR(var);
 		goto err;
 	}
 
 	field_var = kzalloc(sizeof(struct field_var), GFP_KERNEL);
 	if (!field_var) {
-		kfree(val);
+		destroy_hist_field(val, 0);
+		kfree_const(var->type);
+		kfree(var->var.name);
 		kfree(var);
 		ret =  -ENOMEM;
 		goto err;
diff --git a/tools/tracing/latency/latency-collector.c b/tools/tracing/latency/latency-collector.c
index cf263fe9deaf..ef97916e3873 100644
--- a/tools/tracing/latency/latency-collector.c
+++ b/tools/tracing/latency/latency-collector.c
@@ -1725,7 +1725,7 @@ static void show_usage(void)
 "-n, --notrace\t\tIf latency is detected, do not print out the content of\n"
 "\t\t\tthe trace file to standard output\n\n"
 
-"-t, --threads NRTHR\tRun NRTHR threads for printing. Default is %d.\n\n"
+"-e, --threads NRTHR\tRun NRTHR threads for printing. Default is %d.\n\n"
 
 "-r, --random\t\tArbitrarily sleep a certain amount of time, default\n"
 "\t\t\t%ld ms, before reading the trace file. The\n"

             reply	other threads:[~2025-11-07 13:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07 13:24 Steven Rostedt [this message]
2025-11-07 16:14 ` pr-tracker-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251107082444.45c4536d@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=tglozar@redhat.com \
    --cc=torvalds@linux-foundation.org \
    --cc=zhangchujun@cmss.chinamobile.com \
    --cc=zilin@seu.edu.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®