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 1/2] tools/bootconfig: Preserve filters when resetting histogram triggers
Date: Wed, 28 Oct 2026 20:36:23 +0100	[thread overview]
Message-ID: <9653f7959268a03234c33ec5eb25d16294241fce.1793216183.git.edumucelli@gmail.com> (raw)
In-Reply-To: <cover.1793216183.git.edumucelli@gmail.com>

reset_trigger_file() cuts a trigger line at its first '[' to discard the
histogram state suffix. A filter such as prev_comm ~ "[ab]" is truncated
inside its quoted string, producing an invalid removal command.

This also breaks the first pass that removes action histograms before
their variable providers. If an action histogram cannot be removed and
its provider is visited first in the second pass, the provider is busy
and remains installed after reset.

Remove only the trailing [active] or [paused] annotation. Quote the line
while extracting the command so that repeated spaces inside the filter
also survive, allowing the action histogram to match and be removed.

Fixes: 5675fd4ef51f ("tools/bootconfig: Add --init option for bconf2ftrace.sh")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
---
I tested reset_trigger_file in a temporary tracefs instance on my Ubuntu
machine, running kernel 7.0.0-38-generic, with recording disabled.
With an action histogram depending on a provider that comes first in
the event-directory order, the original helper left the provider behind.
This happened with a bracketed filter and with repeated spaces inside
a string. The spaced-string case even returned success.

With the fix, both histograms were removed. I also checked active and
paused histograms, onmax actions, and ordinary filter controls.

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

diff --git a/tools/bootconfig/scripts/ftrace.sh b/tools/bootconfig/scripts/ftrace.sh
index cc5250c64699..c2b993f8e366 100644
--- a/tools/bootconfig/scripts/ftrace.sh
+++ b/tools/bootconfig/scripts/ftrace.sh
@@ -21,13 +21,13 @@ reset_trigger_file() {
     # remove action triggers first
     grep -H ':on[^:]*(' $@ |
     while read line; do
-        cmd=`echo $line | cut -f2- -d: | cut -f1 -d"["`
+	cmd=`echo "$line" | cut -f2- -d: | sed -e 's/ \[active\]$//' -e 's/ \[paused\]$//'`
 	file=`echo $line | cut -f1 -d:`
 	echo "!$cmd" >> $file
     done
     grep -Hv ^# $@ |
     while read line; do
-        cmd=`echo $line | cut -f2- -d: | cut -f1 -d"["`
+	cmd=`echo "$line" | cut -f2- -d: | sed -e 's/ \[active\]$//' -e 's/ \[paused\]$//'`
 	file=`echo $line | cut -f1 -d:`
 	echo "!$cmd" > $file
     done
-- 
2.53.0


  reply	other threads:[~2026-10-28 19:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 19:36 [PATCH 0/2] tools/bootconfig: Preserve filters when resetting and applying tracing Eduardo Mucelli Rezende Oliveira
2026-10-28 19:36 ` Eduardo Mucelli Rezende Oliveira [this message]
2026-10-28 19:36 ` [PATCH 2/2] tools/bootconfig: Quote command strings when applying ftrace settings 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=9653f7959268a03234c33ec5eb25d16294241fce.1793216183.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®