mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] tools/bootconfig: Preserve tracing settings across export and replay
@ 2026-11-22  0:34 Eduardo Mucelli Rezende Oliveira
  2026-11-22  0:34 ` [PATCH 1/2] tools/bootconfig: Use the registered global tracing parameter names Eduardo Mucelli Rezende Oliveira
  2026-11-22  0:34 ` [PATCH 2/2] tools/bootconfig: Preserve all-f tracing CPU masks on export Eduardo Mucelli Rezende Oliveira
  0 siblings, 2 replies; 3+ messages in thread
From: Eduardo Mucelli Rezende Oliveira @ 2026-11-22  0:34 UTC (permalink / raw)
  To: mhiramat
  Cc: rostedt, mathieu.desnoyers, corbet, linux-doc,
	linux-trace-kernel, linux-kernel

Hi Masami,

Thanks for reviewing the earlier bootconfig fixes. I found two more cases
where a tracefs export loses a setting when you use it again. The graph
depth is exported under a name the kernel doesn't recognize at boot, and
an all-f CPU mask is left out entirely.

I checked the rendered kernel command line and exercised export and replay
on my Ubuntu machine using a tracefs fixture. The series is based on
bootconfig/core, including the earlier CPU mask quoting fix.

Thanks,
Eduardo

Eduardo Mucelli Rezende Oliveira (2):
  tools/bootconfig: Use the registered global tracing parameter names
  tools/bootconfig: Preserve all-f tracing CPU masks on export

 Documentation/trace/boottime-trace.rst   |  8 ++++----
 tools/bootconfig/scripts/bconf2ftrace.sh | 21 ++++++++++++++++-----
 tools/bootconfig/scripts/ftrace2bconf.sh |  9 ++++-----
 3 files changed, 24 insertions(+), 14 deletions(-)


base-commit: 0ad31c3252d4c626a93ae6251340ef86b18342d0
-- 
2.53.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] tools/bootconfig: Use the registered global tracing parameter names
  2026-11-22  0:34 [PATCH 0/2] tools/bootconfig: Preserve tracing settings across export and replay Eduardo Mucelli Rezende Oliveira
@ 2026-11-22  0:34 ` Eduardo Mucelli Rezende Oliveira
  2026-11-22  0:34 ` [PATCH 2/2] tools/bootconfig: Preserve all-f tracing CPU masks on export Eduardo Mucelli Rezende Oliveira
  1 sibling, 0 replies; 3+ messages in thread
From: Eduardo Mucelli Rezende Oliveira @ 2026-11-22  0:34 UTC (permalink / raw)
  To: mhiramat
  Cc: rostedt, mathieu.desnoyers, corbet, linux-doc,
	linux-trace-kernel, linux-kernel

The boot-time tracing guide lists four kernel.* keys that do not match
the parameters registered by the tracing code. For example,
ftrace2bconf.sh emits kernel.fgraph_max_depth, which bootconfig passes
as fgraph_max_depth on the kernel command line. The function-graph
tracer registers ftrace_graph_max_depth.

Use the registered names in the guide and the exporter. Teach
bconf2ftrace.sh to read those names, with the previous script keys as
fallbacks so existing replay configurations still work.

Fixes: 47781947947a ("Documentation: tracing: Add boot-time tracing document")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
---
 Documentation/trace/boottime-trace.rst   |  8 ++++----
 tools/bootconfig/scripts/bconf2ftrace.sh | 21 ++++++++++++++++-----
 tools/bootconfig/scripts/ftrace2bconf.sh |  5 +++--
 3 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/Documentation/trace/boottime-trace.rst b/Documentation/trace/boottime-trace.rst
index 2c3c1fedb..68fd6152c 100644
--- a/Documentation/trace/boottime-trace.rst
+++ b/Documentation/trace/boottime-trace.rst
@@ -36,20 +36,20 @@ these options are passed as a part of kernel legacy command line.
 kernel.tp_printk
    Output trace-event data on printk buffer too.
 
-kernel.dump_on_oops [= MODE]
+kernel.ftrace_dump_on_oops [= MODE]
    Dump ftrace on Oops. If MODE = 1 or omitted, dump trace buffer
    on all CPUs. If MODE = 2, dump a buffer on a CPU which kicks Oops.
 
 kernel.traceoff_on_warning
    Stop tracing if WARN_ON() occurs.
 
-kernel.fgraph_max_depth = MAX_DEPTH
+kernel.ftrace_graph_max_depth = MAX_DEPTH
    Set MAX_DEPTH to maximum depth of fgraph tracer.
 
-kernel.fgraph_filters = FILTER[, FILTER2...]
+kernel.ftrace_graph_filter = FILTER[, FILTER2...]
    Add fgraph tracing function filters.
 
-kernel.fgraph_notraces = FILTER[, FILTER2...]
+kernel.ftrace_graph_notrace = FILTER[, FILTER2...]
    Add fgraph non-tracing function filters.
 
 
diff --git a/tools/bootconfig/scripts/bconf2ftrace.sh b/tools/bootconfig/scripts/bconf2ftrace.sh
index 6a3535a2c..e7cda59d2 100755
--- a/tools/bootconfig/scripts/bconf2ftrace.sh
+++ b/tools/bootconfig/scripts/bconf2ftrace.sh
@@ -276,15 +276,26 @@ setup_instance() { # [instance]
 }
 
 # ftrace global configs (kernel.*)
