Skip to content

Commit 3e71713

Browse files
committed
Merge tag 'perf-tools-fixes-for-v5.18-2022-04-29' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
Pull perf tools fixes from Arnaldo Carvalho de Melo: - Fix Intel PT (Processor Trace) timeless decoding with perf.data directory. - ARM SPE (Statistical Profiling Extensions) address fixes, for synthesized events and for SPE events with physical addresses. Add a simple 'perf test' entry to make sure this doesn't regress. - Remove arch specific processing of kallsyms data to fixup symbol end address, fixing excessive memory consumption in the annotation code. * tag 'perf-tools-fixes-for-v5.18-2022-04-29' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: perf symbol: Remove arch__symbols__fixup_end() perf symbol: Update symbols__fixup_end() perf symbol: Pass is_kallsyms to symbols__fixup_end() perf test: Add perf_event_attr test for Arm SPE perf arm-spe: Fix SPE events with phys addresses perf arm-spe: Fix addresses of synthesized SPE events perf intel-pt: Fix timeless decoding with perf.data directory
2 parents 2d0de93 + a5d20d4 commit 3e71713

File tree

12 files changed

+56
-79
lines changed

12 files changed

+56
-79
lines changed

tools/perf/arch/arm64/util/arm-spe.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
148148
bool privileged = perf_event_paranoid_check(-1);
149149
struct evsel *tracking_evsel;
150150
int err;
151+
u64 bit;
151152

152153
sper->evlist = evlist;
153154

@@ -245,6 +246,15 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
245246
*/
246247
evsel__set_sample_bit(arm_spe_evsel, DATA_SRC);
247248

249+
/*
250+
* The PHYS_ADDR flag does not affect the driver behaviour, it is used to
251+
* inform that the resulting output's SPE samples contain physical addresses
252+
* where applicable.
253+
*/
254+
bit = perf_pmu__format_bits(&arm_spe_pmu->format, "pa_enable");
255+
if (arm_spe_evsel->core.attr.config & bit)
256+
evsel__set_sample_bit(arm_spe_evsel, PHYS_ADDR);
257+
248258
/* Add dummy event to keep tracking */
249259
err = parse_events(evlist, "dummy:u", NULL);
250260
if (err)

tools/perf/arch/arm64/util/machine.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,6 @@
88
#include "callchain.h"
99
#include "record.h"
1010

11-
/* On arm64, kernel text segment starts at high memory address,
12-
* for example 0xffff 0000 8xxx xxxx. Modules start at a low memory
13-
* address, like 0xffff 0000 00ax xxxx. When only small amount of
14-
* memory is used by modules, gap between end of module's text segment
15-
* and start of kernel text segment may reach 2G.
16-
* Therefore do not fill this gap and do not assign it to the kernel dso map.
17-
*/
18-
19-
#define SYMBOL_LIMIT (1 << 12) /* 4K */
20-
21-
void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
22-
{
23-
if ((strchr(p->name, '[') && strchr(c->name, '[') == NULL) ||
24-
(strchr(p->name, '[') == NULL && strchr(c->name, '[')))
25-
/* Limit range of last symbol in module and kernel */
26-
p->end += SYMBOL_LIMIT;
27-
else
28-
p->end = c->start;
29-
pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
30-
}
31-
3211
void arch__add_leaf_frame_record_opts(struct record_opts *opts)
3312
{
3413
opts->sample_user_regs |= sample_reg_masks[PERF_REG_ARM64_LR].mask;

tools/perf/arch/powerpc/util/Build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
perf-y += header.o
2-
perf-y += machine.o
32
perf-y += kvm-stat.o
43
perf-y += perf_regs.o
54
perf-y += mem-events.o

tools/perf/arch/powerpc/util/machine.c

Lines changed: 0 additions & 25 deletions
This file was deleted.

tools/perf/arch/s390/util/machine.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,3 @@ int arch__fix_module_text_start(u64 *start, u64 *size, const char *name)
3535

3636
return 0;
3737
}
38-
39-
/* On s390 kernel text segment start is located at very low memory addresses,
40-
* for example 0x10000. Modules are located at very high memory addresses,
41-
* for example 0x3ff xxxx xxxx. The gap between end of kernel text segment
42-
* and beginning of first module's text segment is very big.
43-
* Therefore do not fill this gap and do not assign it to the kernel dso map.
44-
*/
45-
void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
46-
{
47-
if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
48-
/* Last kernel symbol mapped to end of page */
49-
p->end = roundup(p->end, page_size);
50-
else
51-
p->end = c->start;
52-
pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
53-
}

tools/perf/tests/attr/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Following tests are defined (with perf commands):
6060
perf record -R kill (test-record-raw)
6161
perf record -c 2 -e arm_spe_0// -- kill (test-record-spe-period)
6262
perf record -e arm_spe_0/period=3/ -- kill (test-record-spe-period-term)
63+
perf record -e arm_spe_0/pa_enable=1/ -- kill (test-record-spe-physical-address)
6364
perf stat -e cycles kill (test-stat-basic)
6465
perf stat kill (test-stat-default)
6566
perf stat -d kill (test-stat-detailed-1)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[config]
2+
command = record
3+
args = --no-bpf-event -e arm_spe_0/pa_enable=1/ -- kill >/dev/null 2>&1
4+
ret = 1
5+
arch = aarch64
6+
7+
[event-10:base-record-spe]
8+
# 622727 is the decimal of IP|TID|TIME|CPU|IDENTIFIER|DATA_SRC|PHYS_ADDR
9+
sample_type=622727
10+
11+
# dummy event
12+
[event-1:base-record-spe]

tools/perf/util/arm-spe.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,10 +1033,11 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
10331033
memset(&attr, 0, sizeof(struct perf_event_attr));
10341034
attr.size = sizeof(struct perf_event_attr);
10351035
attr.type = PERF_TYPE_HARDWARE;
1036-
attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
1036+
attr.sample_type = evsel->core.attr.sample_type &
1037+
(PERF_SAMPLE_MASK | PERF_SAMPLE_PHYS_ADDR);
10371038
attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
10381039
PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
1039-
PERF_SAMPLE_WEIGHT;
1040+
PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
10401041
if (spe->timeless_decoding)
10411042
attr.sample_type &= ~(u64)PERF_SAMPLE_TIME;
10421043
else

tools/perf/util/session.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2576,7 +2576,7 @@ int perf_session__process_events(struct perf_session *session)
25762576
if (perf_data__is_pipe(session->data))
25772577
return __perf_session__process_pipe_events(session);
25782578

2579-
if (perf_data__is_dir(session->data))
2579+
if (perf_data__is_dir(session->data) && session->data->dir.nr)
25802580
return __perf_session__process_dir_events(session);
25812581

25822582
return __perf_session__process_events(session);

tools/perf/util/symbol-elf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ dso__load_sym_internal(struct dso *dso, struct map *map, struct symsrc *syms_ss,
12901290
* For misannotated, zeroed, ASM function sizes.
12911291
*/
12921292
if (nr > 0) {
1293-
symbols__fixup_end(&dso->symbols);
1293+
symbols__fixup_end(&dso->symbols, false);
12941294
symbols__fixup_duplicate(&dso->symbols);
12951295
if (kmap) {
12961296
/*

0 commit comments

Comments
 (0)