diff options
author | Takashi Iwai <tiwai@suse.de> | 2017-11-01 12:43:20 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-11-01 12:43:20 -0400 |
commit | a53a0ab8ff725672fcb47bb9a5ef75fce45679d0 (patch) | |
tree | 75cdea78f27fdd569d72cea0b7837bbcc8d871f7 /tools/perf | |
parent | 1f20f9ff57ca23b9f5502fca85ce3977e8496cb1 (diff) | |
parent | b817d936248b9bcee8282e97fb1dda1b03c903fe (diff) |
Merge tag 'asoc-fix-v4.14-rc7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v4.14
A bunch of fixes here, mostly device specific ones (the biggest one
being the revert of the hotword support for rt5514), with a couple of
core fixes for potential issues with corrupted or otherwise invalid
topology files.
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/Documentation/perf-record.txt | 4 | ||||
-rw-r--r-- | tools/perf/builtin-script.c | 4 | ||||
-rwxr-xr-x | tools/perf/tests/shell/trace+probe_libc_inet_pton.sh | 9 | ||||
-rw-r--r-- | tools/perf/ui/hist.c | 9 | ||||
-rw-r--r-- | tools/perf/util/callchain.c | 6 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 9 | ||||
-rw-r--r-- | tools/perf/util/parse-events.l | 17 | ||||
-rw-r--r-- | tools/perf/util/pmu.c | 56 | ||||
-rw-r--r-- | tools/perf/util/pmu.h | 1 | ||||
-rw-r--r-- | tools/perf/util/session.c | 2 | ||||
-rw-r--r-- | tools/perf/util/xyarray.h | 4 |
11 files changed, 89 insertions, 32 deletions
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index e397453e5a46..63526f4416ea 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt | |||
@@ -8,8 +8,8 @@ perf-record - Run a command and record its profile into perf.data | |||
8 | SYNOPSIS | 8 | SYNOPSIS |
9 | -------- | 9 | -------- |
10 | [verse] | 10 | [verse] |
11 | 'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] <command> | 11 | 'perf record' [-e <EVENT> | --event=EVENT] [-a] <command> |
12 | 'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] -- <command> [<options>] | 12 | 'perf record' [-e <EVENT> | --event=EVENT] [-a] -- <command> [<options>] |
13 | 13 | ||
14 | DESCRIPTION | 14 | DESCRIPTION |
15 | ----------- | 15 | ----------- |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 3d4c3b5e1868..0c977b6e0f8b 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -586,7 +586,7 @@ static void print_sample_brstack(struct perf_sample *sample, | |||
586 | thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, to, &alt); | 586 | thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, to, &alt); |
587 | } | 587 | } |
588 | 588 | ||
589 | printf("0x%"PRIx64, from); | 589 | printf(" 0x%"PRIx64, from); |
590 | if (PRINT_FIELD(DSO)) { | 590 | if (PRINT_FIELD(DSO)) { |
591 | printf("("); | 591 | printf("("); |
592 | map__fprintf_dsoname(alf.map, stdout); | 592 | map__fprintf_dsoname(alf.map, stdout); |
@@ -681,7 +681,7 @@ static void print_sample_brstackoff(struct perf_sample *sample, | |||
681 | if (alt.map && !alt.map->dso->adjust_symbols) | 681 | if (alt.map && !alt.map->dso->adjust_symbols) |
682 | to = map__map_ip(alt.map, to); | 682 | to = map__map_ip(alt.map, to); |
683 | 683 | ||
684 | printf("0x%"PRIx64, from); | 684 | printf(" 0x%"PRIx64, from); |
685 | if (PRINT_FIELD(DSO)) { | 685 | if (PRINT_FIELD(DSO)) { |
686 | printf("("); | 686 | printf("("); |
687 | map__fprintf_dsoname(alf.map, stdout); | 687 | map__fprintf_dsoname(alf.map, stdout); |
diff --git a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh index 462fc755092e..7a84d73324e3 100755 --- a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh +++ b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh | |||
@@ -10,6 +10,9 @@ | |||
10 | 10 | ||
11 | . $(dirname $0)/lib/probe.sh | 11 | . $(dirname $0)/lib/probe.sh |
12 | 12 | ||
13 | ld=$(realpath /lib64/ld*.so.* | uniq) | ||
14 | libc=$(echo $ld | sed 's/ld/libc/g') | ||
15 | |||
13 | trace_libc_inet_pton_backtrace() { | 16 | trace_libc_inet_pton_backtrace() { |
14 | idx=0 | 17 | idx=0 |
15 | expected[0]="PING.*bytes" | 18 | expected[0]="PING.*bytes" |
@@ -18,8 +21,8 @@ trace_libc_inet_pton_backtrace() { | |||
18 | expected[3]=".*packets transmitted.*" | 21 | expected[3]=".*packets transmitted.*" |
19 | expected[4]="rtt min.*" | 22 | expected[4]="rtt min.*" |
20 | expected[5]="[0-9]+\.[0-9]+[[:space:]]+probe_libc:inet_pton:\([[:xdigit:]]+\)" | 23 | expected[5]="[0-9]+\.[0-9]+[[:space:]]+probe_libc:inet_pton:\([[:xdigit:]]+\)" |
21 | expected[6]=".*inet_pton[[:space:]]\(/usr/lib.*/libc-[0-9]+\.[0-9]+\.so\)$" | 24 | expected[6]=".*inet_pton[[:space:]]\($libc\)$" |
22 | expected[7]="getaddrinfo[[:space:]]\(/usr/lib.*/libc-[0-9]+\.[0-9]+\.so\)$" | 25 | expected[7]="getaddrinfo[[:space:]]\($libc\)$" |
23 | expected[8]=".*\(.*/bin/ping.*\)$" | 26 | expected[8]=".*\(.*/bin/ping.*\)$" |
24 | 27 | ||
25 | perf trace --no-syscalls -e probe_libc:inet_pton/max-stack=3/ ping -6 -c 1 ::1 2>&1 | grep -v ^$ | while read line ; do | 28 | perf trace --no-syscalls -e probe_libc:inet_pton/max-stack=3/ ping -6 -c 1 ::1 2>&1 | grep -v ^$ | while read line ; do |
@@ -35,7 +38,7 @@ trace_libc_inet_pton_backtrace() { | |||
35 | } | 38 | } |
36 | 39 | ||
37 | skip_if_no_perf_probe && \ | 40 | skip_if_no_perf_probe && \ |
38 | perf probe -q /lib64/libc-*.so inet_pton && \ | 41 | perf probe -q $libc inet_pton && \ |
39 | trace_libc_inet_pton_backtrace | 42 | trace_libc_inet_pton_backtrace |
40 | err=$? | 43 | err=$? |
41 | rm -f ${file} | 44 | rm -f ${file} |
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index ddb2c6fbdf91..db79017a6e56 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -532,7 +532,7 @@ void perf_hpp_list__prepend_sort_field(struct perf_hpp_list *list, | |||
532 | 532 | ||
533 | void perf_hpp__column_unregister(struct perf_hpp_fmt *format) | 533 | void perf_hpp__column_unregister(struct perf_hpp_fmt *format) |
534 | { | 534 | { |
535 | list_del(&format->list); | 535 | list_del_init(&format->list); |
536 | } | 536 | } |
537 | 537 | ||
538 | void perf_hpp__cancel_cumulate(void) | 538 | void perf_hpp__cancel_cumulate(void) |
@@ -606,6 +606,13 @@ next: | |||
606 | 606 | ||
607 | static void fmt_free(struct perf_hpp_fmt *fmt) | 607 | static void fmt_free(struct perf_hpp_fmt *fmt) |
608 | { | 608 | { |
609 | /* | ||
610 | * At this point fmt should be completely | ||
611 | * unhooked, if not it's a bug. | ||
612 | */ | ||
613 | BUG_ON(!list_empty(&fmt->list)); | ||
614 | BUG_ON(!list_empty(&fmt->sort_list)); | ||
615 | |||
609 | if (fmt->free) | 616 | if (fmt->free) |
610 | fmt->free(fmt); | 617 | fmt->free(fmt); |
611 | } | 618 | } |
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index be09d77cade0..a971caf3759d 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c | |||
@@ -685,6 +685,8 @@ static enum match_result match_chain(struct callchain_cursor_node *node, | |||
685 | { | 685 | { |
686 | struct symbol *sym = node->sym; | 686 | struct symbol *sym = node->sym; |
687 | u64 left, right; | 687 | u64 left, right; |
688 | struct dso *left_dso = NULL; | ||
689 | struct dso *right_dso = NULL; | ||
688 | 690 | ||
689 | if (callchain_param.key == CCKEY_SRCLINE) { | 691 | if (callchain_param.key == CCKEY_SRCLINE) { |
690 | enum match_result match = match_chain_srcline(node, cnode); | 692 | enum match_result match = match_chain_srcline(node, cnode); |
@@ -696,12 +698,14 @@ static enum match_result match_chain(struct callchain_cursor_node *node, | |||
696 | if (cnode->ms.sym && sym && callchain_param.key == CCKEY_FUNCTION) { | 698 | if (cnode->ms.sym && sym && callchain_param.key == CCKEY_FUNCTION) { |
697 | left = cnode->ms.sym->start; | 699 | left = cnode->ms.sym->start; |
698 | right = sym->start; | 700 | right = sym->start; |
701 | left_dso = cnode->ms.map->dso; | ||
702 | right_dso = node->map->dso; | ||
699 | } else { | 703 | } else { |
700 | left = cnode->ip; | 704 | left = cnode->ip; |
701 | right = node->ip; | 705 | right = node->ip; |
702 | } | 706 | } |
703 | 707 | ||
704 | if (left == right) { | 708 | if (left == right && left_dso == right_dso) { |
705 | if (node->branch) { | 709 | if (node->branch) { |
706 | cnode->branch_count++; | 710 | cnode->branch_count++; |
707 | 711 | ||
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index f6257fb4f08c..39b15968eab1 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -309,10 +309,11 @@ static char *get_config_name(struct list_head *head_terms) | |||
309 | static struct perf_evsel * | 309 | static struct perf_evsel * |
310 | __add_event(struct list_head *list, int *idx, | 310 | __add_event(struct list_head *list, int *idx, |
311 | struct perf_event_attr *attr, | 311 | struct perf_event_attr *attr, |
312 | char *name, struct cpu_map *cpus, | 312 | char *name, struct perf_pmu *pmu, |
313 | struct list_head *config_terms, bool auto_merge_stats) | 313 | struct list_head *config_terms, bool auto_merge_stats) |
314 | { | 314 | { |
315 | struct perf_evsel *evsel; | 315 | struct perf_evsel *evsel; |
316 | struct cpu_map *cpus = pmu ? pmu->cpus : NULL; | ||
316 | 317 | ||
317 | event_attr_init(attr); | 318 | event_attr_init(attr); |
318 | 319 | ||
@@ -323,7 +324,7 @@ __add_event(struct list_head *list, int *idx, | |||
323 | (*idx)++; | 324 | (*idx)++; |
324 | evsel->cpus = cpu_map__get(cpus); | 325 | evsel->cpus = cpu_map__get(cpus); |
325 | evsel->own_cpus = cpu_map__get(cpus); | 326 | evsel->own_cpus = cpu_map__get(cpus); |
326 | evsel->system_wide = !!cpus; | 327 | evsel->system_wide = pmu ? pmu->is_uncore : false; |
327 | evsel->auto_merge_stats = auto_merge_stats; | 328 | evsel->auto_merge_stats = auto_merge_stats; |
328 | 329 | ||
329 | if (name) | 330 | if (name) |
@@ -1233,7 +1234,7 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state, | |||
1233 | 1234 | ||
1234 | if (!head_config) { | 1235 | if (!head_config) { |
1235 | attr.type = pmu->type; | 1236 | attr.type = pmu->type; |
1236 | evsel = __add_event(list, &parse_state->idx, &attr, NULL, pmu->cpus, NULL, auto_merge_stats); | 1237 | evsel = __add_event(list, &parse_state->idx, &attr, NULL, pmu, NULL, auto_merge_stats); |
1237 | return evsel ? 0 : -ENOMEM; | 1238 | return evsel ? 0 : -ENOMEM; |
1238 | } | 1239 | } |
1239 | 1240 | ||
@@ -1254,7 +1255,7 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state, | |||
1254 | return -EINVAL; | 1255 | return -EINVAL; |
1255 | 1256 | ||
1256 | evsel = __add_event(list, &parse_state->idx, &attr, | 1257 | evsel = __add_event(list, &parse_state->idx, &attr, |
1257 | get_config_name(head_config), pmu->cpus, | 1258 | get_config_name(head_config), pmu, |
1258 | &config_terms, auto_merge_stats); | 1259 | &config_terms, auto_merge_stats); |
1259 | if (evsel) { | 1260 | if (evsel) { |
1260 | evsel->unit = info.unit; | 1261 | evsel->unit = info.unit; |
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index c42edeac451f..dcfdafdc2f1c 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l | |||
@@ -8,6 +8,9 @@ | |||
8 | 8 | ||
9 | %{ | 9 | %{ |
10 | #include <errno.h> | 10 | #include <errno.h> |
11 | #include <sys/types.h> | ||
12 | #include <sys/stat.h> | ||
13 | #include <unistd.h> | ||
11 | #include "../perf.h" | 14 | #include "../perf.h" |
12 | #include "parse-events.h" | 15 | #include "parse-events.h" |
13 | #include "parse-events-bison.h" | 16 | #include "parse-events-bison.h" |
@@ -53,9 +56,8 @@ static int str(yyscan_t scanner, int token) | |||
53 | return token; | 56 | return token; |
54 | } | 57 | } |
55 | 58 | ||
56 | static bool isbpf(yyscan_t scanner) | 59 | static bool isbpf_suffix(char *text) |
57 | { | 60 | { |
58 | char *text = parse_events_get_text(scanner); | ||
59 | int len = strlen(text); | 61 | int len = strlen(text); |
60 | 62 | ||
61 | if (len < 2) | 63 | if (len < 2) |
@@ -68,6 +70,17 @@ static bool isbpf(yyscan_t scanner) | |||
68 | return false; | 70 | return false; |
69 | } | 71 | } |
70 | 72 | ||
73 | static bool isbpf(yyscan_t scanner) | ||
74 | { | ||
75 | char *text = parse_events_get_text(scanner); | ||
76 | struct stat st; | ||
77 | |||
78 | if (!isbpf_suffix(text)) | ||
79 | return false; | ||
80 | |||
81 | return stat(text, &st) == 0; | ||
82 | } | ||
83 | |||
71 | /* | 84 | /* |
72 | * This function is called when the parser gets two kind of input: | 85 | * This function is called when the parser gets two kind of input: |
73 | * | 86 | * |
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index ac16a9db1fb5..1c4d7b4e4fb5 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c | |||
@@ -470,17 +470,36 @@ static void pmu_read_sysfs(void) | |||
470 | closedir(dir); | 470 | closedir(dir); |
471 | } | 471 | } |
472 | 472 | ||
473 | static struct cpu_map *__pmu_cpumask(const char *path) | ||
474 | { | ||
475 | FILE *file; | ||
476 | struct cpu_map *cpus; | ||
477 | |||
478 | file = fopen(path, "r"); | ||
479 | if (!file) | ||
480 | return NULL; | ||
481 | |||
482 | cpus = cpu_map__read(file); | ||
483 | fclose(file); | ||
484 | return cpus; | ||
485 | } | ||
486 | |||
487 | /* | ||
488 | * Uncore PMUs have a "cpumask" file under sysfs. CPU PMUs (e.g. on arm/arm64) | ||
489 | * may have a "cpus" file. | ||
490 | */ | ||
491 | #define CPUS_TEMPLATE_UNCORE "%s/bus/event_source/devices/%s/cpumask" | ||
492 | #define CPUS_TEMPLATE_CPU "%s/bus/event_source/devices/%s/cpus" | ||
493 | |||
473 | static struct cpu_map *pmu_cpumask(const char *name) | 494 | static struct cpu_map *pmu_cpumask(const char *name) |
474 | { | 495 | { |
475 | struct stat st; | ||
476 | char path[PATH_MAX]; | 496 | char path[PATH_MAX]; |
477 | FILE *file; | ||
478 | struct cpu_map *cpus; | 497 | struct cpu_map *cpus; |
479 | const char *sysfs = sysfs__mountpoint(); | 498 | const char *sysfs = sysfs__mountpoint(); |
480 | const char *templates[] = { | 499 | const char *templates[] = { |
481 | "%s/bus/event_source/devices/%s/cpumask", | 500 | CPUS_TEMPLATE_UNCORE, |
482 | "%s/bus/event_source/devices/%s/cpus", | 501 | CPUS_TEMPLATE_CPU, |
483 | NULL | 502 | NULL |
484 | }; | 503 | }; |
485 | const char **template; | 504 | const char **template; |
486 | 505 | ||
@@ -489,20 +508,25 @@ static struct cpu_map *pmu_cpumask(const char *name) | |||
489 | 508 | ||
490 | for (template = templates; *template; template++) { | 509 | for (template = templates; *template; template++) { |
491 | snprintf(path, PATH_MAX, *template, sysfs, name); | 510 | snprintf(path, PATH_MAX, *template, sysfs, name); |
492 | if (stat(path, &st) == 0) | 511 | cpus = __pmu_cpumask(path); |
493 | break; | 512 | if (cpus) |
513 | return cpus; | ||
494 | } | 514 | } |
495 | 515 | ||
496 | if (!*template) | 516 | return NULL; |
497 | return NULL; | 517 | } |
498 | 518 | ||
499 | file = fopen(path, "r"); | 519 | static bool pmu_is_uncore(const char *name) |
500 | if (!file) | 520 | { |
501 | return NULL; | 521 | char path[PATH_MAX]; |
522 | struct cpu_map *cpus; | ||
523 | const char *sysfs = sysfs__mountpoint(); | ||
502 | 524 | ||
503 | cpus = cpu_map__read(file); | 525 | snprintf(path, PATH_MAX, CPUS_TEMPLATE_UNCORE, sysfs, name); |
504 | fclose(file); | 526 | cpus = __pmu_cpumask(path); |
505 | return cpus; | 527 | cpu_map__put(cpus); |
528 | |||
529 | return !!cpus; | ||
506 | } | 530 | } |
507 | 531 | ||
508 | /* | 532 | /* |
@@ -617,6 +641,8 @@ static struct perf_pmu *pmu_lookup(const char *name) | |||
617 | 641 | ||
618 | pmu->cpus = pmu_cpumask(name); | 642 | pmu->cpus = pmu_cpumask(name); |
619 | 643 | ||
644 | pmu->is_uncore = pmu_is_uncore(name); | ||
645 | |||
620 | INIT_LIST_HEAD(&pmu->format); | 646 | INIT_LIST_HEAD(&pmu->format); |
621 | INIT_LIST_HEAD(&pmu->aliases); | 647 | INIT_LIST_HEAD(&pmu->aliases); |
622 | list_splice(&format, &pmu->format); | 648 | list_splice(&format, &pmu->format); |
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 389e9729331f..fe0de0502ce2 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h | |||
@@ -22,6 +22,7 @@ struct perf_pmu { | |||
22 | char *name; | 22 | char *name; |
23 | __u32 type; | 23 | __u32 type; |
24 | bool selectable; | 24 | bool selectable; |
25 | bool is_uncore; | ||
25 | struct perf_event_attr *default_config; | 26 | struct perf_event_attr *default_config; |
26 | struct cpu_map *cpus; | 27 | struct cpu_map *cpus; |
27 | struct list_head format; /* HEAD struct perf_pmu_format -> list */ | 28 | struct list_head format; /* HEAD struct perf_pmu_format -> list */ |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index a7ebd9fe8e40..76ab0709a20c 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -374,6 +374,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool) | |||
374 | tool->mmap2 = process_event_stub; | 374 | tool->mmap2 = process_event_stub; |
375 | if (tool->comm == NULL) | 375 | if (tool->comm == NULL) |
376 | tool->comm = process_event_stub; | 376 | tool->comm = process_event_stub; |
377 | if (tool->namespaces == NULL) | ||
378 | tool->namespaces = process_event_stub; | ||
377 | if (tool->fork == NULL) | 379 | if (tool->fork == NULL) |
378 | tool->fork = process_event_stub; | 380 | tool->fork = process_event_stub; |
379 | if (tool->exit == NULL) | 381 | if (tool->exit == NULL) |
diff --git a/tools/perf/util/xyarray.h b/tools/perf/util/xyarray.h index 4ba726c90870..54af60462130 100644 --- a/tools/perf/util/xyarray.h +++ b/tools/perf/util/xyarray.h | |||
@@ -23,12 +23,12 @@ static inline void *xyarray__entry(struct xyarray *xy, int x, int y) | |||
23 | 23 | ||
24 | static inline int xyarray__max_y(struct xyarray *xy) | 24 | static inline int xyarray__max_y(struct xyarray *xy) |
25 | { | 25 | { |
26 | return xy->max_x; | 26 | return xy->max_y; |
27 | } | 27 | } |
28 | 28 | ||
29 | static inline int xyarray__max_x(struct xyarray *xy) | 29 | static inline int xyarray__max_x(struct xyarray *xy) |
30 | { | 30 | { |
31 | return xy->max_y; | 31 | return xy->max_x; |
32 | } | 32 | } |
33 | 33 | ||
34 | #endif /* _PERF_XYARRAY_H_ */ | 34 | #endif /* _PERF_XYARRAY_H_ */ |