Skip to content

Commit d2359a5

Browse files
committed
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf tooling fixes from Thomas Gleixner: "Perf tooling fixes all over the place: - Fix the selection of the main thread COMM in db-export - Fix the disassemmbly display for BPF in annotate - Fix cpumap mask setup in perf ftrace when only one CPU is present - Add the missing 'cpu_clk_unhalted.core' event - Fix CPU 0 bindings in NUMA benchmarks - Fix the module size calculations for s390 - Handle the gap between kernel end and module start on s390 correctly - Build and typo fixes" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf pmu-events: Fix missing "cpu_clk_unhalted.core" event perf annotate: Fix s390 gap between kernel end and module start perf record: Fix module size on s390 perf tools: Fix include paths in ui directory perf tools: Fix a typo in a variable name in the Documentation Makefile perf cpumap: Fix writing to illegal memory in handling cpumap mask perf ftrace: Fix failure to set cpumask when only one cpu is present perf db-export: Fix thread__exec_comm() perf annotate: Fix printing of unaugmented disassembled instructions from BPF perf bench numa: Fix cpu0 binding
2 parents dcbb4a1 + d7731b8 commit d2359a5

File tree

14 files changed

+69
-16
lines changed

14 files changed

+69
-16
lines changed

tools/perf/Documentation/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ $(OUTPUT)doc.dep : $(wildcard *.txt) build-docdep.perl
242242
$(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
243243
mv $@+ $@
244244

245-
-include $(OUPTUT)doc.dep
245+
-include $(OUTPUT)doc.dep
246246

247247
_cmds_txt = cmds-ancillaryinterrogators.txt \
248248
cmds-ancillarymanipulators.txt \

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

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
#include "machine.h"
77
#include "api/fs/fs.h"
88
#include "debug.h"
9+
#include "symbol.h"
910

10-
int arch__fix_module_text_start(u64 *start, const char *name)
11+
int arch__fix_module_text_start(u64 *start, u64 *size, const char *name)
1112
{
1213
u64 m_start = *start;
1314
char path[PATH_MAX];
@@ -17,7 +18,35 @@ int arch__fix_module_text_start(u64 *start, const char *name)
1718
if (sysfs__read_ull(path, (unsigned long long *)start) < 0) {
1819
pr_debug2("Using module %s start:%#lx\n", path, m_start);
1920
*start = m_start;
21+
} else {
22+
/* Successful read of the modules segment text start address.
23+
* Calculate difference between module start address
24+
* in memory and module text segment start address.
25+
* For example module load address is 0x3ff8011b000
26+
* (from /proc/modules) and module text segment start
27+
* address is 0x3ff8011b870 (from file above).
28+
*
29+
* Adjust the module size and subtract the GOT table
30+
* size located at the beginning of the module.
31+
*/
32+
*size -= (*start - m_start);
2033
}
2134

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

tools/perf/bench/numa.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,10 @@ static u8 *alloc_data(ssize_t bytes0, int map_flags,
379379

380380
/* Allocate and initialize all memory on CPU#0: */
381381
if (init_cpu0) {
382-
orig_mask = bind_to_node(0);
383-
bind_to_memnode(0);
382+
int node = numa_node_of_cpu(0);
383+
384+
orig_mask = bind_to_node(node);
385+
bind_to_memnode(node);
384386
}
385387

386388
bytes = bytes0 + HPSIZE;

tools/perf/builtin-ftrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static int set_tracing_cpumask(struct cpu_map *cpumap)
173173
int last_cpu;
174174

175175
last_cpu = cpu_map__cpu(cpumap, cpumap->nr - 1);
176-
mask_size = (last_cpu + 3) / 4 + 1;
176+
mask_size = last_cpu / 4 + 2; /* one more byte for EOS */
177177
mask_size += last_cpu / 32; /* ',' is needed for every 32th cpus */
178178

179179
cpumask = malloc(mask_size);

tools/perf/pmu-events/jevents.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ static struct fixed {
453453
{ "inst_retired.any_p", "event=0xc0" },
454454
{ "cpu_clk_unhalted.ref", "event=0x0,umask=0x03" },
455455
{ "cpu_clk_unhalted.thread", "event=0x3c" },
456+
{ "cpu_clk_unhalted.core", "event=0x3c" },
456457
{ "cpu_clk_unhalted.thread_any", "event=0x3c,any=1" },
457458
{ NULL, NULL},
458459
};

tools/perf/ui/browser.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// SPDX-License-Identifier: GPL-2.0
2-
#include "../string2.h"
3-
#include "../config.h"
4-
#include "../../perf.h"
2+
#include "../util/util.h"
3+
#include "../util/string2.h"
4+
#include "../util/config.h"
5+
#include "../perf.h"
56
#include "libslang.h"
67
#include "ui.h"
78
#include "util.h"
@@ -14,7 +15,7 @@
1415
#include "browser.h"
1516
#include "helpline.h"
1617
#include "keysyms.h"
17-
#include "../color.h"
18+
#include "../util/color.h"
1819
#include <linux/ctype.h>
1920
#include <linux/zalloc.h>
2021

tools/perf/ui/tui/progress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <linux/kernel.h>
3-
#include "../cache.h"
3+
#include "../../util/cache.h"
44
#include "../progress.h"
55
#include "../libslang.h"
66
#include "../ui.h"

tools/perf/util/annotate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ static int disasm_line__parse(char *line, const char **namep, char **rawp)
11221122
goto out;
11231123

11241124
(*rawp)[0] = tmp;
1125-
*rawp = skip_spaces(*rawp);
1125+
*rawp = strim(*rawp);
11261126

11271127
return 0;
11281128

tools/perf/util/cpumap.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,10 @@ size_t cpu_map__snprint_mask(struct cpu_map *map, char *buf, size_t size)
751751
unsigned char *bitmap;
752752
int last_cpu = cpu_map__cpu(map, map->nr - 1);
753753

754-
bitmap = zalloc((last_cpu + 7) / 8);
754+
if (buf == NULL)
755+
return 0;
756+
757+
bitmap = zalloc(last_cpu / 8 + 1);
755758
if (bitmap == NULL) {
756759
buf[0] = '\0';
757760
return 0;

tools/perf/util/machine.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,7 @@ static int machine__set_modules_path(struct machine *machine)
13781378
return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0);
13791379
}
13801380
int __weak arch__fix_module_text_start(u64 *start __maybe_unused,
1381+
u64 *size __maybe_unused,
13811382
const char *name __maybe_unused)
13821383
{
13831384
return 0;
@@ -1389,7 +1390,7 @@ static int machine__create_module(void *arg, const char *name, u64 start,
13891390
struct machine *machine = arg;
13901391
struct map *map;
13911392

1392-
if (arch__fix_module_text_start(&start, name) < 0)
1393+
if (arch__fix_module_text_start(&start, &size, name) < 0)
13931394
return -1;
13941395

13951396
map = machine__findnew_module_map(machine, start, name);

0 commit comments

Comments
 (0)