Skip to content

Commit 0513e46

Browse files
committed
Merge tag 'perf-tools-fixes-for-v5.15-2021-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
Pull more perf tools fixes from Arnaldo Carvalho de Melo: - Fix 'perf test' DWARF unwind for optimized builds. - Fix 'perf test' 'Object code reading' when dealing with samples in @plt symbols. - Fix off-by-one directory paths in the ARM support code. - Fix error message to eliminate confusion in 'perf config' when first creating a config file. - 'perf iostat' fix for system wide operation. - Fix printing of metrics when 'perf iostat' is used with one or more iio_root_ports and unconnected cpus (using -C). - Fix several typos in the documentation files. - Fix spelling mistake "icach" -> "icache" in the power8 JSON vendor files. * tag 'perf-tools-fixes-for-v5.15-2021-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: perf iostat: Fix Segmentation fault from NULL 'struct perf_counts_values *' perf iostat: Use system-wide mode if the target cpu_list is unspecified perf config: Refine error message to eliminate confusion perf doc: Fix typos all over the place perf arm: Fix off-by-one directory paths. perf vendor events powerpc: Fix spelling mistake "icach" -> "icache" perf tests: Fix flaky test 'Object code reading' perf test: Fix DWARF unwind for optimized builds.
2 parents 9cccec2 + 4da8b12 commit 0513e46

20 files changed

+70
-43
lines changed

tools/perf/Documentation/jitdump-specification.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ const char unwinding_data[n]: an array of unwinding data, consisting of the EH F
164164
The EH Frame header follows the Linux Standard Base (LSB) specification as described in the document at https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/ehframehdr.html
165165

166166

167-
The EH Frame follows the LSB specicfication as described in the document at https://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/ehframechpt.html
167+
The EH Frame follows the LSB specification as described in the document at https://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/ehframechpt.html
168168

169169

170170
NOTE: The mapped_size is generally either the same as unwind_data_size (if the unwinding data was mapped in memory by the running process) or zero (if the unwinding data is not mapped by the process). If the unwinding data was not mapped, then only the EH Frame Header will be read, which can be used to specify FP based unwinding for a function which does not have unwinding information.

tools/perf/Documentation/perf-c2c.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ COALESCE
261261
User can specify how to sort offsets for cacheline.
262262

263263
Following fields are available and governs the final
264-
output fields set for caheline offsets output:
264+
output fields set for cacheline offsets output:
265265

266266
tid - coalesced by process TIDs
267267
pid - coalesced by process PIDs

tools/perf/Documentation/perf-intel-pt.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ and "r" can be combined to get calls and returns.
883883

884884
"Transactions" events correspond to the start or end of transactions. The
885885
'flags' field can be used in perf script to determine whether the event is a
886-
tranasaction start, commit or abort.
886+
transaction start, commit or abort.
887887

888888
Note that "instructions", "branches" and "transactions" events depend on code
889889
flow packets which can be disabled by using the config term "branch=0". Refer

tools/perf/Documentation/perf-lock.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ COMMON OPTIONS
4444

4545
-f::
4646
--force::
47-
Don't complan, do it.
47+
Don't complain, do it.
4848

4949
REPORT OPTIONS
5050
--------------

tools/perf/Documentation/perf-script-perl.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ all sched_wakeup events in the system:
5454
Traces meant to be processed using a script should be recorded with
5555
the above option: -a to enable system-wide collection.
5656

57-
The format file for the sched_wakep event defines the following fields
57+
The format file for the sched_wakeup event defines the following fields
5858
(see /sys/kernel/debug/tracing/events/sched/sched_wakeup/format):
5959

6060
----

tools/perf/Documentation/perf-script-python.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ all sched_wakeup events in the system:
448448
Traces meant to be processed using a script should be recorded with
449449
the above option: -a to enable system-wide collection.
450450

451-
The format file for the sched_wakep event defines the following fields
451+
The format file for the sched_wakeup event defines the following fields
452452
(see /sys/kernel/debug/tracing/events/sched/sched_wakeup/format):
453453

454454
----

tools/perf/Documentation/perf-stat.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ Aggregate counts per physical processor for system-wide mode measurements.
385385
Print metrics or metricgroups specified in a comma separated list.
386386
For a group all metrics from the group are added.
387387
The events from the metrics are automatically measured.
388-
See perf list output for the possble metrics and metricgroups.
388+
See perf list output for the possible metrics and metricgroups.
389389

390390
-A::
391391
--no-aggr::

tools/perf/Documentation/topdown.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Using TopDown metrics in user space
22
-----------------------------------
33

44
Intel CPUs (since Sandy Bridge and Silvermont) support a TopDown
5-
methology to break down CPU pipeline execution into 4 bottlenecks:
5+
methodology to break down CPU pipeline execution into 4 bottlenecks:
66
frontend bound, backend bound, bad speculation, retiring.
77

