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 2/4] tools/bootconfig: Export replayable event trigger counts
Date: Fri, 30 Oct 2026 13:51:49 +0100	[thread overview]
Message-ID: <e0659901d096a29364f7dd23352263c37f2ca77f.1793364709.git.edumucelli@gmail.com> (raw)
In-Reply-To: <cover.1793364709.git.edumucelli@gmail.com>

Tracefs displays generic event trigger counts as :unlimited or :count=N.
ftrace2bconf.sh copies these annotations into the exported action, but
the trigger input syntax requires an omitted count or :N. Replaying an
exported traceoff or enable_event action therefore fails.

Remove :unlimited and convert :count=N to :N in the command token before
emitting the action. Keep the filter text unchanged and leave histogram
commands alone, where count can be a variable name.

Fixes: 2b86062a34a8 ("tools/bootconfig: Add a script to generates bootconfig from ftrace")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
---
I tested traceoff with an unlimited count, traceoff:7 with a filter,
and enable_event with a finite count and filter in a temporary tracefs
instance on my Ubuntu machine, running kernel 7.0.0-38-generic, with
recording disabled.

The original exported count annotations were rejected during replay.
With the fix, the triggers and their filters were restored correctly.
A histogram defining a variable named count also worked unchanged.

 tools/bootconfig/scripts/ftrace2bconf.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh
index 8c5889d0420c..82c4fe021fb7 100755
--- a/tools/bootconfig/scripts/ftrace2bconf.sh
+++ b/tools/bootconfig/scripts/ftrace2bconf.sh
@@ -118,6 +118,15 @@ per_event_options() { # event-dir
 	grep -v "^#" $evdir/trigger |
 		sed -e 's/ \[active\]$//' -e 's/ \[paused\]$//' |
 		while IFS= read -r action; do
+		action_cmd=${action%% *}
+		action_rest=${action#"$action_cmd"}
+		case "$action_cmd" in
+		hist:*) ;;
+		*:unlimited)
+			action="${action_cmd%:unlimited}$action_rest";;
+		*:count=*)
+			action="${action_cmd%:count=*}:${action_cmd##*:count=}$action_rest";;
+		esac
 		emit_kv $PREFIX.event.$group.$event.actions += "'$action'"
 	done
 
-- 
2.53.0


  parent reply	other threads:[~2026-10-30 12:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 12:51 [PATCH 0/4] tools/bootconfig: Preserve tracing settings during export Eduardo Mucelli Rezende Oliveira
2026-10-30 12:51 ` [PATCH 1/4] tools/bootconfig: Quote event filters in ftrace2bconf.sh Eduardo Mucelli Rezende Oliveira
2026-10-30 12:51 ` Eduardo Mucelli Rezende Oliveira [this message]
2026-10-30 12:51 ` [PATCH 3/4] tools/bootconfig: Reset histogram variable tracking for each instance Eduardo Mucelli Rezende Oliveira
2026-10-30 12:51 ` [PATCH 4/4] tools/bootconfig: Preserve paused histograms in ftrace2bconf.sh 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=e0659901d096a29364f7dd23352263c37f2ca77f.1793364709.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®