]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf ftrace: Use process/session specific trace settings
authorThomas Richter <tmricht@linux.ibm.com>
Tue, 20 May 2025 09:37:26 +0000 (11:37 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 20 May 2025 16:11:09 +0000 (13:11 -0300)
commitba5f102eec56d61ef590d16ae53e47a4c882d7db
tree67756dbc86c245370dc84fe149db53a92dccbfad
parente48b92f9e140ff632ad426c0a94e3630a61e45d8
perf ftrace: Use process/session specific trace settings

Executing 'perf ftrace' commands 'ftrace', 'profile' and 'latency' leave
tracing disabled as can seen in this output:

 # echo 1 > /sys/kernel/debug/tracing/tracing_on
 # cat /sys/kernel/debug/tracing/tracing_on
 1
 # perf ftrace trace --graph-opts depth=5 sleep 0.1 > /dev/null
 # cat /sys/kernel/debug/tracing/tracing_on
 0
 #

The 'tracing_on' file is not restored to its value before the command.

To fix that this patch uses the .../tracing/instances/XXX subdirectory
feature.

Each 'perf ftrace' invocation creates its own session/process
specific subdirectory and does not change the global state
in the .../tracing directory itself.

Use rmdir(../tracing/instances/dir) to stop process/session specific
tracing and delete all process/session specific setings.

Reported-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: https://lore.kernel.org/r/20250520093726.2009696-1-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-ftrace.c