8d9b1734c7
perf annotate: Remove unused struct disasm_line_samples
...
After commit 3ab6db8d0f
("perf annotate browser: Use samples data from
struct annotation_line"), no one use struct disasm_line_samples, so
remove it.
Signed-off-by: Yuan Can <yuancan@huawei.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.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/linux-perf-users/20220927013931.110475-3-yuancan@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-06 08:03:51 -03:00
dae09ffca0
perf machine: Remove unused struct process_args
...
After commit a93f0e551a
("perf symbols: Get kernel start address by symbol
name"), no one uses struct process_args any more, so remove it.
Signed-off-by: Yuan Can <yuancan@huawei.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.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/linux-perf-users/20220927013931.110475-2-yuancan@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-06 08:03:51 -03:00
433b31fa00
perf lock contention: Fix a build error on 32-bit
...
It was reported that it failed to build the BPF lock contention skeleton
on 32 bit arch due to the size of long. The lost count is used only for
reporting errors due to lack of stackmap space through bad_hist which
type is 'int'. Let's use int type then.
Fixes: 6d499a6b3d
("perf lock: Print the number of lost entries for BPF")
Reported-by: Jiri Slaby <jirislaby@kernel.org >
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Song Liu <songliubraving@fb.com >
Link: http://lore.kernel.org/lkml/20220926215638.3931222-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-06 08:03:51 -03:00
c7c43e38b2
perf stat: Clean redundant if in process_evlist
...
Since the first if statment is covered by the following one, clean up
the first if statment.
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com >
Acked-by: Ian Rogers <irogers@google.com >
Cc: Alexander Shishkin <alexander.shishkin@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/20220922141438.22487-5-shangxiaojing@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-06 08:03:51 -03:00
1dc86fc731
perf test: Introduce script for java symbol testing
...
This commit introduces a script for testing java symbols.
The test records java program, inject samples with JIT samples, check
specific JIT symbols in the report, the test will pass only when these
two symbols are detected.
Suggested-by: Ian Rogers <irogers@google.com >
Signed-off-by: Leo Yan <leo.yan@linaro.org >
Cc: Alexander Shishkin <alexander.shishkin@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/20220925025835.70364-3-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
96b731412d
perf trace: Fix incorrectly parsed hexadecimal value for flags in filter
...
When parsing flags in filter, the strtoul function uses wrong parsing
condition (tok[1] = 'x'), which can make the flags be corrupted and
treat all numbers start with 0 as hex.
In fact strtoul() will auto test hex format when base == 0 (See
_parse_integer_fixup_radix). So there is no need to test this again.
Remove the unnessesary is_hexa test.
Fixes: 154c978d48
("libbeauty: Introduce strarray__strtoul_flags()")
Signed-off-by: Chen Zhongjin <chenzhongjin@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: Florian Fischer <florian.fischer@muhq.space >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.garry@huawei.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/20220926031440.28275-3-chenzhongjin@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
888964a05d
perf trace: Fix show_arg_names not working for tp arg names
...
trace__fprintf_tp_fields() will always print arg names because when
implemented it is forced to print arg_names with:
(1 || trace->show_arg_names)
So the printing looks like:
> cat ~/.perfconfig
[trace]
show_arg_names = no
> perf trace -e syscalls:*mmap sleep 1
0.000 sleep/1119 syscalls:sys_enter_mmap(NULL, 8192, READ|WRITE, PRIVATE|ANONYMOUS)
0.179 sleep/1119 syscalls:sys_exit_mmap(__syscall_nr: 9, ret: 140535426170880)
...
Although the comment said that perhaps we need a show_tp_arg_names.
I don't think it's necessary to control them separately because it's not
so clean that part of the log shows arg names but other not.
Also when we are tracing functions it's rare to especially distinguish
syscalls and tp trace.
Only use one option to control arg names printing is more resonable and
simple. So remove the force condition and commit.
After fix:
> perf trace -e syscalls:*mmap sleep 1
0.000 sleep/1121 syscalls:sys_enter_mmap(NULL, 8192, READ|WRITE, PRIVATE|ANONYMOUS)
0.163 sleep/1121 syscalls:sys_exit_mmap(9, 140454467661824)
...
Fixes: f11b2803bb
("perf trace: Allow choosing how to augment the tracepoint arguments")
Signed-off-by: Chen Zhongjin <chenzhongjin@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: Florian Fischer <florian.fischer@muhq.space >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.garry@huawei.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/20220926031440.28275-2-chenzhongjin@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
b71536a492
perf string: Remove unused macro K()
...
Unused macro reported by [-Wunused-macros].
This macro is introduced to calculate the 'unit' size, in:
d2fb8b4151
("perf tools: Add new perf_atoll() function to parse string representing size in bytes")
8ba7f6c2fa
("saner perf_atoll()")
This commit has simplified the perf_atoll() function and remove the
'unit' variable. This macro is not deleted, but nowhere else is using
it.
A single letter macro is confusing and easy to be misused. So remove it
for code cleaning.
Signed-off-by: Chen Zhongjin <chenzhongjin@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: Florian Fischer <florian.fischer@muhq.space >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.garry@huawei.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/20220926031440.28275-6-chenzhongjin@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
ec685de25b
perf test: Add kernel lock contention test
...
Add a new shell test to check if both normal 'perf lock record' +
contention and BPF (with -b) option are working.
Use 'perf bench sched messaging' as a workload since it creates some
contention for sending and receiving messages.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: https://lore.kernel.org/r/20220924004221.841024-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
6bbc482017
perf lock: Add -q/--quiet option to suppress header and debug messages
...
Like in 'perf report', this option is to suppress header and debug messages.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: https://lore.kernel.org/r/20220924004221.841024-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
6282a1f4f8
perf lock: Add -E/--entries option
...
Like in 'perf top', the -E option can limit number of entries to print.
It can be useful when users want to see top N contended locks only.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: https://lore.kernel.org/r/20220924004221.841024-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
84838712e9
perf test: waiting.sh: Parameterize timeouts
...
Let helper functions accept a parameter to specify time out values in
tenths of a second.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220914080150.5888-3-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
5ebcdf07f7
perf test: test_intel_pt.sh: Move helper functions for waiting
...
Move helper functions for waiting to a separate file so they can be
shared.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220914080150.5888-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
fea753f8e3
perf test: test_intel_pt.sh: Add per-thread test
...
When tracing the kernel with Intel PT, text_poke events are recorded
per-cpu. In per-thread mode that results in a mixture of per-thread and
per-cpu events and mmaps. Check that happens correctly.
The debug output from perf record -vvv is recorded and then awk used to
process the debug messages that indicate what file descriptors were
opened and whether they were mmapped or set-output.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: http://lore.kernel.org/lkml/20220912083412.7058-12-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
da4062021e
perf tools: Add debug messages and comments for testing
...
Add debug messages to enable scripts to track aspects of 'perf record'
behaviour. The messages will be consumed after 'perf record' has run,
with the exception of "perf record has started" which is consequently
flushed.
Put comments so developers know which messages are also being used by test
scripts.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220912083412.7058-11-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
2c1c9e351a
perf test: test_intel_pt.sh: Add more output in preparation for more tests
...
When there are more tests it won't be obvious which test failed. Add more
output so that it is.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220912083412.7058-10-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
fd9b45e39c
perf test: test_intel_pt.sh: Fix return checking
...
The use of set -e will cause a function that returns non-zero to terminate
the script unless the result is consumed by || for example. That is OK if
there is only 1 test function, but not if there are more. Prepare for more
by using ||.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220912083412.7058-9-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
5d7aac2bf8
perf test: test_intel_pt.sh: Use quotes around variable expansion
...
As suggested by shellcheck, use quotes around variable expansion.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220912083412.7058-8-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
711949e2f0
perf test: test_intel_pt.sh: Use grep -c instead of grep plus wc -l
...
As suggested by shellcheck, use grep -c instead of grep plus wc -l
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220912083412.7058-7-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
1aaff2bac6
perf test: test_intel_pt.sh: Stop using backticks
...
As suggested by shellcheck, stop using backticks.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220912083412.7058-6-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
202d039413
perf test: test_intel_pt.sh: Stop using expr
...
As suggested by shellcheck, stop using expr.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220912083412.7058-5-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
3f79fff8bd
perf test: test_intel_pt.sh: Fix redirection
...
As reported by shellcheck, 2>&1 must come after >/dev/null
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220912083412.7058-4-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
170ac70f16
perf test: test_intel_pt.sh: Use a temp directory
...
Create a directory for temporary files so that mktemp needs to be used
only once. It also enables more temp files to be added without having to
add them also to the cleanup.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220912083412.7058-3-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
19af23df66
perf test: test_intel_pt.sh: Add cleanup function
...
Add a cleanup function that will still clean up if the script is
terminated prematurely.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Link: https://lore.kernel.org/r/20220912083412.7058-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:23 -03:00
4627a000dc
perf tests: Fix 'perf probe' error log check in skip_if_no_debuginfo
...
The perf probe related tests like probe_vfs_getname.sh which
is in "tools/perf/tests/shell" directory have dependency on
debuginfo information in the kernel. Currently debuginfo
check is handled by skip_if_no_debuginfo function in the
file "lib/probe_vfs_getname.sh". skip_if_no_debuginfo function
looks for this specific error log from perf probe to skip
the testcase:
<<>>
Failed to find the path for the kernel|Debuginfo-analysis is
not supported
<>>
But in some case, like this one in powerpc, while running this
test, observed error logs is:
<<>>
The /lib/modules/<version>/build/vmlinux file has no debug information.
Rebuild with CONFIG_DEBUG_INFO=y, or install an appropriate debuginfo
package.
Error: Failed to add events.
<<>>
Update the skip_if_no_debuginfo function to include the above
error, to skip the test in these scenarios too.
Reported-by: Disha Goel <disgoel@linux.vnet.ibm.com >
Signed-off-by: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Tested-by: Disha Goel <disgoel@linux.vnet.ibm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Nageswara R Sastry <rnsastry@linux.ibm.com >
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20220916104904.99798-1-atrajeev@linux.vnet.ibm.com
Reviewed-By: Kajol Jain <kjain@linux.ibm.com >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
7d18a824b5
perf annotate: Toggle full address <-> offset display
...
Handle 'f' key to toggle the display offset and full address. Obviously
it only works when users set to see disassembler output ('o' key). It'd
be useful when users want to see the full virtual address in the TUI
annotate browser.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Link: https://lore.kernel.org/r/20220923173142.805896-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
762461f1a5
perf tools: Add 'addr' sort key
...
Sometimes users want to see actual (virtual) address of sampled instructions.
Add a new 'addr' sort key to display the raw addresses.
$ perf record -o- true | perf report -i- -s addr
# To display the perf.data header info, please use --header/--header-only options.
#
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.000 MB - ]
#
# Total Lost Samples: 0
#
# Samples: 12 of event 'cycles:u'
# Event count (approx.): 252512
#
# Overhead Address
# ........ ..................
#
42.96% 0x7f96f08443d7
29.55% 0x7f96f0859b50
14.76% 0x7f96f0852e02
8.30% 0x7f96f0855028
4.43% 0xffffffff8de01087
Note that it just compares and displays the sample ip. Each process can
have a different memory layout and the ip will be different even if they run
the same binary. So this sort key is mostly meaningful for per-process
profile data.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Link: https://lore.kernel.org/r/20220923173142.805896-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
fd941521e8
perf inject: Clarify build-id options a little bit
...
Update the documentation of --build-id and --buildid-all options to
clarify the difference between them. The former requires full sample
processing to find which DSOs are actually used. While the latter simply
injects every DSO's build-id from MMAP{,2} records, skipping SAMPLEs.
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com >
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Link: https://lore.kernel.org/r/20220923173142.805896-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
d031a00a29
perf record: Fix a segfault in record__read_lost_samples()
...
When it fails to open events record__open() returns without setting the
session->evlist. Then it gets a segfault in the function trying to read
lost sample counts. You can easily reproduce it as a normal user like:
$ perf record -p 1 true
...
perf: Segmentation fault
...
Skip the function if it has no evlist. And add more protection for evsels
which are not properly initialized.
Fixes: a49aa8a54e861af1 ("perf record: Read and inject LOST_SAMPLES events")
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Acked-by: Leo Yan <leo.yan@linaro.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Link: https://lore.kernel.org/r/20220909235024.278281-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
dc64641c8f
perf top: Fix error code in cmd_top()
...
There are three error paths which return success:
1. Propagate the errno from evlist__create_maps() if it failed.
2. Return -EINVAL if top.sb_evlist is NULL.
3. Return -EINVAL if evlist__add_bpf_sb_event() failed.
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com >
Cc: Alexander Shishkin <alexander.shishkin@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/20220922141438.22487-4-shangxiaojing@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
cdd3b15d68
perf stat: Merge cases in process_evlist
...
As two cases in process_evlist has same behavior, make the first fall
through to the second.
Commiter notes:
Added __fallthrough, the kernel has "fallthrough", we need to make
tools/ use it.
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com >
Cc: Alexander Shishkin <alexander.shishkin@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/20220922141438.22487-3-shangxiaojing@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
e8a6430ff6
perf genelf: Fix error code in jit_write_elf()
...
The error code is set to -1 at the beginning of jit_write_elf(), but it is
assigned by jit_add_eh_frame_info() in the middle, hence the following
error can only return the error code of jit_add_eh_frame_info(). Reset
the error code to the default value after being assigned by
jit_add_eh_frame_info().
Fixes: 086f9f3d78
("perf jit: Generate .eh_frame/.eh_frame_hdr in DSO")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com >
Cc: Alexander Shishkin <alexander.shishkin@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 >
Cc: Stefano Sanfilippo <ssanfilippo@chromium.org >
Link: https://lore.kernel.org/r/20220922141438.22487-2-shangxiaojing@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
c1da8dd5c1
perf lock contention: Skip stack trace from BPF
...
Currently it collects stack traces to max size then skip entries.
Because we don't have control how to skip perf callchains. But BPF can
do it with bpf_get_stackid() with a flag.
Say we have max-stack=4 and stack-skip=2, we get these stack traces.
Before: After:
.---> +---+ <--. .---> +---+ <--.
| | | | | | | |
| +---+ usable | +---+ |
max | | | max | | |
stack +---+ <--' stack +---+ usable
| | X | | | | |
| +---+ skip | +---+ |
| | X | | | | |
`---> +---+ `---> +---+ <--' <=== collection
| X |
+---+ skip
| X |
+---+
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Song Liu <songliubraving@fb.com >
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20220912055314.744552-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
96532a83ee
perf lock contention: Allow to change stack depth and skip
...
It needs stack traces to find callers of locks. To minimize the
performance overhead it only collects up to 8 entries for each stack
trace. And it skips first 3 entries as they came from BPF, tracepoint
and lock functions which are not interested for most users.
But it turned out that those numbers are different in some
configuration. Using fixed number can result in non meaningful caller
names. Let's make them adjustable with --stack-depth and --skip-stack
options.
On my setup, the default output is like below:
# /perf lock con -ab -F contended,wait_total sleep 3
contended total wait type caller
28 4.55 ms rwlock:W __bpf_trace_contention_begin+0xb
33 1.67 ms rwlock:W __bpf_trace_contention_begin+0xb
12 580.28 us spinlock __bpf_trace_contention_begin+0xb
60 240.54 us rwsem:R __bpf_trace_contention_begin+0xb
27 64.45 us spinlock __bpf_trace_contention_begin+0xb
If I change the stack skip to 5, the result will be like:
# perf lock con -ab -F contended,wait_total --stack-skip 5 sleep 3
contended total wait type caller
32 715.45 us spinlock folio_lruvec_lock_irqsave+0x61
26 550.22 us spinlock folio_lruvec_lock_irqsave+0x61
15 486.93 us rwsem:R mmap_read_lock+0x13
12 139.66 us rwsem:W vm_mmap_pgoff+0x93
1 7.04 us spinlock tick_do_update_jiffies64+0x25
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Song Liu <songliubraving@fb.com >
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20220912055314.744552-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
a6eaf966bc
perf lock contention: Show full callstack with -v option
...
Currently it shows a caller function for each entry, but users need to see
the full call stacks sometimes. Use -v/--verbose option to do that.
# perf lock con -a -b -v sleep 3
Looking at the vmlinux_path (8 entries long)
symsrc__init: cannot get elf header.
Using /proc/kcore for kernel data
Using /proc/kallsyms for symbols
contended total wait max wait avg wait type caller
1 10.74 us 10.74 us 10.74 us spinlock __bpf_trace_contention_begin+0xb
0xffffffffc03b5c47 bpf_prog_bf07ae9e2cbd02c5_contention_begin+0x117
0xffffffffc03b5c47 bpf_prog_bf07ae9e2cbd02c5_contention_begin+0x117
0xffffffffbb8b8e75 bpf_trace_run2+0x35
0xffffffffbb7eab9b __bpf_trace_contention_begin+0xb
0xffffffffbb7ebe75 queued_spin_lock_slowpath+0x1f5
0xffffffffbc1c26ff _raw_spin_lock+0x1f
0xffffffffbb841015 tick_do_update_jiffies64+0x25
0xffffffffbb8409ee tick_irq_enter+0x9e
1 7.70 us 7.70 us 7.70 us spinlock __bpf_trace_contention_begin+0xb
0xffffffffc03b5c47 bpf_prog_bf07ae9e2cbd02c5_contention_begin+0x117
0xffffffffc03b5c47 bpf_prog_bf07ae9e2cbd02c5_contention_begin+0x117
0xffffffffbb8b8e75 bpf_trace_run2+0x35
0xffffffffbb7eab9b __bpf_trace_contention_begin+0xb
0xffffffffbb7ebe75 queued_spin_lock_slowpath+0x1f5
0xffffffffbc1c26ff _raw_spin_lock+0x1f
0xffffffffbb7bc27e raw_spin_rq_lock_nested+0xe
0xffffffffbb7cef9c load_balance+0x66c
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Song Liu <songliubraving@fb.com >
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20220912055314.744552-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
637522ce97
perf lock contention: Factor out get_symbol_name_offset()
...
It's to convert addr to symbol+offset.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Song Liu <songliubraving@fb.com >
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20220912055314.744552-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
f0c4b97a29
perf test: Add basic core_wide expression test
...
Add basic test for coverage, similar to #smt_on.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Ahmad Yasin <ahmad.yasin@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Florian Fischer <florian.fischer@muhq.space >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.garry@huawei.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Kshipra Bopardikar <kshipra.bopardikar@intel.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Miaoqian Lin <linmq006@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Cc: Thomas Richter <tmricht@linux.ibm.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20220831174926.579643-8-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
1725e9cd32
perf metrics: Wire up core_wide
...
Pass state necessary for core_wide into the expression parser. Add
system_wide and user_requested_cpu_list to perf_stat_config to make it
available at display time. evlist isn't used as the
evlist__create_maps, that computes user_requested_cpus, needs the list
of events which is generated by the metric.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Ahmad Yasin <ahmad.yasin@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Florian Fischer <florian.fischer@muhq.space >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.garry@huawei.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Kshipra Bopardikar <kshipra.bopardikar@intel.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Miaoqian Lin <linmq006@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Cc: Thomas Richter <tmricht@linux.ibm.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20220831174926.579643-7-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
a4b8cfcabb
perf stat: Delay metric parsing
...
Having metric parsing as part of argument processing causes issues as
flags like metric-no-group may be specified later. It also denies the
opportunity to optimize the events on SMT systems where fewer events
may be possible if we know the target is system-wide. Move metric
parsing to after command line option parsing. Because of how stat runs
this moves the parsing after record/report which fail to work with
metrics currently anyway.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Ahmad Yasin <ahmad.yasin@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Florian Fischer <florian.fischer@muhq.space >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.garry@huawei.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Kshipra Bopardikar <kshipra.bopardikar@intel.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Miaoqian Lin <linmq006@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Cc: Thomas Richter <tmricht@linux.ibm.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20220831174926.579643-6-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
cc2c4e26ec
perf topology: Add core_wide
...
It is possible to optimize metrics when all SMT threads (CPUs) on a
core are measuring events in system wide mode. For example, TMA
metrics defines CORE_CLKS for Sandybrdige as:
if SMT is disabled:
CPU_CLK_UNHALTED.THREAD
if SMT is enabled and recording on all SMT threads:
CPU_CLK_UNHALTED.THREAD_ANY / 2
if SMT is enabled and not recording on all SMT threads:
(CPU_CLK_UNHALTED.THREAD/2)*
(1+CPU_CLK_UNHALTED.ONE_THREAD_ACTIVE/CPU_CLK_UNHALTED.REF_XCLK )
That is two more events are necessary when not gathering counts on all
SMT threads. To distinguish all SMT threads on a core vs system wide
(all CPUs) call the new property core wide. Add a core wide test that
determines the property from user requested CPUs, the topology and
system wide. System wide is required as other processes running on a
SMT thread will change the counts.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Ahmad Yasin <ahmad.yasin@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Florian Fischer <florian.fischer@muhq.space >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.garry@huawei.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Kshipra Bopardikar <kshipra.bopardikar@intel.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Miaoqian Lin <linmq006@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Cc: Thomas Richter <tmricht@linux.ibm.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20220831174926.579643-5-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
09b73fe9e3
perf smt: Compute SMT from topology
...
The topology records sibling threads. Rather than computing SMT using
siblings in sysfs, reuse the values in topology. This only applies
when the file smt/active isn't available.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Ahmad Yasin <ahmad.yasin@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Florian Fischer <florian.fischer@muhq.space >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.garry@huawei.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Kshipra Bopardikar <kshipra.bopardikar@intel.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Miaoqian Lin <linmq006@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Cc: Thomas Richter <tmricht@linux.ibm.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20220831174926.579643-4-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
1a6abdde13
perf expr: Move the scanner_ctx into the parse_ctx
...
We currently maintain the two independently and copy from one to the
other. This is a burden when additional scanner context values are
necessary, so combine them.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Ahmad Yasin <ahmad.yasin@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Caleb Biggers <caleb.biggers@intel.com >
Cc: Florian Fischer <florian.fischer@muhq.space >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.garry@huawei.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Kshipra Bopardikar <kshipra.bopardikar@intel.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Miaoqian Lin <linmq006@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Perry Taylor <perry.taylor@intel.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Cc: Thomas Richter <tmricht@linux.ibm.com >
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com >
Link: https://lore.kernel.org/r/20220831174926.579643-3-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
76ed5927ca
perf pmu: Remove perf_pmu_lex() needless declaration
...
It builds without it, perhaps with some older combination of flex/bison
we needed this, clean it up a bit removing this.
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@arm.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 >
Cc: Stephane Eranian <eranian@google.com >
Link: https://lore.kernel.org/r/20220909044542.1087870-3-cuigaosheng1@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
4671855ae7
perf sort: Remove hist_entry__sort_list() and sort__first_dimension() leftover declarations
...
The hist_entry__sort_list and sort__first_dimension functions have been
removed in commit cfaa154b23
("perf tools: Get rid of obsolete
hist_entry__sort_list"), remove them.
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.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 >
Cc: Stephane Eranian <eranian@google.com >
Link: https://lore.kernel.org/r/20220909044542.1087870-2-cuigaosheng1@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
187c7723e4
perf test: Skip sigtrap test on old kernels
...
If it runs on an old kernel, perf_event_open would fail because of the
new fields sigtrap and sig_data. Just skipping the test could miss an
actual bug in the kernel.
Let's check BTF (when we have libbpf) if it has the sigtrap field in the
perf_event_attr. Otherwise, we can check it with a minimal event config.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Song Liu <song@kernel.org >
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com > # Using BTF to check for the struct members
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Marco Elver <elver@google.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: https://lore.kernel.org/r/20220908230150.4105955-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:22 -03:00
165da80296
perf sched: Factor out destroy_tasks()
...
Add destroy_tasks() as a counterpart of create_tasks() and put the
thread safety notations there. After join, it destroys semaphores too.
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: https://lore.kernel.org/r/20220908225448.4105056-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:21 -03:00
c7202d20fb
perf cpumap: Add range data encoding
...
Often cpumaps encode a range of all CPUs, add a compact encoding that
doesn't require a bit mask or list of all CPUs.
Signed-off-by: Ian Rogers <irogers@google.com >
Acked-by: Jiri Olsa <jolsa@kernel.org >
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: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Colin Ian King <colin.king@intel.com >
Cc: Dave Marchevsky <davemarchevsky@fb.com >
Cc: German Gomez <german.gomez@arm.com >
Cc: Gustavo A. R. Silva <gustavoars@kernel.org >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@arm.com >
Cc: Kees Kook <keescook@chromium.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: Riccardo Mancini <rickyman7@gmail.com >
Cc: Song Liu <songliubraving@fb.com >
Cc: Stephane Eranian <eranian@google.com >
Link: https://lore.kernel.org/r/20220614143353.1559597-7-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:21 -03:00
d773c999b8
perf events: Prefer union over variable length array
...
It is possible for casts to introduce alignment issues, prefer a union
for perf_record_event_update.
Signed-off-by: Ian Rogers <irogers@google.com >
Acked-by: Jiri Olsa <jolsa@kernel.org >
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: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Colin Ian King <colin.king@intel.com >
Cc: Dave Marchevsky <davemarchevsky@fb.com >
Cc: German Gomez <german.gomez@arm.com >
Cc: Gustavo A. R. Silva <gustavoars@kernel.org >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@arm.com >
Cc: Kees Kook <keescook@chromium.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: Riccardo Mancini <rickyman7@gmail.com >
Cc: Song Liu <songliubraving@fb.com >
Cc: Stephane Eranian <eranian@google.com >
Link: https://lore.kernel.org/r/20220614143353.1559597-6-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:21 -03:00
3657ad4b0f
perf vendor events: Update events for Neoverse E1
...
These CPUs contain the same PMU events (as per the Arm Technical
Reference manuals for Cortex A65 and Neoverse E1)
This de-duplicates event data, and avoids issues in previous E1 event
data (not present in A65 data)
* Missing implementation defined events
* Inclusion of events that are not implemented:
- L1D_CACHE_ALLOCATE
- SAMPLE_POP
- SAMPLE_FEED
- SAMPLE_FILTRATE
- SAMPLE_COLLISION
Reviewed-by: John Garry <john.garry@huawei.com >
Signed-off-by: Nick Forrington <nick.forrington@arm.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Mike Leach <mike.leach@linaro.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Will Deacon <will@kernel.org >
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20220907154932.60808-1-nick.forrington@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:21 -03:00
3e8d21b922
perf timechart: Add p_state_end helper
...
Wrap repeated code in helper functions p_state_end, which alloc a new
power_event recording last pstate, and insert to the head of
tchart->power_events.
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: https://lore.kernel.org/r/20220908021141.27134-5-shangxiaojing@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-10-04 08:55:21 -03:00