The histogram variable resolver scans the entire trigger line, including
its filter. A literal string such as "$not_a_variable" is consequently
read as a variable reference and the histogram is deferred and omitted.
Conversely, a filter containing ":dep0=" looks like a definition and can
cause a consumer to be exported before its real provider.
Remove the filter portion before looking for variable definitions and
references. Leave the complete filter intact when exporting the action.
Fixes: 2b86062a34a8 ("tools/bootconfig: Add a script to generates bootconfig
from ftrace")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <[email protected]>
---
I tested literal dollar signs and assignment-looking strings in
histogram filters in a temporary tracefs instance on my Ubuntu machine,
running kernel 7.0.0-38-generic, with recording disabled.
The original exporter omitted the dollar-sign cases and treated text
inside another filter as a provider, putting a consumer first. With
the fix, the literal filters were retained and the real provider was
exported before its consumer.
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 77ec17c94a17..8ba1a698611e 100755
--- a/tools/bootconfig/scripts/ftrace2bconf.sh
+++ b/tools/bootconfig/scripts/ftrace2bconf.sh
@@ -86,10 +86,10 @@ synth_event_options() {
# Variables resolver
defined_vars() { # event-dir
- grep "^hist" $1/trigger | grep -o ':[a-zA-Z0-9_]*='
+ grep "^hist" $1/trigger | sed 's/ if .*//' | grep -o ':[a-zA-Z0-9_]*='
}
referred_vars() {
- grep "^hist" $1/trigger | grep -o '$[a-zA-Z0-9_]*'
+ grep "^hist" $1/trigger | sed 's/ if .*//' | grep -o '$[a-zA-Z0-9_]*'
}
event_is_enabled() { # enable-file
--
2.53.0