[PATCH v2 1/2] tools/bootconfig: Preserve event trigger filters in ftrace2bconf.sh

From: Eduardo Mucelli Rezende Oliveira

Date: Sun Oct 25 2026 - 13:36:10 EST


ftrace2bconf.sh reads each trigger line into "action active", keeping
only its first whitespace-separated word. For example, a histogram with
"if common_pid > 0" is exported without its filter. Reapplying that
configuration installs an unconditional histogram instead.

Read the whole trigger line and remove only the trailing histogram state
marker. Quote the resulting action so that whitespace in a filter is
preserved in the exported configuration.

Fixes: 2b86062a34a8 ("tools/bootconfig: Add a script to generates bootconfig from ftrace")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@xxxxxxxxx>
---
I tested this in a temporary tracefs instance on my Ubuntu machine,
running kernel 7.0.0-38-generic, with recording disabled. I installed
histograms with "if common_pid > 0" and 'if comm == "a b"', exported
them, then restored that instance's actions with bconf2ftrace.sh --apply.
The original exporter lost both filters. With this patch, both were
restored correctly. An unfiltered histogram worked in both cases.

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

diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh
index f8f288f90c74..032ac5b10a4a 100755
--- a/tools/bootconfig/scripts/ftrace2bconf.sh
+++ b/tools/bootconfig/scripts/ftrace2bconf.sh
@@ -115,8 +115,10 @@ per_event_options() { # event-dir
done
DEFINED_VARS="$DEFINED_VARS "`defined_vars $evdir`
fi
- grep -v "^#" $evdir/trigger | while read action active; do
- emit_kv $PREFIX.event.$group.$event.actions += \'$action\'
+ grep -v "^#" $evdir/trigger |
+ sed -e 's/ \[active\]$//' -e 's/ \[paused\]$//' |
+ while IFS= read -r action; do
+ emit_kv $PREFIX.event.$group.$event.actions += "'$action'"
done

if [ $GROUP_ENABLED -eq 0 ] && event_is_enabled $evdir/enable; then
--
2.53.0