88
For more details on Topdown see [1][5]

tools/perf/arch/arm/util/auxtrace.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
#include <linux/coresight-pmu.h>
99
#include <linux/zalloc.h>
1010

11-
#include "../../util/auxtrace.h"
12-
#include "../../util/debug.h"
13-
#include "../../util/evlist.h"
14-
#include "../../util/pmu.h"
11+
#include "../../../util/auxtrace.h"
12+
#include "../../../util/debug.h"
13+
#include "../../../util/evlist.h"
14+
#include "../../../util/pmu.h"
1515
#include "cs-etm.h"
1616
#include "arm-spe.h"
1717

tools/perf/arch/arm/util/cs-etm.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
#include <linux/zalloc.h>
1717

1818
#include "cs-etm.h"
19-
#include "../../util/debug.h"
20-
#include "../../util/record.h"
21-
#include "../../util/auxtrace.h"
22-
#include "../../util/cpumap.h"
23-
#include "../../util/event.h"
24-
#include "../../util/evlist.h"
25-
#include "../../util/evsel.h"
26-
#include "../../util/perf_api_probe.h"
27-
#include "../../util/evsel_config.h"
28-
#include "../../util/pmu.h"
29-
#include "../../util/cs-etm.h"
19+
#include "../../../util/debug.h"
20+
#include "../../../util/record.h"
21+
#include "../../../util/auxtrace.h"
22+
#include "../../../util/cpumap.h"
23+
#include "../../../util/event.h"
24+
#include "../../../util/evlist.h"
25+
#include "../../../util/evsel.h"
26+
#include "../../../util/perf_api_probe.h"
27+
#include "../../../util/evsel_config.h"
28+
#include "../../../util/pmu.h"
29+
#include "../../../util/cs-etm.h"
3030
#include <internal/lib.h> // page_size
31-
#include "../../util/session.h"
31+
#include "../../../util/session.h"
3232

3333
#include <errno.h>
3434
#include <stdlib.h>

tools/perf/arch/arm/util/perf_regs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2-
#include "../../util/perf_regs.h"
2+
#include "../../../util/perf_regs.h"
33

44
const struct sample_reg sample_reg_masks[] = {
55
SMPL_REG_END

tools/perf/arch/arm/util/pmu.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <linux/string.h>
1111

1212
#include "arm-spe.h"
13-
#include "../../util/pmu.h"
13+
#include "../../../util/pmu.h"
1414

1515
struct perf_event_attr
1616
*perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)

tools/perf/arch/arm/util/unwind-libdw.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <elfutils/libdwfl.h>
3-
#include "../../util/unwind-libdw.h"
4-
#include "../../util/perf_regs.h"
5-
#include "../../util/event.h"
3+
#include "../../../util/unwind-libdw.h"
4+
#include "../../../util/perf_regs.h"
5+
#include "../../../util/event.h"
66

