[PATCH v2 2/4] tools/bootconfig: Export replayable event trigger counts

From: Eduardo Mucelli Rezende Oliveira

Date: Sat Oct 31 2026 - 06:26:39 EST


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@xxxxxxxxx>
---
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 8f3edea79ca0..9100ebcd5af6 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