Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+69 -16
+1 -1
tools/perf/Documentation/Makefile
··· 242 242 $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \ 243 243 mv $@+ $@ 244 244 245 - -include $(OUPTUT)doc.dep 245 + -include $(OUTPUT)doc.dep 246 246 247 247 _cmds_txt = cmds-ancillaryinterrogators.txt \ 248 248 cmds-ancillarymanipulators.txt \
+30 -1
tools/perf/arch/s390/util/machine.c
··· 6 6 #include "machine.h" 7 7 #include "api/fs/fs.h" 8 8 #include "debug.h" 9 + #include "symbol.h" 9 10 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) 11 12 { 12 13 u64 m_start = *start; 13 14 char path[PATH_MAX]; ··· 18 17 if (sysfs__read_ull(path, (unsigned long long *)start) < 0) { 19 18 pr_debug2("Using module %s start:%#lx\n", path, m_start); 20 19 *start = m_start; 20 + } else { 21 + /* Successful read of the modules segment text start address. 22 + * Calculate difference between module start address 23 + * in memory and module text segment start address. 24 + * For example module load address is 0x3ff8011b000 25 + * (from /proc/modules) and module text segment start 26 + * address is 0x3ff8011b870 (from file above). 27 + * 28 + * Adjust the module size and subtract the GOT table 29 + * size located at the beginning of the module. 30 + */ 31 + *size -= (*start - m_start); 21 32 } 22 33 23 34 return 0; 35 + } 36 + 37 + /* On s390 kernel text segment start is located at very low memory addresses, 38 + * for example 0x10000. Modules are located at very high memory addresses, 39 + * for example 0x3ff xxxx xxxx. The gap between end of kernel text segment 40 + * and beginning of first module's text segment is very big. 41 + * Therefore do not fill this gap and do not assign it to the kernel dso map. 42 + */ 43 + void arch__symbols__fixup_end(struct symbol *p, struct symbol *c) 44 + { 45 + if (strchr(p->name, '[') == NULL && strchr(c->name, '[')) 46 + /* Last kernel symbol mapped to end of page */ 47 + p->end = roundup(p->end, page_size); 48 + else 49 + p->end = c->start; 50 + pr_debug4("%s sym:%s end:%#lx\n", __func__, p->name, p->end); 24 51 }
+4 -2
tools/perf/bench/numa.c
··· 379 379 380 380 /* Allocate and initialize all memory on CPU#0: */ 381 381 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); 384 386 } 385 387 386 388 bytes = bytes0 + HPSIZE;
+1 -1
tools/perf/builtin-ftrace.c
··· 173 173 int last_cpu; 174 174 175 175 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 */ 177 177 mask_size += last_cpu / 32; /* ',' is needed for every 32th cpus */ 178 178 179 179 cpumask = malloc(mask_size);
+1
tools/perf/pmu-events/jevents.c
··· 453 453 { "inst_retired.any_p", "event=0xc0" }, 454 454 { "cpu_clk_unhalted.ref", "event=0x0,umask=0x03" }, 455 455 { "cpu_clk_unhalted.thread", "event=0x3c" }, 456 + { "cpu_clk_unhalted.core", "event=0x3c" }, 456 457 { "cpu_clk_unhalted.thread_any", "event=0x3c,any=1" }, 457 458 { NULL, NULL}, 458 459 };
+5 -4
tools/perf/ui/browser.c
··· 1 1 // 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" 5 6 #include "libslang.h" 6 7 #include "ui.h" 7 8 #include "util.h" ··· 15 14 #include "browser.h" 16 15 #include "helpline.h" 17 16 #include "keysyms.h" 18 - #include "../color.h" 17 + #include "../util/color.h" 19 18 #include <linux/ctype.h> 20 19 #include <linux/zalloc.h> 21 20
+1 -1
tools/perf/ui/tui/progress.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <linux/kernel.h> 3 - #include "../cache.h" 3 + #include "../../util/cache.h" 4 4 #include "../progress.h" 5 5 #include "../libslang.h" 6 6 #include "../ui.h"
+1 -1
tools/perf/util/annotate.c
··· 1122 1122 goto out; 1123 1123 1124 1124 (*rawp)[0] = tmp; 1125 - *rawp = skip_spaces(*rawp); 1125 + *rawp = strim(*rawp); 1126 1126 1127 1127 return 0; 1128 1128
+4 -1
tools/perf/util/cpumap.c
··· 751 751 unsigned char *bitmap; 752 752 int last_cpu = cpu_map__cpu(map, map->nr - 1); 753 753 754 - bitmap = zalloc((last_cpu + 7) / 8); 754 + if (buf == NULL) 755 + return 0; 756 + 757 + bitmap = zalloc(last_cpu / 8 + 1); 755 758 if (bitmap == NULL) { 756 759 buf[0] = '\0'; 757 760 return 0;
+2 -1
tools/perf/util/machine.c
··· 1378 1378 return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0); 1379 1379 } 1380 1380 int __weak arch__fix_module_text_start(u64 *start __maybe_unused, 1381 + u64 *size __maybe_unused, 1381 1382 const char *name __maybe_unused) 1382 1383 { 1383 1384 return 0; ··· 1390 1389 struct machine *machine = arg; 1391 1390 struct map *map; 1392 1391 1393 - if (arch__fix_module_text_start(&start, name) < 0) 1392 + if (arch__fix_module_text_start(&start, &size, name) < 0) 1394 1393 return -1; 1395 1394 1396 1395 map = machine__findnew_module_map(machine, start, name);
+1 -1
tools/perf/util/machine.h
··· 222 222 223 223 struct map *machine__findnew_module_map(struct machine *machine, u64 start, 224 224 const char *filename); 225 - int arch__fix_module_text_start(u64 *start, const char *name); 225 + int arch__fix_module_text_start(u64 *start, u64 *size, const char *name); 226 226 227 227 int machine__load_kallsyms(struct machine *machine, const char *filename); 228 228
+6 -1
tools/perf/util/symbol.c
··· 92 92 return tail - str; 93 93 } 94 94 95 + void __weak arch__symbols__fixup_end(struct symbol *p, struct symbol *c) 96 + { 97 + p->end = c->start; 98 + } 99 + 95 100 const char * __weak arch__normalize_symbol_name(const char *name) 96 101 { 97 102 return name; ··· 223 218 curr = rb_entry(nd, struct symbol, rb_node); 224 219 225 220 if (prev->end == prev->start && prev->end != curr->start) 226 - prev->end = curr->start; 221 + arch__symbols__fixup_end(prev, curr); 227 222 } 228 223 229 224 /* Last entry */
+1
tools/perf/util/symbol.h
··· 288 288 #define SYMBOL_A 0 289 289 #define SYMBOL_B 1 290 290 291 + void arch__symbols__fixup_end(struct symbol *p, struct symbol *c); 291 292 int arch__compare_symbol_names(const char *namea, const char *nameb); 292 293 int arch__compare_symbol_names_n(const char *namea, const char *nameb, 293 294 unsigned int n);
+11 -1
tools/perf/util/thread.c
··· 214 214 215 215 struct comm *thread__exec_comm(const struct thread *thread) 216 216 { 217 - struct comm *comm, *last = NULL; 217 + struct comm *comm, *last = NULL, *second_last = NULL; 218 218 219 219 list_for_each_entry(comm, &thread->comm_list, list) { 220 220 if (comm->exec) 221 221 return comm; 222 + second_last = last; 222 223 last = comm; 223 224 } 225 + 226 + /* 227 + * 'last' with no start time might be the parent's comm of a synthesized 228 + * thread (created by processing a synthesized fork event). For a main 229 + * thread, that is very probably wrong. Prefer a later comm to avoid 230 + * that case. 231 + */ 232 + if (second_last && !last->start && thread->pid_ == thread->tid) 233 + return second_last; 224 234 225 235 return last; 226 236 }