Revision tags: v6.6.25, v6.6.24, v6.6.23, v6.6.16, v6.6.15, v6.6.14, v6.6.13, v6.6.12, v6.6.11, v6.6.10, v6.6.9, v6.6.8, v6.6.7, v6.6.6, v6.6.5, v6.6.4, v6.6.3, v6.6.2, v6.5.11, v6.6.1, v6.5.10, v6.6, v6.5.9, v6.5.8, v6.5.7, v6.5.6, v6.5.5, v6.5.4, v6.5.3, v6.5.2, v6.1.51, v6.5.1, v6.1.50, v6.5, v6.1.49, v6.1.48, v6.1.46, v6.1.45, v6.1.44, v6.1.43, v6.1.42, v6.1.41, v6.1.40, v6.1.39, v6.1.38, v6.1.37, v6.1.36 |
|
#
49a5e3ed |
| 26-Jun-2023 |
Jiri Olsa <jolsa@kernel.org> |
perf tools: Add missing else to cmd_daemon subcommand condition
Namhyung reported segfault in perf daemon start command.
It's caused by extra check on argv[0] which is set to NULL by previous __cmd
perf tools: Add missing else to cmd_daemon subcommand condition
Namhyung reported segfault in perf daemon start command.
It's caused by extra check on argv[0] which is set to NULL by previous __cmd_start call. Adding missing else to skip the extra check.
Fixes: 92294b906e6c ("perf daemon: Dynamically allocate path to perf") Reported-and-Tested-by: Namhyung Kim <namhyung@kernel.org> Reported-by: Thomas Richter <tmricht@linux.ibm.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Link: https://lore.kernel.org/r/20230626201606.2514679-1-jolsa@kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org>
show more ...
|
Revision tags: v6.4, v6.1.35, v6.1.34, v6.1.33, v6.1.32, v6.1.31 |
|
#
92294b90 |
| 26-May-2023 |
Ian Rogers <irogers@google.com> |
perf daemon: Dynamically allocate path to perf
Avoid a PATH_MAX array in __daemon (the .data section) by dynamically allocating the memory.
Signed-off-by: Ian Rogers <irogers@google.com> Link: http
perf daemon: Dynamically allocate path to perf
Avoid a PATH_MAX array in __daemon (the .data section) by dynamically allocating the memory.
Signed-off-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20230526183401.2326121-9-irogers@google.com Cc: K Prateek Nayak <kprateek.nayak@amd.com> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Ross Zwisler <zwisler@chromium.org> Cc: Steven Rostedt (Google) <rostedt@goodmis.org> Cc: Sean Christopherson <seanjc@google.com> Cc: Yang Jihong <yangjihong1@huawei.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Andi Kleen <ak@linux.intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Tiezhu Yang <yangtiezhu@loongson.cn> Cc: Ingo Molnar <mingo@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: linux-kernel@vger.kernel.org Cc: linux-perf-users@vger.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
Revision tags: v6.1.30, v6.1.29, v6.1.28, v6.1.27, v6.1.26, v6.3, v6.1.25, v6.1.24 |
|
#
789eae7f |
| 12-Apr-2023 |
Arnaldo Carvalho de Melo <acme@redhat.com> |
perf daemon: Use zfree() to reduce chances of use after free
Do defensive programming by using zfree() to initialize freed pointers to NULL, so that eventual use after free result in a NULL pointer
perf daemon: Use zfree() to reduce chances of use after free
Do defensive programming by using zfree() to initialize freed pointers to NULL, so that eventual use after free result in a NULL pointer deref instead of more subtle behaviour.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
Revision tags: v6.1.23, v6.1.22, v6.1.21, v6.1.20, v6.1.19, v6.1.18, v6.1.17, v6.1.16, v6.1.15, v6.1.14, v6.1.13, v6.2, v6.1.12, v6.1.11, v6.1.10, v6.1.9, v6.1.8, v6.1.7, v6.1.6, v6.1.5, v6.0.19, v6.0.18, v6.1.4, v6.1.3, v6.0.17, v6.1.2, v6.0.16, v6.1.1, v6.0.15, v6.0.14, v6.0.13, v6.1, v6.0.12, v6.0.11, v6.0.10, v5.15.80, v6.0.9, v5.15.79, v6.0.8, v5.15.78, v6.0.7, v5.15.77, v5.15.76, v6.0.6, v6.0.5, v5.15.75, v6.0.4 |
|
#
7f337429 |
| 24-Oct-2022 |
Ian Rogers <irogers@google.com> |
perf daemon: Use sig_atomic_t to avoid UB
Use sig_atomic_t for a variable written to in a signal handler and read elsewhere. This is undefined behavior as per:
https://wiki.sei.cmu.edu/confluence
perf daemon: Use sig_atomic_t to avoid UB
Use sig_atomic_t for a variable written to in a signal handler and read elsewhere. This is undefined behavior as per:
https://wiki.sei.cmu.edu/confluence/display/c/SIG31-C.+Do+not+access+shared+objects+in+signal+handlers
Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> Cc: German Gomez <german.gomez@arm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: https://lore.kernel.org/r/20221024181913.630986-4-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
a87edbec |
| 22-Oct-2022 |
Yang Jihong <yangjihong1@huawei.com> |
perf daemon: Complete list of supported subcommand in help message
perf daemon supports start, signal, stop and ping subcommands, complete it
Before:
# perf daemon -h Usage: perf daemon start
perf daemon: Complete list of supported subcommand in help message
perf daemon supports start, signal, stop and ping subcommands, complete it
Before:
# perf daemon -h Usage: perf daemon start [<options>] or: perf daemon [<options>]
-v, --verbose be more verbose -x, --field-separator[=<field separator>] print counts with custom separator --base <directory> base directory --config <config file> config file path
After:
# perf daemon -h
Usage: perf daemon {start|signal|stop|ping} [<options>] or: perf daemon [<options>]
-v, --verbose be more verbose -x, --field-separator[=<field separator>] print counts with custom separator --base <directory> base directory --config <config file> config file path
Signed-off-by: Yang Jihong <yangjihong1@huawei.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20221022092735.114967-3-yangjihong1@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
Revision tags: v6.0.3, v6.0.2, v5.15.74, v5.15.73, v6.0.1, v5.15.72, v6.0, v5.15.71, v5.15.70, v5.15.69, v5.15.68, v5.15.67, v5.15.66, v5.15.65, v5.15.64, v5.15.63, v5.15.62, v5.15.61, v5.15.60, v5.15.59, v5.19, v5.15.58, v5.15.57, v5.15.56, v5.15.55, v5.15.54, v5.15.53, v5.15.52, v5.15.51, v5.15.50, v5.15.49, v5.15.48, v5.15.47, v5.15.46, v5.15.45, v5.15.44, v5.15.43, v5.15.42, v5.18, v5.15.41, v5.15.40, v5.15.39, v5.15.38, v5.15.37, v5.15.36, v5.15.35, v5.15.34, v5.15.33, v5.15.32, v5.15.31, v5.17, v5.15.30, v5.15.29, v5.15.28, v5.15.27, v5.15.26, v5.15.25, v5.15.24, v5.15.23, v5.15.22, v5.15.21, v5.15.20, v5.15.19, v5.15.18, v5.15.17, v5.4.173, v5.15.16, v5.15.15, v5.16, v5.15.10, v5.15.9, v5.15.8, v5.15.7, v5.15.6, v5.15.5, v5.15.4, v5.15.3, v5.15.2, v5.15.1, v5.15, v5.14.14, v5.14.13, v5.14.12, v5.14.11, v5.14.10 |
|
#
c6c00900 |
| 06-Oct-2021 |
Guo Zhengkui <guozhengkui@vivo.com> |
perf daemon: Remove duplicate sys/file.h include
There is a "#include <sys/file.h>" in line 10, so remove a duplicate one in line 1124.
Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com> Cc: Alexan
perf daemon: Remove duplicate sys/file.h include
There is a "#include <sys/file.h>" in line 10, so remove a duplicate one in line 1124.
Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20211006062235.6364-1-guozhengkui@vivo.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
Revision tags: v5.14.9, v5.14.8, v5.14.7, v5.14.6, v5.10.67, v5.10.66, v5.14.5, v5.14.4, v5.10.65, v5.14.3, v5.10.64, v5.14.2, v5.10.63, v5.14.1, v5.10.62, v5.14, v5.10.61, v5.10.60, v5.10.53, v5.10.52, v5.10.51, v5.10.50, v5.10.49, v5.13, v5.10.46 |
|
#
b28e5e43 |
| 17-Jun-2021 |
Ian Rogers <irogers@google.com> |
perf daemon: Avoid msan warnings on send_cmd
As a full union is always sent, ensure all bytes of the union are initialized with memset to avoid msan warnings of use of uninitialized memory.
An exam
perf daemon: Avoid msan warnings on send_cmd
As a full union is always sent, ensure all bytes of the union are initialized with memset to avoid msan warnings of use of uninitialized memory.
An example warning from the daemon test:
Uninitialized bytes in __interceptor_write at offset 71 inside [0x7ffd98da6280, 72) ==11602==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x5597edccdbe4 in ion tools/lib/perf/lib.c:18:6 #1 0x5597edccdbe4 in writen tools/lib/perf/lib.c:47:9 #2 0x5597ed221d30 in send_cmd tools/perf/builtin-daemon.c:1376:22 #3 0x5597ed21b48c in cmd_daemon tools/perf/builtin-daemon.c #4 0x5597ed1d6b67 in run_builtin tools/perf/perf.c:313:11 #5 0x5597ed1d6036 in handle_internal_command tools/perf/perf.c:365:8 #6 0x5597ed1d6036 in run_argv tools/perf/perf.c:409:2 #7 0x5597ed1d6036 in main tools/perf/perf.c:539:3
SUMMARY: MemorySanitizer: use-of-uninitialized-value tools/lib/perf/lib.c:18:6 in ion Exiting
Signed-off-by: Ian Rogers <irogers@google.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20210617055554.1917997-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
Revision tags: v5.10.43, v5.10.42, v5.10.41, v5.10.40, v5.10.39, v5.4.119, v5.10.36, v5.10.35, v5.10.34, v5.4.116, v5.10.33, v5.12, v5.10.32, v5.10.31, v5.10.30, v5.10.27, v5.10.26 |
|
#
463a7d5a |
| 23-Mar-2021 |
Wan Jiabing <wanjiabing@vivo.com> |
perf daemon: Remove duplicate includes
sys/stat.h has been included at line 23, so remove the duplicate one at line 27.
linux/string.h has been included at line 7, so remove the duplicate one at li
perf daemon: Remove duplicate includes
sys/stat.h has been included at line 23, so remove the duplicate one at line 27.
linux/string.h has been included at line 7, so remove the duplicate one at line 9.
time.h has been included at line 14, so remove the duplicate one at line 28.
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: kael_w@yeah.net Link: http://lore.kernel.org/lkml/20210323050139.287461-1-wanjiabing@vivo.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
9f177fd8 |
| 20-Mar-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Return from kill functions
We should return correctly and warn in both daemon_session__kill() and daemon__kill() after we tried everything to kill sessions. The current code will keep
perf daemon: Return from kill functions
We should return correctly and warn in both daemon_session__kill() and daemon__kill() after we tried everything to kill sessions. The current code will keep on looping and waiting.
Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20210320221013.1619613-2-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
1833b64f |
| 20-Mar-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Force waipid for all session on SIGCHLD delivery
If we don't process SIGCHLD before another comes, we will see just one SIGCHLD as a result. In this case current code will miss exit not
perf daemon: Force waipid for all session on SIGCHLD delivery
If we don't process SIGCHLD before another comes, we will see just one SIGCHLD as a result. In this case current code will miss exit notification for a session and wait forever.
Adding extra waitpid check for all sessions when SIGCHLD is received, to make sure we don't miss any session exit.
Also fix close condition for signal_fd.
Reported-by: Ian Rogers <irogers@google.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20210320221013.1619613-1-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
Revision tags: v5.10.25, v5.10.24, v5.10.23, v5.10.22, v5.10.21, v5.10.20, v5.10.19, v5.4.101 |
|
#
bd57a9f3 |
| 24-Feb-2021 |
Namhyung Kim <namhyung@kernel.org> |
perf daemon: Fix compile error with Asan
I'm seeing a build failure when build with address sanitizer. It seems we could write to the name[100] if the var is longer.
$ make EXTRA_CFLAGS=-fsaniti
perf daemon: Fix compile error with Asan
I'm seeing a build failure when build with address sanitizer. It seems we could write to the name[100] if the var is longer.
$ make EXTRA_CFLAGS=-fsanitize=address ... CC builtin-daemon.o In function ‘get_session_name’, inlined from ‘session_config’ at builtin-daemon.c:164:6, inlined from ‘server_config’ at builtin-daemon.c:223:10: builtin-daemon.c:155:11: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] 155 | *session = 0; | ~~~~~~~~~^~~ builtin-daemon.c: In function ‘server_config’: builtin-daemon.c:162:7: note: at offset 100 to object ‘name’ with size 100 declared here 162 | char name[100]; | ^~~~
Fixes: c0666261ff38 ("perf daemon: Add config file support") Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: https://lore.kernel.org/r/20210224071438.686677-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
31bf4e7c |
| 01-Mar-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Fix control fifo permissions
Add proper mode for mkfifo calls to get read and write permissions for user. We can't use O_RDWR in here, changing to standard permission value.
Fixes: 6a6
perf daemon: Fix control fifo permissions
Add proper mode for mkfifo calls to get read and write permissions for user. We can't use O_RDWR in here, changing to standard permission value.
Fixes: 6a6d1804a190 ("perf daemon: Set control fifo for session") Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: John Garry <john.garry@huawei.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20210301122510.64402-1-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
Revision tags: v5.10.18, v5.10.17, v5.11, v5.10.16, v5.10.15 |
|
#
5bdee4f0 |
| 08-Feb-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Add up time for daemon/session list
Display up time for both daemon and sessions.
Example:
# cat ~/.perfconfig [daemon] base=/opt/perfdata
[session-cycles] run = -m 10M -e
perf daemon: Add up time for daemon/session list
Display up time for both daemon and sessions.
Example:
# cat ~/.perfconfig [daemon] base=/opt/perfdata
[session-cycles] run = -m 10M -e cycles --overwrite --switch-output -a
[session-sched] run = -m 20M -e sched:* --overwrite --switch-output -a
Starting the daemon:
# perf daemon start
Get the details with up time:
# perf daemon -v [778315:daemon] base: /opt/perfdata output: /opt/perfdata/output lock: /opt/perfdata/lock up: 15 minutes [778316:cycles] perf record -m 20M -e cycles --overwrite --switch-output -a base: /opt/perfdata/session-cycles output: /opt/perfdata/session-cycles/output control: /opt/perfdata/session-cycles/control ack: /opt/perfdata/session-cycles/ack up: 10 minutes [778317:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a base: /opt/perfdata/session-sched output: /opt/perfdata/session-sched/output control: /opt/perfdata/session-sched/control ack: /opt/perfdata/session-sched/ack up: 2 minutes
Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-18-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
6d6162d5 |
| 08-Feb-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Use control to stop session
Use the 'stop' control command to stop perf record session. If that fails, fall back to current SIGTERM/SIGKILL pair.
Signed-off-by: Jiri Olsa <jolsa@kerne
perf daemon: Use control to stop session
Use the 'stop' control command to stop perf record session. If that fails, fall back to current SIGTERM/SIGKILL pair.
Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-17-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
edcaa479 |
| 08-Feb-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Add 'ping' command
Add a 'ping' command to verify that the 'perf record' session is up and operational.
It's used in the following patches via test code to make sure 'perf record' is r
perf daemon: Add 'ping' command
Add a 'ping' command to verify that the 'perf record' session is up and operational.
It's used in the following patches via test code to make sure 'perf record' is ready to receive signals.
Example:
# cat ~/.perfconfig [daemon] base=/opt/perfdata
[session-cycles] run = -m 10M -e cycles --overwrite --switch-output -a
[session-sched] run = -m 20M -e sched:* --overwrite --switch-output -a
Start the daemon:
# perf daemon start
Ping all sessions:
# perf daemon ping OK cycles OK sched
Ping specific session:
# perf daemon ping --session sched OK sched
Committer notes:
Fixed up bug pointed by clang:
Buggy:
if (!pollfd.revents & POLLIN)
Correct code:
if (!(pollfd.revents & POLLIN))
clang warning:
builtin-daemon.c:560:6: error: logical not is only applied to the left hand side of this bitwise operator [-Werror,-Wlogical-not-parentheses] if (!pollfd.revents & POLLIN) { ^ ~ builtin-daemon.c:560:6: note: add parentheses after the '!' to evaluate the bitwise operator first
Also use designated initialized with pollfd, i.e.:
struct pollfd pollfd = { .events = POLLIN, };
Instead of:
struct pollfd pollfd = { 0, };
To get past:
builtin-daemon.c:510:30: error: missing field 'events' initializer [-Werror,-Wmissing-field-initializers] struct pollfd pollfd = { 0, }; ^ 1 error generated.
Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-16-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
6a6d1804 |
| 08-Feb-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Set control fifo for session
Setup control fifos for session and add --control option to session arguments.
Example:
# cat ~/.perfconfig [daemon] base=/opt/perfdata
[session-
perf daemon: Set control fifo for session
Setup control fifos for session and add --control option to session arguments.
Example:
# cat ~/.perfconfig [daemon] base=/opt/perfdata
[session-cycles] run = -m 10M -e cycles --overwrite --switch-output -a
[session-sched] run = -m 20M -e sched:* --overwrite --switch-output -a
Starting the daemon:
# perf daemon start
Use can list control fifos with (control and ack files):
# perf daemon -v [776459:daemon] base: /opt/perfdata output: /opt/perfdata/output lock: /opt/perfdata/lock [776460:cycles] perf record -m 20M -e cycles --overwrite --switch-output -a base: /opt/perfdata/session-cycles output: /opt/perfdata/session-cycles/output control: /opt/perfdata/session-cycles/control ack: /opt/perfdata/session-cycles/ack [776461:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a base: /opt/perfdata/session-sched output: /opt/perfdata/session-sched/output control: /opt/perfdata/session-sched/control ack: /opt/perfdata/session-sched/ack
Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-15-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
8c98be6c |
| 08-Feb-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Allow only one daemon over base directory
Add 'lock' file under daemon base and flock it, so only one perf daemon can run on top of it.
Each daemon tries to create and lock BASE/lock f
perf daemon: Allow only one daemon over base directory
Add 'lock' file under daemon base and flock it, so only one perf daemon can run on top of it.
Each daemon tries to create and lock BASE/lock file, if it's successful we are sure we're the only daemon running over the BASE.
Once daemon is finished, file descriptor to lock file is closed and lock is released.
Example:
# cat ~/.perfconfig [daemon] base=/opt/perfdata
[session-cycles] run = -m 10M -e cycles --overwrite --switch-output -a
[session-sched] run = -m 20M -e sched:* --overwrite --switch-output -a
Starting the daemon:
# perf daemon start
And try once more:
# perf daemon start failed: another perf daemon (pid 775594) owns /opt/perfdata
will end up with an error, because there's already one running on top of /opt/perfdata.
Committer notes:
Provide lockf(F_TLOCK) when not available, i.e. transform:
lockf(fd, F_TLOCK, 0);
into:
flock(fd, LOCK_EX | LOCK_NB);
Which should be equivalent.
Noticed when cross building to some odd Android NDK.
Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-14-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
23c5831e |
| 08-Feb-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Add 'stop' command
Add 'perf daemon stop' command to stop daemon process and all running sessions.
Example:
# cat ~/.perfconfig [daemon] base=/opt/perfdata
[session-cycles]
perf daemon: Add 'stop' command
Add 'perf daemon stop' command to stop daemon process and all running sessions.
Example:
# cat ~/.perfconfig [daemon] base=/opt/perfdata
[session-cycles] run = -m 10M -e cycles --overwrite --switch-output -a
[session-sched] run = -m 20M -e sched:* --overwrite --switch-output -a
Start the daemon:
# perf daemon start
Stop the daemon
# perf daemon stop
Daemon is not running, nothing to connect to:
# perf daemon connect error: Connection refused
Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-13-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
2d6914cd |
| 08-Feb-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Add 'signal' command
Allow the 'perf daemon' to send SIGUSR2 to all running sessions or just to a specific session.
Example:
# cat ~/.perfconfig [daemon] base=/opt/perfdata
[
perf daemon: Add 'signal' command
Allow the 'perf daemon' to send SIGUSR2 to all running sessions or just to a specific session.
Example:
# cat ~/.perfconfig [daemon] base=/opt/perfdata
[session-cycles] run = -m 10M -e cycles --overwrite --switch-output -a
[session-sched] run = -m 20M -e sched:* --overwrite --switch-output -a
Start the daemon:
# perf daemon start
Send signal to all running sessions:
# perf daemon signal signal 12 sent to session 'cycles [773738]' signal 12 sent to session 'sched [773739]'
Or to specific one:
# perf daemon signal --session sched signal 12 sent to session 'sched [773739]'
And verify signals were delivered and perf.data dumped:
# cat /opt/perfdata/session-cycles/output rounding mmap pages size to 32M (8192 pages) [ perf record: dump data: Woken up 1 times ] [ perf record: Dump perf.data.2021010220382490 ]
# car /opt/perfdata/session-sched/output rounding mmap pages size to 32M (8192 pages) [ perf record: dump data: Woken up 1 times ] [ perf record: Dump perf.data.2021010220382489 ] [ perf record: dump data: Woken up 1 times ] [ perf record: Dump perf.data.2021010220393745 ]
Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-12-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
b325f7be |
| 08-Feb-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Add 'list' command
Add a 'list' command to display all running sessions. It's the default command if no other command is specified.
Example:
# cat ~/.perfconfig [daemon] base=/
perf daemon: Add 'list' command
Add a 'list' command to display all running sessions. It's the default command if no other command is specified.
Example:
# cat ~/.perfconfig [daemon] base=/opt/perfdata
[session-cycles] run = -m 10M -e cycles --overwrite --switch-output -a
[session-sched] run = -m 20M -e sched:* --overwrite --switch-output -a
Start the daemon:
# perf daemon start
List sessions:
# perf daemon [771394:daemon] base: /opt/perfdata [771395:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a [771396:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a
List sessions with more info:
# perf daemon -v [771394:daemon] base: /opt/perfdata output: /opt/perfdata/output [771395:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a base: /opt/perfdata/session-cycles output: /opt/perfdata/session-cycles/output [771396:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a base: /opt/perfdata/session-sched output: /opt/perfdata/session-sched/output
The 'output' file is perf record output for specific session.
Note you have to stop all running perf processes manually at this point, stop command is coming in following patches.
Committer notes:
Fixup union initialization to overcome this in multiple older systems:
22 15.74 debian:8 : FAIL gcc version 4.9.2 (Debian 4.9.2-10+deb8u2)
builtin-daemon.c: In function 'send_cmd_list': builtin-daemon.c:1386:2: error: missing initializer for field 'csv_sep' of 'struct <anonymous>' [-Werror=missing-field-initializers] }; ^ builtin-daemon.c:641:8: note: 'csv_sep' declared here char csv_sep; ^ cc1: all warnings being treated as errors
Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-11-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
12c1a415 |
| 08-Feb-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Add signalfd support
Use a signalfd fd to track SIGCHLD signals as notifications for perf session termination.
This way we don't need to actively check for child status, being notified
perf daemon: Add signalfd support
Use a signalfd fd to track SIGCHLD signals as notifications for perf session termination.
This way we don't need to actively check for child status, being notified if there's change.
Suggested-by: Alexei Budankov <abudankov@huawei.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-10-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
88adb119 |
| 08-Feb-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Add background support
Add support to put the daemon process in the background.
It's now enabled by default and -f option is added to keep the daemon process on the console for debuggi
perf daemon: Add background support
Add support to put the daemon process in the background.
It's now enabled by default and -f option is added to keep the daemon process on the console for debugging.
Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-9-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
3cda0625 |
| 08-Feb-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Add config file change check
Add support to detect changes to the daemon's config file triggering a re-read of the configuration when that happens.
Use a inotify file descriptor plugge
perf daemon: Add config file change check
Add support to detect changes to the daemon's config file triggering a re-read of the configuration when that happens.
Use a inotify file descriptor plugged into the main fdarray object for polling.
Example:
# cat ~/.perfconfig [daemon] base=/opt/perfdata
[session-cycles] run = -m 10M -e cycles --overwrite --switch-output -a
Starting the daemon:
# perf daemon start
Check sessions:
# perf daemon [772262:daemon] base: /opt/perfdata [772263:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a
Change '-m 10M' to '-m 20M', and check daemon log:
# tail -f /opt/perfdata/output [2021-01-02 20:31:41.234045] daemon started (pid 772262) [2021-01-02 20:31:41.235072] reconfig: ruining session [cycles:772263]: -m 10M -e cycles --overwrite --switch-output -a [2021-01-02 20:32:08.310137] reconfig: session 'cycles' killed [2021-01-02 20:32:08.310847] reconfig: ruining session [cycles:772338]: -m 20M -e cycles --overwrite --switch-output -a
And the session list:
# perf daemon [772262:daemon] base: /opt/perfdata [772338:cycles] perf record -m 20M -e cycles --overwrite --switch-output -a
Note the changed '-m 20M' option is in place.
Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-8-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
c0666261 |
| 08-Feb-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Add config file support
Adding support to configure daemon with config file.
Each client or server invocation of perf daemon needs to know the base directory, where all sessions data i
perf daemon: Add config file support
Adding support to configure daemon with config file.
Each client or server invocation of perf daemon needs to know the base directory, where all sessions data is stored.
The base is defined with:
daemon.base Base path for daemon data. All sessions data are stored under this path.
The daemon allows to create record sessions. Each session is a record command spawned and monitored by perf daemon.
The session is defined with:
session-<NAME>.run Defines new record session for daemon. The value is record's command line without the 'record' keyword.
Example:
# cat ~/.perfconfig [daemon] base=/opt/perfdata
[session-cycles] run = -m 10M -e cycles --overwrite --switch-output -a
[session-sched] run = -m 20M -e sched:* --overwrite --switch-output -a
The example above defines '/opt/perfdata' as the base directory and 2 record sessions.
# perf daemon start [2021-01-28 19:47:33.454413] daemon started (pid 16015) [2021-01-28 19:47:33.455910] reconfig: ruining session [cycles:16016]: -m 10M -e cycles --overwrite --switch-output -a [2021-01-28 19:47:33.456599] reconfig: ruining session [sched:16017]: -m 20M -e sched:* --overwrite --switch-output -a
# ps -ef | grep perf ... perf daemon start ... /home/jolsa/.../perf record -m 20M -e cycles --overwrite --switch-output -a ... /home/jolsa/.../perf record -m 20M -e sched:* --overwrite --switch-output -a
The base directory is populated with:
# find /opt/perfdata/ /opt/perfdata/ /opt/perfdata/control <- control socket /opt/perfdata/session-cycles <- data for session 'cycles': /opt/perfdata/session-cycles/output <- perf record output /opt/perfdata/session-cycles/perf.data <- perf data /opt/perfdata/session-sched <- ditto for session 'sched' /opt/perfdata/session-sched/output /opt/perfdata/session-sched/perf.data
Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-7-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|
#
90b0aad8 |
| 08-Feb-2021 |
Jiri Olsa <jolsa@kernel.org> |
perf daemon: Add client socket support
Add support for client socket side that will be used to send commands to the daemon server socket.
This patch adds only the core support, all commands using t
perf daemon: Add client socket support
Add support for client socket side that will be used to send commands to the daemon server socket.
This patch adds only the core support, all commands using this functionality are coming in the following patches.
Committer notes:
Hat to patch patch it to deal with this in some systems:
cc1: warnings being treated as errors builtin-daemon.c: In function 'send_cmd': MKDIR /tmp/build/perf/bench/
builtin-daemon.c:1368: error: ignoring return value of 'fwrite', declared with attribute warn_unused_result MKDIR /tmp/build/perf/tests/ make[3]: *** [/tmp/build/perf/builtin-daemon.o] Error 1
And also to not leak the 'line' buffer allocated by getline(), since you initialized line to NULL and len to zero, man page says:
If *lineptr is set to NULL and *n is set 0 before the call, then getline() will allocate a buffer for storing the line. This buffer should be freed by the user program even if getline() failed.
Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-6-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
show more ...
|