aboutsummaryrefslogtreecommitdiff
path: root/tools/perf
AgeCommit message (Collapse)AuthorFilesLines
2021-10-25perf session: Move reader map code to a separate functionAlexey Bayduraev1-15/+28
Move the mapping code into a separate reader__mmap() function. Suggested-by: Jiri Olsa <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Reviewed-by: Riccardo Mancini <[email protected]> Signed-off-by: Alexey Bayduraev <[email protected]> Tested-by: Riccardo Mancini <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Alexei Budankov <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/e445de5bb85bbd91287986802d6ed0ce1b419b5a.1634113027.git.alexey.v.bayduraev@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-25perf session: Move init/release code to separate functionsAlexey Bayduraev1-13/+32
Separate init/release code into reader__init() and reader__release_decomp() functions. Remove a duplicate call to ui_progress__init_size(), the same call can be found in __perf_session__process_events(). For multiple traces ui_progress should be initialized by total size before reader__init() calls. Suggested-by: Jiri Olsa <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Reviewed-by: Riccardo Mancini <[email protected]> Signed-off-by: Alexey Bayduraev <[email protected]> Tested-by: Riccardo Mancini <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Alexei Budankov <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/8bacf247de220be8e57af1d2b796322175f5e257.1634113027.git.alexey.v.bayduraev@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-25perf session: Introduce decompressor in reader objectAlexey Bayduraev2-16/+33
Introduce a decompressor data structure with pointers to decomp objects and to zstd object. We cannot just move session->zstd_data to decomp_data as session->zstd_data is not only used for decompression. Adding decompressor data object to reader object and introducing active_decomp into perf_session object to select current decompressor. Thus decompression could be executed separately for each data file. Reviewed-by: Jiri Olsa <[email protected]> Reviewed-by: Riccardo Mancini <[email protected]> Signed-off-by: Alexey Bayduraev <[email protected]> Tested-by: Riccardo Mancini <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Alexei Budankov <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/0eee270cb52aebcbd029c8445d9009fd17709d53.1634113027.git.alexey.v.bayduraev@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-25perf session: Move all state items to reader objectAlexey Bayduraev1-28/+35
We need all the state info about reader in separate object to load data from multiple files, so we can keep multiple readers at the same time. Moving all items that need to be kept from reader__process_events to the reader object. Introducing mmap_cur to keep current mapping. Suggested-by: Jiri Olsa <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Reviewed-by: Riccardo Mancini <[email protected]> Signed-off-by: Alexey Bayduraev <[email protected]> Tested-by: Riccardo Mancini <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Alexei Budankov <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/5c7bdebfaadd7fcb729bd999b181feccaa292e8e.1634113027.git.alexey.v.bayduraev@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-25perf intel-pt: Add support for PERF_RECORD_AUX_OUTPUT_HW_IDAdrian Hunter2-5/+87
Originally, software only supported redirecting at most one PEBS event to Intel PT (PEBS-via-PT) because it was not able to differentiate one event from another. To overcome that, add support for the PERF_RECORD_AUX_OUTPUT_HW_ID side-band event. Committer notes: Cast the pointer arg to for_each_set_bit() to (unsigned long *), to fix the build on 32-bit systems. Reviewed-by: Alexander Shishkin <[email protected]> Reviewed-by: Andi Kleen <[email protected]> Signed-off-by: Adrian Hunter <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-22perf bpf: Switch to new btf__raw_data APIHengqi Chen1-1/+1
Replace the call to btf__get_raw_data with new API btf__raw_data. The old APIs will be deprecated in libbpf v0.7+. No functionality change. Signed-off-by: Hengqi Chen <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
2021-10-20perf tools: Add support for PERF_RECORD_AUX_OUTPUT_HW_IDAdrian Hunter8-2/+45
The PERF_RECORD_AUX_OUTPUT_HW_ID event provides a way to match AUX output data like Intel PT PEBS-via-PT back to the event that it came from, by providing a hardware ID that is present in the AUX output. Reviewed-by: Alexander Shishkin <[email protected]> Reviewed-by: Andi Kleen <[email protected]> Signed-off-by: Adrian Hunter <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf vendor events arm64: Categorise the Neoverse V1 countersAndrew Kilroy9-0/+368
This is so they are categorised in the perf list output. The pmus all exist in the armv8-common-and-microarch.json and arm-recommended.json files, so this commit places them into each category's own file under tools/perf/pmu-events/arch/arm64/arm/neoverse-v1 Also add the Neoverse V1 to the arm64 mapfile Reviewed-by: John Garry <[email protected]> Signed-off-by: Andrew Kilroy <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf vendor events arm64: Add new armv8 pmu eventsAndrew Kilroy1-0/+72
Add new armv8 common events for use by Arm Neoverse V1 cores in a later commit. These are defined in the ArmV8 architecture reference manual available from https://developer.arm.com/documentation/ddi0487/gb/?lang=en Reviewed-by: John Garry <[email protected]> Signed-off-by: Andrew Kilroy <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf vendor events: Syntax corrections in Neoverse N1 jsonAndrew Kilroy8-40/+40
There are some syntactical mistakes in the json files for the Cortex A76 N1 (Neoverse N1). This was obstructing parsing from an external tool. This patch fixes the erroneous placement of commas causing the problems. Reviewed-by: John Garry <[email protected]> Signed-off-by: Andrew Kilroy <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf metric: Allow modifiers on metricsIan Rogers1-27/+98
By allowing modifiers on metrics we can, for example, gather the same metric for kernel and user mode. On a SkylakeX with TopDownL1 this gives: $ perf stat -M TopDownL1:u,TopDownL1:k -a sleep 2 Performance counter stats for 'system wide': 849,855,577 uops_issued.any:k # 0.06 Bad_Speculation:k # 0.51 Backend_Bound:k (16.71%) 1,995,257,996 cycles:k # 7981031984.00 SLOTS:k # 0.35 Frontend_Bound:k # 0.08 Retiring:k (16.71%) 2,791,940,753 idq_uops_not_delivered.core:k (16.71%) 641,961,928 uops_retired.retire_slots:k (16.71%) 72,239,337 int_misc.recovery_cycles:k (16.71%) 2,294,413,647 uops_issued.any:u # 0.04 Bad_Speculation:u # 0.39 Backend_Bound:u (16.78%) 1,333,248,940 cycles:u # 5332995760.00 SLOTS:u # 0.16 Frontend_Bound:u # 0.40 Retiring:u (16.78%) 858,517,081 idq_uops_not_delivered.core:u (16.78%) 2,153,789,582 uops_retired.retire_slots:u (16.78%) 19,373,627 int_misc.recovery_cycles:u (16.78%) 31,503,661 cpu_clk_unhalted.one_thread_active:k # 0.18 CoreIPC_SMT:k (16.73%) 315,454,104 inst_retired.any:k # 315454104.00 Instructions:k (16.73%) 42,533,729 cpu_clk_unhalted.ref_xclk:k (16.73%) 2,043,119,037 cpu_clk_unhalted.thread:k (16.73%) 28,843,803 cpu_clk_unhalted.one_thread_active:u # 1.55 CoreIPC_SMT:u (16.60%) 2,153,353,869 inst_retired.any:u # 2153353869.00 Instructions:u (16.60%) 28,844,743 cpu_clk_unhalted.ref_xclk:u (16.60%) 1,387,544,378 cpu_clk_unhalted.thread:u (16.60%) 308,031,603 inst_retired.any:k # 0.15 CoreIPC:k (33.19%) 2,036,774,753 cycles:k (33.19%) 1,994,344,281 inst_retired.any:u # 1.59 CoreIPC:u (33.18%) 1,251,538,227 cycles:u (33.18%) 2.000342948 seconds time elapsed Modifiers are naively copy and pasted on to events, this can yield errors like: $ perf stat -M Kernel_Utilization:k -a sleep 2 event syntax error: '..d.thread:k/kk,cpu_clk_unhalted.thread/metric-id=cpu_clk_unhalted.thread/k..' \___ Bad modifier Usage: perf stat [<options>] [<command>] -M, --metrics <metric/metric group list> monitor specified metrics or metric groups (separated by ,) When modifiers are present with constraints, from --metric-no-group or the NMI watchdog, they are no longer placed in the same set - which may miss deduplicating events. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf parse-events: Identify broken modifiersIan Rogers1-0/+10
Previously the broken modifier causes a usage message to printed but nothing else. After: $ perf stat -e 'cycles:kk' -a sleep 2 event syntax error: 'cycles:kk' \___ Bad modifier Run 'perf list' for a list of valid events Usage: perf stat [<options>] [<command>] -e, --event <event> event selector. use 'perf list' to list available events $ perf stat -e '{instructions,cycles}:kk' -a sleep 2 event syntax error: '..ns,cycles}:kk' \___ Bad modifier Run 'perf list' for a list of valid events Usage: perf stat [<options>] [<command>] -e, --event <event> event selector. use 'perf list' to list available events Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf metric: Switch fprintf() to pr_err()Ian Rogers1-1/+1
There's no clear reason for the inconsistency that stems from the initial commit. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf metrics: Modify setup and deduplicationIan Rogers1-251/+262
Previously find_evsel_group was trying to share events while mark-sweeping to eliminate unused events, this was complicated and had issues around uncore events and grouped sharing. This was further complicated by the event string being created while metrics and metric groups were being added, with the string affecting the evlist order. This change moves deduplication before event parsing. Ungrouped events are placed in a single combined set. Groups are checked to see if an earlier (larger) group can support their events. As the deduplication and sharing detection is done on metric IDs before parsing, wildcard expansion problems with uncore events are avoided. Overall the code is simpler while working better. An example of failing to deduplicate can be seen with a list of metrics like the following, where in the after case multiplexing has been avoided: Before: $ perf stat -M Bad_Speculation,Backend_Bound,Frontend_Bound,Retiring -a sleep 2 Performance counter stats for 'system wide': 959,620,872 uops_issued.any # 0.06 Bad_Speculation (50.03%) 2,163,072,261 cycles # 0.09 Retiring (50.03%) 735,827,436 uops_retired.retire_slots (50.03%) 74,676,484 int_misc.recovery_cycles (50.03%) 987,062,794 uops_issued.any # 0.50 Backend_Bound (49.97%) 2,203,734,187 cycles # 0.35 Frontend_Bound (49.97%) 3,085,016,091 idq_uops_not_delivered.core (49.97%) 758,599,232 uops_retired.retire_slots (49.97%) 75,807,526 int_misc.recovery_cycles (49.97%) 2.002103760 seconds time elapsed After: $ sudo perf stat -M Bad_Speculation,Backend_Bound,Frontend_Bound,Retiring -a sleep 2 Performance counter stats for 'system wide': 769,694,676 uops_issued.any # 0.08 Bad_Speculation # 0.41 Backend_Bound 1,087,548,633 cycles # 0.38 Frontend_Bound # 0.14 Retiring 1,642,085,777 idq_uops_not_delivered.core 603,112,590 uops_retired.retire_slots 43,787,854 int_misc.recovery_cycles 2.003844383 seconds time elapsed Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf expr: Add subset_of_ids() utilityIan Rogers2-0/+17
Add a helper that returns true if all the IDs in needles are present in haystack. Later this will be used in sharing events between metrics. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf metric: Encode and use metric-id as qualifierIan Rogers6-81/+242
For a metric like IPC a group of events like {instructions,cycles}:W would be formed. If the events names were changed in parsing then the metric expression parser would fail to find them. This change makes the event encoding be something like: {instructions/metric-id=instructions/, cycles/metric-id=cycles/} and then uses the evsel's stable metric-id value to locate the events. This fixes the case that an event is restricted to user because of the paranoia setting: $ echo 2 > /proc/sys/kernel/perf_event_paranoid $ perf stat -M IPC /bin/true Performance counter stats for '/bin/true': 150,298 inst_retired.any:u # 0.77 IPC 187,095 cpu_clk_unhalted.thread:u 0.002042731 seconds time elapsed 0.000000000 seconds user 0.002377000 seconds sys Adding the metric-id as a qualifier has a complication in that qualifiers will become embedded in qualifiers. For example, msr/tsc/ could become msr/tsc,metric-id=msr/tsc// which will fail parse-events. To solve this problem the metric is encoded and decoded for the metric-id with !<num> standing in for an encoded value. Previously ! wasn't parsed. With this msr/tsc/ becomes msr/tsc,metric-id=msr!3tsc!3/ The metric expression parser is changed so that @ isn't changed to /, instead this is done when the ID is encoded for parse events. metricgroup__add_metric_non_group() and metricgroup__add_metric_weak_group() need to inject the metric-id qualifier, so to avoid repetition they are merged into a single metricgroup__build_event_string with error codes more rigorously checked. stat-shadow's prepare_metric() uses the metric-id to match the metricgroup code. As "metric-id=..." is added to all events, it is adding during testing with the fake PMU. This complicates pmu_str_check code as PE_PMU_EVENT_FAKE won't match as part of a configuration. The testing fake PMU case is fixed so that if a known qualifier with an ! is parsed then it isn't reported as a fake PMU. This is sufficient to pass all testing but it and the original mechanism are somewhat brittle. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf parse-events: Allow config on kernel PMU eventsIan Rogers3-32/+52
An event like inst_retired.any on an Intel skylake is found in the pmu-events code created from the pipeline event JSON. The event is an alias for cpu/event=0xc0,period=2000003/ and parse-events recognizes the event with the token PE_KERNEL_PMU_EVENT. The parser doesn't currently allow extra configuration on such events, except for modifiers, so: $ perf stat -e inst_retired.any// /bin/true event syntax error: 'inst_retired.any//' \___ parser error Run 'perf list' for a list of valid events Usage: perf stat [<options>] [<command>] -e, --event <event> event selector. use 'perf list' to list available events This patch adds configuration to these events which can be useful for a number of parameters like name and call-graph: $ sudo perf record -e inst_retired.any/call-graph=lbr/ -a sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 1.856 MB perf.data (44 samples) ] It is necessary for the metric code so that we may add metric-id values to these events before they are parsed. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf parse-events: Add new "metric-id" termIan Rogers8-45/+107
Add a new "metric-id" term to events so that metric parsing can set an ID that can be reliably looked up. Metric parsing currently will turn a metric like "instructions/cycles" into a parse events string of "{instructions,cycles}:W". However, parse-events may change "instructions" into "instructions:u" if perf_event_paranoid=2. When this happens expr__resolve_id currently fails as stat-shadow adds the ID "instructions:u" to match with the counter value and the metric tries to look up the ID just "instructions". A later patch will use the new term. An example of the current problem: $ echo -1 > /proc/sys/kernel/perf_event_paranoid $ perf stat -M IPC /bin/true Performance counter stats for '/bin/true': 1,217,161 inst_retired.any # 0.97 IPC 1,250,389 cpu_clk_unhalted.thread 0.002064773 seconds time elapsed 0.002378000 seconds user 0.000000000 seconds sys $ echo 2 > /proc/sys/kernel/perf_event_paranoid $ perf stat -M IPC /bin/true Performance counter stats for '/bin/true': 150,298 inst_retired.any:u # nan IPC 187,095 cpu_clk_unhalted.thread:u 0.002042731 seconds time elapsed 0.000000000 seconds user 0.002377000 seconds sys Note: nan IPC is printed as an effect of "perf metric: Use NAN for missing event IDs." but earlier versions of perf just fail with a parse error and display no value. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf parse-events: Add const to evsel nameIan Rogers6-20/+27
The evsel name is strdup-ed before assignment and so can be const. A later change will add another similar string. Using const makes it clearer that these are not out arguments. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf metric: Simplify metric_refs calculationIan Rogers1-54/+23
Don't build a list and then turn to an array, just directly build the array. The size of the array is known due to the search for a duplicate. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf metric: Document the internal 'struct metric'Ian Rogers1-0/+20
Add documentation as part of code tidying. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf metric: Comment data structuresIan Rogers1-0/+27
Document the data structures maintained by metricgroup.c and used by stat-shadow.c for metric output. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf metric: Modify resolution and recursion checkIan Rogers5-270/+179
Modify resolution. Rather than resolving a list of metrics, resolve a metric immediately after it is added. This simplifies knowing the root of the metric's tree so that IDs may be associated with it. A bug in the current implementation is that all the IDs were placed on the first metric in a metric group. Rather than maintain data on IDs' parents to detect cycles, maintain a list of visited metrics and detect cycles if the same metric is visited twice. Only place the root metric onto the list of metrics. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf metric: Only add a referenced metric onceIan Rogers1-3/+9
If a metric references other metrics then the same other metrics may be referenced more than once, but the events and metric ref are only needed once. An example of this is in tests/parse-metric.c where DCache_L2_Hits references the metric DCache_L2_All_Hits twice, once directly and once through DCache_L2_All. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf metric: Add metric new() and free() methodsIan Rogers1-62/+75
Metrics are complex enough that a new/free reduces the risk of memory leaks. Move static functions used in new. Reviewed-by: John Garry <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf metric: Add documentation and rename a variable.Ian Rogers1-5/+54
Documentation to make current functionality clearer. Rename a variable called 'metric' to 'metric_name' as it can be ambiguous as to whether a string is the name of a metric or the expression. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf metric: Move runtime value to the expr contextIan Rogers6-28/+31
The runtime value is needed when recursively parsing metrics, currently a value of 1 is passed which is incorrect. Rather than add more arguments to the bison parser, add runtime to the context. Fix call sites not to pass a value. The runtime value is defaulted to 0, which is arbitrary. In some places this replaces a value of 1, which was also arbitrary. This shouldn't affect anything other than PPC. The use of 0 or 1 shouldn't matter as a proper runtime value would be needed in a case that it did matter. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf pmu: Make pmu_event tables const.Ian Rogers9-39/+39
Make lookup nature of data structures clearer through their type. Reduce scope of architecture specific pmu_event tables by making them static. Suggested-by: John Garry <[email protected]> Reviewed-by: John Garry <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf pmu: Make pmu_sys_event_tables const.Ian Rogers4-4/+4
Make lookup nature of data structures clearer through their type. Reviewed-by: John Garry <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20perf pmu: Add const to pmu_events_map.Ian Rogers11-36/+36
The pmu_events_map is generated at compile time and used for lookup. For testing purposes we need to swap the map being used. Having the pmu_events_map be non-const is misleading as it may be an out argument. Make it const and update uses so they work on const too. Reviewed-by: John Garry <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-20tools lib: Adopt list_sort() from the kernel sourcesIan Rogers4-0/+9
Add list_sort.[ch] from the main kernel tree. The linux/bug.h #include is removed due to conflicting definitions. Add check-headers and modify perf build accordingly. MANIFEST and python-ext-sources fixes suggested by Arnaldo. Suggested-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Acked-by: Andi Kleen <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrew Kilroy <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Changbin Du <[email protected]> Cc: Denys Zagorui <[email protected]> Cc: Fabian Hemmer <[email protected]> Cc: Felix Fietkau <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Keller <[email protected]> Cc: Jiapeng Chong <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joakim Zhang <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kees Kook <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nicholas Fraser <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: ShihCheng Tu <[email protected]> Cc: Song Liu <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Sumanth Korikkar <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wan Jiabing <[email protected]> Cc: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-19tools/perf: Add mem_hops field in perf_mem_data_src structureKajol Jain1-1/+18
Going forward, future generation systems can have more hierarchy within the node/package level but currently we don't have any data source encoding field in perf, which can be used to represent this level of data. Add a new field called 'mem_hops' in the perf_mem_data_src structure which can be used to represent intra-node/package or inter-node/off-package details. This field is of size 3 bits where PERF_MEM_HOPS_{NA, 0..6} value can be used to present different hop levels data. Also add corresponding macros to define mem_hop field values and shift value. Currently we define macro for HOPS_0 which corresponds to data coming from another core but same node. Add functionality to represent mem_hop field data in perf_mem__lvl_scnprintf function with the help of added string array called mem_hops. For ex: Encodings for mem_hops fields with L2 cache: L2 - local L2 L2 | REMOTE | HOPS_0 - remote core, same node L2 Since with the addition of HOPS field, now remote can be used to denote cache access from the same node but different core, a check is added in the c2c_decode_stats function to set mrem only when HOPS is zero along with set remote field. Signed-off-by: Kajol Jain <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2021-10-19perf: Add comment about current state of PERF_MEM_LVL_* namespace and remove ↵Kajol Jain1-1/+0
an extra line Add a comment about PERF_MEM_LVL_* namespace being depricated to some extent in favour of added PERF_MEM_{LVLNUM_,REMOTE_,SNOOPX_} fields. Remove an extra line present in perf_mem__lvl_scnprintf function. Signed-off-by: Kajol Jain <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2021-10-14perf report: Output non-zero offset for decompressed recordsAlexey Bayduraev1-2/+2
Print offset of PERF_RECORD_COMPRESSED record instead of zero for decompressed records in raw trace dump (-D option of perf-report): 0x17cf08 [0x28]: event: 9 instead of: 0 [0x28]: event: 9 The fix is not critical, because currently file_pos for compressed events is used in perf_session__process_event only to show offsets in the raw dump. This patch was separated from patchset: https://lore.kernel.org/lkml/[email protected]/ and was already rewieved. Reviewed-by: Riccardo Mancini <[email protected]> Signed-off-by: Alexey Bayduraev <[email protected]> Tested-by: Riccardo Mancini <[email protected]> Acked-by: Andi Kleen <[email protected]> Acked-by: Jiri Olsa <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Antonov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Alexei Budankov <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-08perf kmem: Improve man page for record optionsIan Rogers1-5/+8
Since: https://lore.kernel.org/lkml/[email protected]/ The output option works for 'perf kmem', however, it must appear after 'record'. This is different to 'stat' where '-i' for the input must appear before. Try to capture this complication in the man page. Signed-off-by: Ian Rogers <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-08perf tools: Enable strict JSON parsingJames Clark1-0/+1
This is to ensure that the PMU event files can always be parsed by other tools. Testing ======= * There are no errors when parsing files for all architectures: # pmu-events/jevents nds32 pmu-events/arch/ test # pmu-events/jevents s390 pmu-events/arch/ test # pmu-events/jevents powerpc pmu-events/arch/ test # pmu-events/jevents arm64 pmu-events/arch/ test # pmu-events/jevents test pmu-events/arch/ test # pmu-events/jevents x86 pmu-events/arch/ test * Trailing and leading commas now cause a parse error * Double commas now cause a parse error * Compilation and parsing works with strict mode disabled and enabled * A diff of the output files shows no changes Reviewed-by: Andi Kleen <[email protected]> Reviewed-by: Kajol Jain<[email protected]> Signed-off-by: James Clark <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: [email protected] Cc: John Garry <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: [email protected] Cc: Will Deacon <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-08perf tools: Make the JSON parser more conformant when in strict modeJames Clark1-2/+40
Return an error when a trailing comma is found or a new item is encountered before a comma or an opening brace. This ensures that the perf JSON files conform more closely to the spec at https://www.json.org Reviewed-by: Andi Kleen <[email protected]> Reviewed-by: Kajol Jain<[email protected]> Signed-off-by: James Clark <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: [email protected] Cc: John Garry <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: [email protected] Cc: Will Deacon <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-08perf vendor-events: Fix all remaining invalid JSON filesJames Clark29-44/+44
Remove trailing commas. A later commit will make the parser more strict and these will not be valid anymore. Reviewed-by: Andi Kleen <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Kajol Jain<[email protected]> Signed-off-by: James Clark <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: [email protected] Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: [email protected] Cc: Will Deacon <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-08perf daemon: Remove duplicate sys/file.h includeGuo Zhengkui1-2/+0
There is a "#include <sys/file.h>" in line 10, so remove a duplicate one in line 1124. Signed-off-by: Guo Zhengkui <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-08perf test evlist-open-close: Use inline func to convert timeval to usecRiccardo Mancini1-1/+6
This patch introduces a new inline function to convert a timeval to usec. This function will be used also in the next patch. Signed-off-by: Riccardo Mancini <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/b95035ec4a125355be8ea843f7275c4580da6398.1629490974.git.rickyman7@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-08perf mmap: Introduce mmap_cpu_mask__duplicate()Riccardo Mancini2-0/+14
This patch adds a new function in util/mmap.c to duplicate a mmap_cpu_mask. This new function will be used in patches in the workqueue patchkit. Signed-off-by: Riccardo Mancini <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/8943a548ef7a3dd3e015095afad7e9a8b2154c05.1629490974.git.rickyman7@gmail.com [ bitmap_alloc() was renamed to bitmap_zalloc() ] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-08Merge remote-tracking branch 'torvalds/master' into perf/coreArnaldo Carvalho de Melo27-97/+514
To pick up the fixes in perf/urgent that were just merged into upstream. Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-06x86/insn: Use get_unaligned() instead of memcpy()Borislav Petkov1-0/+2
Use get_unaligned() instead of memcpy() to access potentially unaligned memory, which, when accessed through a pointer, leads to undefined behavior. get_unaligned() describes much better what is happening there anyway even if memcpy() does the job. In addition, since perf tool builds with -Werror, it would fire with: util/intel-pt-decoder/../../../arch/x86/lib/insn.c: In function '__insn_get_emulate_prefix': tools/include/../include/asm-generic/unaligned.h:10:15: error: packed attribute is unnecessary [-Werror=packed] 10 | const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ because -Werror=packed would complain if the packed attribute would have no effect on the layout of the structure. In this case, that is intentional so disable the warning only for that compilation unit. That part is Reported-by: Stephen Rothwell <[email protected]> No functional changes. Fixes: 5ba1071f7554 ("x86/insn, tools/x86: Fix undefined behavior due to potential unaligned accesses") Suggested-by: Linus Torvalds <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Acked-by: Masami Hiramatsu <[email protected]> Tested-by: Stephen Rothwell <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
2021-10-05perf tests attr: Add missing topdown metrics eventsKan Liang4-52/+440
The Topdown metrics events were added as 'perf stat' default events since commit 42641d6f4d15e6db ("perf stat: Add Topdown metrics events as default events"). However, the perf attr tests were not updated accordingly. The perf attr test fails on the platform which supports Topdown metrics. # perf test 17 17: Setup struct perf_event_attr :FAILED! Add Topdown metrics events into perf attr test cases. Make them optional since they are only available on newer platforms. Fixes: 42641d6f4d15e6db ("perf stat: Add Topdown metrics events as default events") Reported-by: kernel test robot <[email protected]> Signed-off-by: Kan Liang <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Jiri Olsa <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-05perf build: Fix plugin static linking with libopencsd on ARM and ARM64Branislav Rankov1-1/+1
Filter out -static flag when building plugins as they are always built as dynamic libraries and -static and -dynamic don't work well together on arm and arm64. Signed-off-by: Branislav Rankov <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Mark Brown <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Tamas Zsoldos <[email protected]> [ Split from a larger patch ] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-05perf build: Add missing -lstdc++ when linking with libopencsdBranislav Rankov1-1/+1
Add -lstdc++ to perf when linking libopencsd as it is a dependency. It does not hurt to add it when dynamic linking. Signed-off-by: Branislav Rankov <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Mark Brown <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Tamas Zsoldos <[email protected]> [ Split from a larger patch ] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-05perf jevents: Free the sys_event_tables list after processing entriesLike Xu1-0/+2
The compiler reports that free_sys_event_tables() is dead code. But according to the semantics, the "LIST_HEAD(sys_event_tables)" should also be released, just like we do with 'arch_std_events' in main(). Fixes: e9d32c1bf0cd7a98 ("perf vendor events: Add support for arch standard events") Signed-off-by: Like Xu <[email protected]> Reviewed-by: John Garry <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-10-04perf srcline: Use long-running addr2line per DSOTony Garnock-Jones1-88/+250
Invoking addr2line in a separate subprocess, one for each required lookup, takes a terribly long time. This patch introduces a long-running addr2line process for each DSO, *DRAMATICALLY* speeding up runs of perf. What used to take tens of minutes now takes tens of seconds. Debian bug report about this issue: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911815 Signed-off-by: Tony Garnock-Jones <[email protected]> Tested-by: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-09-29perf tests vmlinux-kallsyms: Ignore hidden symbolsMichael Petlan1-0/+102
Certain kernel symbols are purposely hidden from kallsyms. The function is_ignored_symbol() from scripts/kallsyms.c decides if a symbol should be hidden or not. The perf test "vmlinux symtab matches kallsyms" fails in case perf finds some of the hidden symbols in its machine image and can't match them to kallsyms. Let's add a filter to check if a symbol not found isn't one of these before failing the test. The function is_ignored_symbol() has been copied from scripts/kallsyms.c and needs to be updated along with the original. Signed-off-by: Michael Petlan <[email protected]> Acked-by: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> LPU-Reference: [email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2021-09-29perf metric: Avoid events for an 'if' constant resultIan Rogers2-0/+17
For a metric like: CONST if expr else CONST if the values of CONST are identical then expr doesn't need evaluating, and events, in order to compute a result. Signed-off-by: Ian Rogers <[email protected]> Tested-by: John Garry <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jin Yao <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Sandeep Dasgupta <[email protected]> Cc: Stephane Eranian <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>