* [PATCH] tools/bootconfig: Recognize underscores in histogram variables
@ 2026-10-24 11:08 Eduardo Mucelli Rezende Oliveira
0 siblings, 0 replies; only message in thread
From: Eduardo Mucelli Rezende Oliveira @ 2026-10-24 11:08 UTC (permalink / raw)
To: mhiramat; +Cc: rostedt, linux-trace-kernel, linux-kernel
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>
---
Hi Masami,
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
Feedback is welcome.
Thanks,
Eduardo
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 f8f288f90c74..de1d387a8efd 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
base-commit: 22ab3094befd6ef37135e4a252c0da9cd755f75a
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-24 11:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-24 11:08 [PATCH] tools/bootconfig: Recognize underscores in histogram variables Eduardo Mucelli Rezende Oliveira
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®