77
bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg)
88
{

tools/perf/arch/arm/util/unwind-libunwind.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include <errno.h>
44
#include <libunwind.h>
55
#include "perf_regs.h"
6-
#include "../../util/unwind.h"
7-
#include "../../util/debug.h"
6+
#include "../../../util/unwind.h"
7+
#include "../../../util/debug.h"
88

99
int libunwind__arch_reg_id(int regnum)
1010
{

tools/perf/arch/x86/util/iostat.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ void iostat_print_metric(struct perf_stat_config *config, struct evsel *evsel,
432432
u8 die = ((struct iio_root_port *)evsel->priv)->die;
433433
struct perf_counts_values *count = perf_counts(evsel->counts, die, 0);
434434

435-
if (count->run && count->ena) {
435+
if (count && count->run && count->ena) {
436436
if (evsel->prev_raw_counts && !out->force_header) {
437437
struct perf_counts_values *prev_count =
438438
perf_counts(evsel->prev_raw_counts, die, 0);

tools/perf/builtin-stat.c

+2
Original file line numberDiff line numberDiff line change
@@ -2408,6 +2408,8 @@ int cmd_stat(int argc, const char **argv)
24082408
goto out;
24092409
} else if (verbose)
24102410
iostat_list(evsel_list, &stat_config);
2411+
if (iostat_mode == IOSTAT_RUN && !target__has_cpu(&target))
2412+
target.system_wide = true;
24112413
}
24122414

24132415
if (add_default_attributes())

tools/perf/pmu-events/arch/powerpc/power8/other.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@
10461046
{
10471047
"EventCode": "0x4e010",
10481048
"EventName": "PM_GCT_NOSLOT_IC_L3MISS",
1049-
"BriefDescription": "Gct empty for this thread due to icach l3 miss",
1049+
"BriefDescription": "Gct empty for this thread due to icache l3 miss",
10501050
"PublicDescription": ""
10511051
},
10521052
{

tools/perf/tests/code-reading.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
229229
struct thread *thread, struct state *state)
230230
{
231231
struct addr_location al;
232-
unsigned char buf1[BUFSZ];
233-
unsigned char buf2[BUFSZ];
232+
unsigned char buf1[BUFSZ] = {0};
233+
unsigned char buf2[BUFSZ] = {0};
234234
size_t ret_len;
235235
u64 objdump_addr;
236236
const char *objdump_name;

tools/perf/tests/dwarf-unwind.c

+32-7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,23 @@
2020
/* For bsearch. We try to unwind functions in shared object. */
2121
#include <stdlib.h>
2222

23+
/*
24+
* The test will assert frames are on the stack but tail call optimizations lose
25+
* the frame of the caller. Clang can disable this optimization on a called
26+
* function but GCC currently (11/2020) lacks this attribute. The barrier is
27+
* used to inhibit tail calls in these cases.
28+
*/
29+
#ifdef __has_attribute
30+
#if __has_attribute(disable_tail_calls)
31+
#define NO_TAIL_CALL_ATTRIBUTE __attribute__((disable_tail_calls))
32+
#define NO_TAIL_CALL_BARRIER
33+
#endif
34+
#endif
35+
#ifndef NO_TAIL_CALL_ATTRIBUTE
36+
#define NO_TAIL_CALL_ATTRIBUTE
37+
#define NO_TAIL_CALL_BARRIER __asm__ __volatile__("" : : : "memory");
38+
#endif
39+
2340
static int mmap_handler(struct perf_tool *tool __maybe_unused,
2441
union perf_event *event,
2542
struct perf_sample *sample,
@@ -91,7 +108,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
91108
return strcmp((const char *) symbol, funcs[idx]);
92109
}
93110

94-
noinline int test_dwarf_unwind__thread(struct thread *thread)
111+
NO_TAIL_CALL_ATTRIBUTE noinline int test_dwarf_unwind__thread(struct thread *thread)
95112
{
96113
struct perf_sample sample;
97114
unsigned long cnt = 0;
@@ -122,7 +139,7 @@ noinline int test_dwarf_unwind__thread(struct thread *thread)
122139

123140
static int global_unwind_retval = -INT_MAX;
124141

125-
noinline int test_dwarf_unwind__compare(void *p1, void *p2)
142+
NO_TAIL_CALL_ATTRIBUTE noinline int test_dwarf_unwind__compare(void *p1, void *p2)
126143
{
127144
/* Any possible value should be 'thread' */
128145
struct thread *thread = *(struct thread **)p1;
@@ -141,7 +158,7 @@ noinline int test_dwarf_unwind__compare(void *p1, void *p2)
141158
return p1 - p2;
142159
}
143160

144-
noinline int test_dwarf_unwind__krava_3(struct thread *thread)
161+
NO_TAIL_CALL_ATTRIBUTE noinline int test_dwarf_unwind__krava_3(struct thread *thread)
145162
{
146163
struct thread *array[2] = {thread, thread};
147164
void *fp = &bsearch;
@@ -160,14 +177,22 @@ noinline int test_dwarf_unwind__krava_3(struct thread *thread)
160177
return global_unwind_retval;
161178
}
162179

163-
noinline int test_dwarf_unwind__krava_2(struct thread *thread)
180+
NO_TAIL_CALL_ATTRIBUTE noinline int test_dwarf_unwind__krava_2(struct thread *thread)
164181
{
165-
return test_dwarf_unwind__krava_3(thread);
182+
int ret;
183+
184+
ret = test_dwarf_unwind__krava_3(thread);
185+
NO_TAIL_CALL_BARRIER;
186+
return ret;
166187
}
167188

168-
noinline int test_dwarf_unwind__krava_1(struct thread *thread)
189+
NO_TAIL_CALL_ATTRIBUTE noinline int test_dwarf_unwind__krava_1(struct thread *thread)
169190
{
170-
return test_dwarf_unwind__krava_2(thread);
191+
int ret;
192+
193+
ret = test_dwarf_unwind__krava_2(thread);
194+
NO_TAIL_CALL_BARRIER;
195+
return ret;
171196
}
172197

173198
int test__dwarf_unwind(struct test *test __maybe_unused, int subtest __maybe_unused)

tools/perf/util/config.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ int perf_config_set(struct perf_config_set *set,
801801
section->name, item->name);
802802
ret = fn(key, value, data);
803803
if (ret < 0) {
804-
pr_err("Error: wrong config key-value pair %s=%s\n",
804+
pr_err("Error in the given config file: wrong config key-value pair %s=%s\n",
805805
key, value);
806806
/*
807807
* Can't be just a 'break', as perf_config_set__for_each_entry()

0 commit comments

Comments
 (0)