The trigger file reports a paused histogram with a trailing [paused]
annotation. Removing that annotation without adding a pause parameter
exports the histogram as an active trigger. Replaying the exported
configuration therefore enables aggregation that was previously paused.

Add the pause parameter after the hist prefix before removing the display
annotation. This keeps the parameter before any filter expression and
preserves both the paused state and the filter.

Fixes: 2b86062a34a8 ("tools/bootconfig: Add a script to generates bootconfig 
from ftrace")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <[email protected]>
---
I tested paused histograms with and without a filter, plus an active
histogram, in a temporary tracefs instance on my Ubuntu machine, running
kernel 7.0.0-38-generic, with recording disabled.

The original exporter restored the paused histograms as active. With
the fix, both paused histograms kept their state and filters, and the
active histogram still restored as active. One filter contained the
literal string [paused], which was preserved as well.

 tools/bootconfig/scripts/ftrace2bconf.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh 
b/tools/bootconfig/scripts/ftrace2bconf.sh
index b63e04bf9400..31702be0c68d 100755
--- a/tools/bootconfig/scripts/ftrace2bconf.sh
+++ b/tools/bootconfig/scripts/ftrace2bconf.sh
@@ -114,7 +114,8 @@ per_event_options() { # event-dir
                DEFINED_VARS="$DEFINED_VARS "`defined_vars $evdir`
        fi
        grep -v "^#" $evdir/trigger |
-               sed -e 's/ \[active\]$//' -e 's/ \[paused\]$//' |
+               sed -e '/^hist:.* \[paused\]$/s/^hist:/hist:pause:/' \
+                       -e 's/ \[active\]$//' -e 's/ \[paused\]$//' |
                while IFS= read -r action; do
                action_cmd=${action%% *}
                action_rest=${action#"$action_cmd"}
-- 
2.53.0


Reply via email to