-if xbc_has_key "kernel.dump_on_oops"; then
-	dump_mode=`xbc_get_val "kernel.dump_on_oops" 1`
+# Prefer the kernel parameter names and accept the old script keys as fallbacks.
+dump_key=kernel.ftrace_dump_on_oops
+xbc_has_key "$dump_key" || dump_key=kernel.dump_on_oops
+if xbc_has_key "$dump_key"; then
+	dump_mode=`xbc_get_val "$dump_key" 1`
 	[ "$dump_mode" ] && dump_mode=`eval echo $dump_mode` || dump_mode=1
 	run_cmd "echo \"$dump_mode\" > /proc/sys/kernel/ftrace_dump_on_oops"
 fi
 
-set_value_of kernel.fgraph_max_depth $TRACEFS/max_graph_depth
-set_array_of kernel.fgraph_filters $TRACEFS/set_graph_function
-set_array_of kernel.fgraph_notraces $TRACEFS/set_graph_notrace
+graph_depth_key=kernel.ftrace_graph_max_depth
+xbc_has_key "$graph_depth_key" || graph_depth_key=kernel.fgraph_max_depth
+set_value_of "$graph_depth_key" $TRACEFS/max_graph_depth
+
+graph_filter_key=kernel.ftrace_graph_filter
+xbc_has_key "$graph_filter_key" || graph_filter_key=kernel.fgraph_filters
+set_array_of "$graph_filter_key" $TRACEFS/set_graph_function
+
+graph_notrace_key=kernel.ftrace_graph_notrace
+xbc_has_key "$graph_notrace_key" || graph_notrace_key=kernel.fgraph_notraces
+set_array_of "$graph_notrace_key" $TRACEFS/set_graph_notrace
 
 # Per-instance/per-event configs
 if ! xbc_has_branch "ftrace" ; then
diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh
index b3c976bc9..c23e7cc8a 100755
--- a/tools/bootconfig/scripts/ftrace2bconf.sh
+++ b/tools/bootconfig/scripts/ftrace2bconf.sh
@@ -46,10 +46,11 @@ emit_kv() { # key =|+= value
 
 global_options() {
 	val=`cat $TRACEFS/max_graph_depth`
-	[ $val != 0 ] && emit_kv kernel.fgraph_max_depth = $val
+	[ $val != 0 ] && emit_kv kernel.ftrace_graph_max_depth = $val
 	if grep -qv "^#" $TRACEFS/set_graph_function $TRACEFS/set_graph_notrace ; then
 		cat 1>&2 << EOF
-# WARN: kernel.fgraph_filters and kernel.fgraph_notrace are not supported, since the wild card expression was expanded and lost from memory.
+# WARN: Cannot export kernel.ftrace_graph_filter and kernel.ftrace_graph_notrace.
+# Only the expanded function list is available.
 EOF
 	fi
 }
-- 
2.53.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] tools/bootconfig: Preserve all-f tracing CPU masks on export
  2026-11-22  0:34 [PATCH 0/2] tools/bootconfig: Preserve tracing settings across export and replay Eduardo Mucelli Rezende Oliveira
  2026-11-22  0:34 ` [PATCH 1/2] tools/bootconfig: Use the registered global tracing parameter names Eduardo Mucelli Rezende Oliveira
@ 2026-11-22  0:34 ` Eduardo Mucelli Rezende Oliveira
  1 sibling, 0 replies; 3+ messages in thread
From: Eduardo Mucelli Rezende Oliveira @ 2026-11-22  0:34 UTC (permalink / raw)
  To: mhiramat; +Cc: rostedt, linux-trace-kernel, linux-kernel

ftrace2bconf.sh skips tracing_cpumask values consisting only of f
digits. For example, on a four-CPU system this drops the mask f. If the
mask is subsequently narrowed to 3, replaying the export cannot restore
tracing on all four CPUs because the configuration has no cpumask entry.

Always emit the observed mask as one quoted bootconfig value so a replay
can restore it.

Fixes: 2b86062a34a8 ("tools/bootconfig: Add a script to generates bootconfig from ftrace")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
---
 tools/bootconfig/scripts/ftrace2bconf.sh | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh
index c23e7cc8a..6d7a1bd68 100755
--- a/tools/bootconfig/scripts/ftrace2bconf.sh
+++ b/tools/bootconfig/scripts/ftrace2bconf.sh
@@ -278,9 +278,7 @@ instance_options() { # [instance-name]
 		emit_kv $PREFIX.alloc_snapshot
 	fi
 	val=`cat $INSTANCE/tracing_cpumask`
-	if [ `echo $val | sed -e s/f//g`x != x ]; then
-		emit_kv $PREFIX.cpumask = "\"$val\""
-	fi
+	emit_kv $PREFIX.cpumask = "\"$val\""
 	val=`cat $INSTANCE/tracing_on`
 	if [ "$val" = "0" ]; then
 		emit_kv $PREFIX.tracing_on = 0
-- 
2.53.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-22  0:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-22  0:34 [PATCH 0/2] tools/bootconfig: Preserve tracing settings across export and replay Eduardo Mucelli Rezende Oliveira
2026-11-22  0:34 ` [PATCH 1/2] tools/bootconfig: Use the registered global tracing parameter names Eduardo Mucelli Rezende Oliveira
2026-11-22  0:34 ` [PATCH 2/2] tools/bootconfig: Preserve all-f tracing CPU masks on export Eduardo Mucelli Rezende Oliveira

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®