diff options
Diffstat (limited to 'tools/perf')
| -rw-r--r-- | tools/perf/Documentation/intel-pt.txt | 15 | ||||
| -rw-r--r-- | tools/perf/config/Makefile | 20 | ||||
| -rw-r--r-- | tools/perf/util/probe-event.c | 13 | ||||
| -rw-r--r-- | tools/perf/util/session.c | 5 | ||||
| -rw-r--r-- | tools/perf/util/stat.c | 16 | ||||
| -rw-r--r-- | tools/perf/util/symbol-elf.c | 37 | ||||
| -rw-r--r-- | tools/perf/util/util.c | 2 |
7 files changed, 55 insertions, 53 deletions
diff --git a/tools/perf/Documentation/intel-pt.txt b/tools/perf/Documentation/intel-pt.txt index 4a0501d7a3b4..c94c9de3173e 100644 --- a/tools/perf/Documentation/intel-pt.txt +++ b/tools/perf/Documentation/intel-pt.txt | |||
| @@ -364,21 +364,6 @@ cyc_thresh Specifies how frequently CYC packets are produced - see cyc | |||
| 364 | 364 | ||
| 365 | CYC packets are not requested by default. | 365 | CYC packets are not requested by default. |
| 366 | 366 | ||
| 367 | no_force_psb This is a driver option and is not in the IA32_RTIT_CTL MSR. | ||
| 368 | |||
| 369 | It stops the driver resetting the byte count to zero whenever | ||
| 370 | enabling the trace (for example on context switches) which in | ||
| 371 | turn results in no PSB being forced. However some processors | ||
| 372 | will produce a PSB anyway. | ||
| 373 | |||
| 374 | In any case, there is still a PSB when the trace is enabled for | ||
| 375 | the first time. | ||
| 376 | |||
| 377 | no_force_psb can be used to slightly decrease the trace size but | ||
| 378 | may make it harder for the decoder to recover from errors. | ||
| 379 | |||
| 380 | no_force_psb is not selected by default. | ||
| 381 | |||
| 382 | 367 | ||
| 383 | new snapshot option | 368 | new snapshot option |
| 384 | ------------------- | 369 | ------------------- |
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 827557fc7511..38a08539f4bf 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
| @@ -573,9 +573,14 @@ ifndef NO_LIBNUMA | |||
| 573 | msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev); | 573 | msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev); |
| 574 | NO_LIBNUMA := 1 | 574 | NO_LIBNUMA := 1 |
| 575 | else | 575 | else |
| 576 | CFLAGS += -DHAVE_LIBNUMA_SUPPORT | 576 | ifeq ($(feature-numa_num_possible_cpus), 0) |
| 577 | EXTLIBS += -lnuma | 577 | msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8); |
| 578 | $(call detected,CONFIG_NUMA) | 578 | NO_LIBNUMA := 1 |
| 579 | else | ||
| 580 | CFLAGS += -DHAVE_LIBNUMA_SUPPORT | ||
| 581 | EXTLIBS += -lnuma | ||
| 582 | $(call detected,CONFIG_NUMA) | ||
| 583 | endif | ||
| 579 | endif | 584 | endif |
| 580 | endif | 585 | endif |
| 581 | 586 | ||
| @@ -621,8 +626,13 @@ ifdef LIBBABELTRACE | |||
| 621 | endif | 626 | endif |
| 622 | 627 | ||
| 623 | ifndef NO_AUXTRACE | 628 | ifndef NO_AUXTRACE |
| 624 | $(call detected,CONFIG_AUXTRACE) | 629 | ifeq ($(feature-get_cpuid), 0) |
| 625 | CFLAGS += -DHAVE_AUXTRACE_SUPPORT | 630 | msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc); |
| 631 | NO_AUXTRACE := 1 | ||
| 632 | else | ||
| 633 | $(call detected,CONFIG_AUXTRACE) | ||
| 634 | CFLAGS += -DHAVE_AUXTRACE_SUPPORT | ||
| 635 | endif | ||
| 626 | endif | 636 | endif |
| 627 | 637 | ||
| 628 | # Among the variables below, these: | 638 | # Among the variables below, these: |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index eb5f18b75402..c6f9af78f6f5 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
| @@ -270,12 +270,13 @@ static int kernel_get_module_dso(const char *module, struct dso **pdso) | |||
| 270 | int ret = 0; | 270 | int ret = 0; |
| 271 | 271 | ||
| 272 | if (module) { | 272 | if (module) { |
| 273 | list_for_each_entry(dso, &host_machine->dsos.head, node) { | 273 | char module_name[128]; |
| 274 | if (!dso->kernel) | 274 | |
| 275 | continue; | 275 | snprintf(module_name, sizeof(module_name), "[%s]", module); |
| 276 | if (strncmp(dso->short_name + 1, module, | 276 | map = map_groups__find_by_name(&host_machine->kmaps, MAP__FUNCTION, module_name); |
| 277 | dso->short_name_len - 2) == 0) | 277 | if (map) { |
| 278 | goto found; | 278 | dso = map->dso; |
| 279 | goto found; | ||
| 279 | } | 280 | } |
| 280 | pr_debug("Failed to find module %s.\n", module); | 281 | pr_debug("Failed to find module %s.\n", module); |
| 281 | return -ENOENT; | 282 | return -ENOENT; |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 8a4537ee9bc3..fc3f7c922f99 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
| @@ -1580,7 +1580,10 @@ static int __perf_session__process_events(struct perf_session *session, | |||
| 1580 | file_offset = page_offset; | 1580 | file_offset = page_offset; |
| 1581 | head = data_offset - page_offset; | 1581 | head = data_offset - page_offset; |
| 1582 | 1582 | ||
| 1583 | if (data_size && (data_offset + data_size < file_size)) | 1583 | if (data_size == 0) |
| 1584 | goto out; | ||
| 1585 | |||
| 1586 | if (data_offset + data_size < file_size) | ||
| 1584 | file_size = data_offset + data_size; | 1587 | file_size = data_offset + data_size; |
| 1585 | 1588 | ||
| 1586 | ui_progress__init(&prog, file_size, "Processing events..."); | 1589 | ui_progress__init(&prog, file_size, "Processing events..."); |
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 415c359de465..2d065d065b67 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c | |||
| @@ -196,7 +196,8 @@ static void zero_per_pkg(struct perf_evsel *counter) | |||
| 196 | memset(counter->per_pkg_mask, 0, MAX_NR_CPUS); | 196 | memset(counter->per_pkg_mask, 0, MAX_NR_CPUS); |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | static int check_per_pkg(struct perf_evsel *counter, int cpu, bool *skip) | 199 | static int check_per_pkg(struct perf_evsel *counter, |
| 200 | struct perf_counts_values *vals, int cpu, bool *skip) | ||
| 200 | { | 201 | { |
| 201 | unsigned long *mask = counter->per_pkg_mask; | 202 | unsigned long *mask = counter->per_pkg_mask; |
| 202 | struct cpu_map *cpus = perf_evsel__cpus(counter); | 203 | struct cpu_map *cpus = perf_evsel__cpus(counter); |
| @@ -218,6 +219,17 @@ static int check_per_pkg(struct perf_evsel *counter, int cpu, bool *skip) | |||
| 218 | counter->per_pkg_mask = mask; | 219 | counter->per_pkg_mask = mask; |
| 219 | } | 220 | } |
| 220 | 221 | ||
| 222 | /* | ||
| 223 | * we do not consider an event that has not run as a good | ||
| 224 | * instance to mark a package as used (skip=1). Otherwise | ||
| 225 | * we may run into a situation where the first CPU in a package | ||
| 226 | * is not running anything, yet the second is, and this function | ||
| 227 | * would mark the package as used after the first CPU and would | ||
| 228 | * not read the values from the second CPU. | ||
| 229 | */ | ||
| 230 | if (!(vals->run && vals->ena)) | ||
| 231 | return 0; | ||
| 232 | |||
| 221 | s = cpu_map__get_socket(cpus, cpu); | 233 | s = cpu_map__get_socket(cpus, cpu); |
| 222 | if (s < 0) | 234 | if (s < 0) |
| 223 | return -1; | 235 | return -1; |
| @@ -235,7 +247,7 @@ process_counter_values(struct perf_stat_config *config, struct perf_evsel *evsel | |||
| 235 | static struct perf_counts_values zero; | 247 | static struct perf_counts_values zero; |
| 236 | bool skip = false; | 248 | bool skip = false; |
| 237 | 249 | ||
| 238 | if (check_per_pkg(evsel, cpu, &skip)) { | 250 | if (check_per_pkg(evsel, count, cpu, &skip)) { |
| 239 | pr_err("failed to read per-pkg counter\n"); | 251 | pr_err("failed to read per-pkg counter\n"); |
| 240 | return -1; | 252 | return -1; |
| 241 | } | 253 | } |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 53bb5f59ec58..475d88d0a1c9 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
| @@ -38,7 +38,7 @@ static inline char *bfd_demangle(void __maybe_unused *v, | |||
| 38 | #endif | 38 | #endif |
| 39 | 39 | ||
| 40 | #ifndef HAVE_ELF_GETPHDRNUM_SUPPORT | 40 | #ifndef HAVE_ELF_GETPHDRNUM_SUPPORT |
| 41 | int elf_getphdrnum(Elf *elf, size_t *dst) | 41 | static int elf_getphdrnum(Elf *elf, size_t *dst) |
| 42 | { | 42 | { |
| 43 | GElf_Ehdr gehdr; | 43 | GElf_Ehdr gehdr; |
| 44 | GElf_Ehdr *ehdr; | 44 | GElf_Ehdr *ehdr; |
| @@ -1271,8 +1271,6 @@ out_close: | |||
| 1271 | static int kcore__init(struct kcore *kcore, char *filename, int elfclass, | 1271 | static int kcore__init(struct kcore *kcore, char *filename, int elfclass, |
| 1272 | bool temp) | 1272 | bool temp) |
| 1273 | { | 1273 | { |
| 1274 | GElf_Ehdr *ehdr; | ||
| 1275 | |||
| 1276 | kcore->elfclass = elfclass; | 1274 | kcore->elfclass = elfclass; |
| 1277 | 1275 | ||
| 1278 | if (temp) | 1276 | if (temp) |
| @@ -1289,9 +1287,7 @@ static int kcore__init(struct kcore *kcore, char *filename, int elfclass, | |||
| 1289 | if (!gelf_newehdr(kcore->elf, elfclass)) | 1287 | if (!gelf_newehdr(kcore->elf, elfclass)) |
| 1290 | goto out_end; | 1288 | goto out_end; |
| 1291 | 1289 | ||
| 1292 | ehdr = gelf_getehdr(kcore->elf, &kcore->ehdr); | 1290 | memset(&kcore->ehdr, 0, sizeof(GElf_Ehdr)); |
| 1293 | if (!ehdr) | ||
| 1294 | goto out_end; | ||
| 1295 | 1291 | ||
| 1296 | return 0; | 1292 | return 0; |
| 1297 | 1293 | ||
| @@ -1348,23 +1344,18 @@ static int kcore__copy_hdr(struct kcore *from, struct kcore *to, size_t count) | |||
| 1348 | static int kcore__add_phdr(struct kcore *kcore, int idx, off_t offset, | 1344 | static int kcore__add_phdr(struct kcore *kcore, int idx, off_t offset, |
| 1349 | u64 addr, u64 len) | 1345 | u64 addr, u64 len) |
| 1350 | { | 1346 | { |
| 1351 | GElf_Phdr gphdr; | 1347 | GElf_Phdr phdr = { |
| 1352 | GElf_Phdr *phdr; | 1348 | .p_type = PT_LOAD, |
| 1353 | 1349 | .p_flags = PF_R | PF_W | PF_X, | |
| 1354 | phdr = gelf_getphdr(kcore->elf, idx, &gphdr); | 1350 | .p_offset = offset, |
| 1355 | if (!phdr) | 1351 | .p_vaddr = addr, |
| 1356 | return -1; | 1352 | .p_paddr = 0, |
| 1357 | 1353 | .p_filesz = len, | |
| 1358 | phdr->p_type = PT_LOAD; | 1354 | .p_memsz = len, |
| 1359 | phdr->p_flags = PF_R | PF_W | PF_X; | 1355 | .p_align = page_size, |
| 1360 | phdr->p_offset = offset; | 1356 | }; |
| 1361 | phdr->p_vaddr = addr; | 1357 | |
| 1362 | phdr->p_paddr = 0; | 1358 | if (!gelf_update_phdr(kcore->elf, idx, &phdr)) |
| 1363 | phdr->p_filesz = len; | ||
| 1364 | phdr->p_memsz = len; | ||
| 1365 | phdr->p_align = page_size; | ||
| 1366 | |||
| 1367 | if (!gelf_update_phdr(kcore->elf, idx, phdr)) | ||
| 1368 | return -1; | 1359 | return -1; |
| 1369 | 1360 | ||
| 1370 | return 0; | 1361 | return 0; |
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 7acafb3c5592..c2cd9bf2348b 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
| @@ -709,7 +709,7 @@ bool find_process(const char *name) | |||
| 709 | 709 | ||
| 710 | dir = opendir(procfs__mountpoint()); | 710 | dir = opendir(procfs__mountpoint()); |
| 711 | if (!dir) | 711 | if (!dir) |
| 712 | return -1; | 712 | return false; |
| 713 | 713 | ||
| 714 | /* Walk through the directory. */ | 714 | /* Walk through the directory. */ |
| 715 | while (ret && (d = readdir(dir)) != NULL) { | 715 | while (ret && (d = readdir(dir)) != NULL) { |
