tools/bootconfig: Fix enabling all events in bconf2ftrace.sh
Subsystems (2)
PATCH 1/1 tools/bootconfig: Fix enabling all events in bconf2ftrace.sh
A bootconfig containing ftrace.event.enable makes bconf2ftrace.sh try to write to events/enable/enable. The per-event loop treats the global enable key as an event named "enable" in a group with the same name.
Since events/enable is a file, this write fails. With --apply, the script exits before it reaches the code that enables all events. The same thing happens with ftrace.instance.NAME.event.enable.
Skip the global enable key in the per-event loop and let the existing global handler write to events/enable.
---
This is my second submission to the Linux kernel. Feedback is welcome.
Tested with --apply in a temporary tracefs instance on my Ubuntu machine, running kernel 7.0.0-38-generic, with recording disabled. The original script exits with status 2 and leaves events disabled. With the fix, it exits successfully and the instance's events/enable reads 1. Per-group enabling works with both versions.
tools/bootconfig/scripts/bconf2ftrace.sh | 1 + 1 file changed, 1 insertion(+)
tools/bootconfig/scripts/bconf2ftrace.sh +1 -0
@@ -218,6 +218,7 @@ setup_events() { # prefix("ftrace" or "ftrace.instance.INSTANCE") [instance] prefix="${1}.event" if xbc_has_branch ${1}.event; then for grpev in `xbc_subkeys ${1}.event 2`; do + [ "$grpev" = "enable" ] && continue setup_event $prefix ${grpev%.*} ${grpev#*.} $2 done fi
base-commit: a804c5742bff224d4cb4d25dd383554d598be32b
Signature · 1 line
2.53.0
Masami Hiramatsu (Google)
maintainerQuoted 7 lines · Eduardo Mucelli Rezende Oliveira
A bootconfig containing ftrace.event.enable makes
bconf2ftrace.shtry to write to events/enable/enable. The per-event loop treats the global enable key as an event named "enable" in a group with the same name.Since events/enable is a file, this write fails. With --apply, the script exits before it reaches the code that enables all events. The same thing happens with ftrace.instance.NAME.event.enable.
Good catch!
Quoted 3 lines
Skip the global enable key in the per-event loop and let the existing global handler write to events/enable.
This looks good to me. Let me pick it too.
Thanks!
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Thanks, Masami!
Quoted 23 lines · Masami Hiramatsu
Quoted 7 lines · Eduardo Mucelli Rezende Oliveira
A bootconfig containing ftrace.event.enable makes
bconf2ftrace.shtry to write to events/enable/enable. The per-event loop treats the global enable key as an event named "enable" in a group with the same name.Since events/enable is a file, this write fails. With --apply, the script exits before it reaches the code that enables all events. The same thing happens with ftrace.instance.NAME.event.enable.
Good catch!
Quoted 3 lines
Skip the global enable key in the per-event loop and let the existing global handler write to events/enable.
This looks good to me. Let me pick it too.
Thanks!
--
Masami Hiramatsu (Google) <[email protected]>
Signature · 1 line
Eduardo Mucelli R. Oliveira -- http://eduar.do