mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
To: mhiramat@kernel.org
Cc: rostedt@goodmis.org, linux-trace-kernel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/2] tools/bootconfig: Recognize underscores in histogram variables
Date: Sun, 25 Oct 2026 18:35:24 +0100	[thread overview]
Message-ID: <6343726e630448ee14c091fe369d8ae5331a0345.1792949723.git.edumucelli@gmail.com> (raw)
In-Reply-To: <cover.1792949723.git.edumucelli@gmail.com>

The variable dependency resolver in ftrace2bconf.sh only recognizes
letters and digits in histogram variable names. A reference such as
$start_ts is read as $start, and the start_ts definition is missed.
The consumer is repeatedly deferred and eventually omitted from the
export with an undefined-variable diagnostic.

Include underscores when matching both definitions and references so
that valid histogram variables are resolved and their consumers are
exported after the providers.

Fixes: 2b86062a34a8 ("tools/bootconfig: Add a script to generates bootconfig from ftrace")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
---
The histogram-variable documentation even uses names such as wakeup_lat
and us_per_sec [1]. These are valid in tracefs, but the exporter cannot
resolve references to them and leaves out the dependent histogram.

I tested this in a temporary tracefs instance on my Ubuntu machine,
running kernel 7.0.0-38-generic, with recording disabled. I created a
provider histogram defining start_ts and a consumer using $start_ts.
The original exporter reported an undefined variable and left out the
consumer. With the fix, both were exported and restored correctly.
A separate pair using ts0 worked in both versions.

[1] https://docs.kernel.org/trace/histogram.html#histogram-variables

 tools/bootconfig/scripts/ftrace2bconf.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh
index 032ac5b10a4a..b01297217cf3 100755
--- a/tools/bootconfig/scripts/ftrace2bconf.sh
+++ b/tools/bootconfig/scripts/ftrace2bconf.sh
@@ -88,10 +88,10 @@ DEFINED_VARS=
 UNRESOLVED_EVENTS=
 
 defined_vars() { # event-dir
-	grep "^hist" $1/trigger | grep -o ':[a-zA-Z0-9]*='
+	grep "^hist" $1/trigger | grep -o ':[a-zA-Z0-9_]*='
 }
 referred_vars() {
-	grep "^hist" $1/trigger | grep -o '$[a-zA-Z0-9]*'
+	grep "^hist" $1/trigger | grep -o '$[a-zA-Z0-9_]*'
 }
 
 event_is_enabled() { # enable-file
-- 
2.53.0


  parent reply	other threads:[~2026-10-25 17:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23  8:49 [PATCH] tools/bootconfig: Preserve event trigger filters in ftrace2bconf.sh Eduardo Mucelli Rezende Oliveira
2026-10-25 14:01 ` Masami Hiramatsu
2026-10-25 17:35   ` [PATCH v2 0/2] tools/bootconfig: Fix histogram filters and variable names Eduardo Mucelli Rezende Oliveira
2026-10-25 17:35     ` [PATCH v2 1/2] tools/bootconfig: Preserve event trigger filters in ftrace2bconf.sh Eduardo Mucelli Rezende Oliveira
2026-10-25 17:35     ` Eduardo Mucelli Rezende Oliveira [this message]
2026-10-30  0:25     ` [PATCH v2 0/2] tools/bootconfig: Fix histogram filters and variable names Masami Hiramatsu (Google)
2026-10-30 12:13       ` Eduardo Mucelli

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=6343726e630448ee14c091fe369d8ae5331a0345.1792949723.git.edumucelli@gmail.com \
    --to=edumucelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    /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®