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 3/5] tools/bootconfig: Ignore filter strings when resolving histogram variables
Date: Sat, 31 Oct 2026 19:35:32 +0100	[thread overview]
Message-ID: <12880872dd9ffba9c334c3c2ecffca0b45d64b4c.1793471731.git.edumucelli@gmail.com> (raw)
In-Reply-To: <cover.1793471731.git.edumucelli@gmail.com>

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 <edumucelli@gmail.com>
---
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


  parent reply	other threads:[~2026-10-31 18:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-31 18:35 [PATCH 0/5] tools/bootconfig: Fix tracing script filters and histogram dependencies Eduardo Mucelli Rezende Oliveira
2026-10-31 18:35 ` [PATCH 1/5] tools/bootconfig: Read the documented ftrace.notraces key Eduardo Mucelli Rezende Oliveira
2026-10-31 18:35 ` [PATCH 2/5] tools/bootconfig: Preserve quotes in exported event actions Eduardo Mucelli Rezende Oliveira
2026-10-31 18:35 ` Eduardo Mucelli Rezende Oliveira [this message]
2026-10-31 18:35 ` [PATCH 4/5] tools/bootconfig: Resolve histogram dependencies until no progress is made Eduardo Mucelli Rezende Oliveira
2026-10-31 18:35 ` [PATCH 5/5] tools/bootconfig: Match literal keys in tracing script helpers Eduardo Mucelli Rezende Oliveira

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=12880872dd9ffba9c334c3c2ecffca0b45d64b4c.1793471731.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®