diff options
| author | H. Peter Anvin <hpa@linux.intel.com> | 2014-02-07 14:27:30 -0500 |
|---|---|---|
| committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-02-07 14:27:30 -0500 |
| commit | a3b072cd180c12e8fe0ece9487b9065808327640 (patch) | |
| tree | 62b982041be84748852d77cdf6ca5639ef40858f /tools/perf/util | |
| parent | 75a1ba5b2c529db60ca49626bcaf0bddf4548438 (diff) | |
| parent | 081cd62a010f97b5bc1d2b0cd123c5abc692b68a (diff) | |
Merge tag 'efi-urgent' into x86/urgent
* Avoid WARN_ON() when mapping BGRT on Baytrail (EFI 32-bit).
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'tools/perf/util')
| -rw-r--r-- | tools/perf/util/evlist.c | 7 | ||||
| -rw-r--r-- | tools/perf/util/evsel.c | 1 | ||||
| -rw-r--r-- | tools/perf/util/header.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/map.c | 7 | ||||
| -rw-r--r-- | tools/perf/util/parse-events.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/pmu.c | 24 | ||||
| -rw-r--r-- | tools/perf/util/pmu.h | 2 | ||||
| -rw-r--r-- | tools/perf/util/session.c | 10 |
8 files changed, 39 insertions, 16 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 40bd2c04df8a..59ef2802fcf6 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
| @@ -1003,9 +1003,12 @@ void perf_evlist__close(struct perf_evlist *evlist) | |||
| 1003 | struct perf_evsel *evsel; | 1003 | struct perf_evsel *evsel; |
| 1004 | int ncpus = cpu_map__nr(evlist->cpus); | 1004 | int ncpus = cpu_map__nr(evlist->cpus); |
| 1005 | int nthreads = thread_map__nr(evlist->threads); | 1005 | int nthreads = thread_map__nr(evlist->threads); |
| 1006 | int n; | ||
| 1006 | 1007 | ||
| 1007 | evlist__for_each_reverse(evlist, evsel) | 1008 | evlist__for_each_reverse(evlist, evsel) { |
| 1008 | perf_evsel__close(evsel, ncpus, nthreads); | 1009 | n = evsel->cpus ? evsel->cpus->nr : ncpus; |
| 1010 | perf_evsel__close(evsel, n, nthreads); | ||
| 1011 | } | ||
| 1009 | } | 1012 | } |
| 1010 | 1013 | ||
| 1011 | int perf_evlist__open(struct perf_evlist *evlist) | 1014 | int perf_evlist__open(struct perf_evlist *evlist) |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 22e18a26b7e6..55407c594b87 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
| @@ -1081,7 +1081,6 @@ void perf_evsel__close(struct perf_evsel *evsel, int ncpus, int nthreads) | |||
| 1081 | 1081 | ||
| 1082 | perf_evsel__close_fd(evsel, ncpus, nthreads); | 1082 | perf_evsel__close_fd(evsel, ncpus, nthreads); |
| 1083 | perf_evsel__free_fd(evsel); | 1083 | perf_evsel__free_fd(evsel); |
| 1084 | evsel->fd = NULL; | ||
| 1085 | } | 1084 | } |
| 1086 | 1085 | ||
| 1087 | static struct { | 1086 | static struct { |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index bb3e0ede6183..893f8e2df928 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
| @@ -930,7 +930,7 @@ static int write_topo_node(int fd, int node) | |||
| 930 | /* skip over invalid lines */ | 930 | /* skip over invalid lines */ |
| 931 | if (!strchr(buf, ':')) | 931 | if (!strchr(buf, ':')) |
| 932 | continue; | 932 | continue; |
| 933 | if (sscanf(buf, "%*s %*d %s %"PRIu64, field, &mem) != 2) | 933 | if (sscanf(buf, "%*s %*d %31s %"PRIu64, field, &mem) != 2) |
| 934 | goto done; | 934 | goto done; |
| 935 | if (!strcmp(field, "MemTotal:")) | 935 | if (!strcmp(field, "MemTotal:")) |
| 936 | mem_total = mem; | 936 | mem_total = mem; |
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 9b9bd719aa19..3b97513f0e77 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
| @@ -69,7 +69,7 @@ struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, | |||
| 69 | map->ino = ino; | 69 | map->ino = ino; |
| 70 | map->ino_generation = ino_gen; | 70 | map->ino_generation = ino_gen; |
| 71 | 71 | ||
| 72 | if (anon) { | 72 | if ((anon || no_dso) && type == MAP__FUNCTION) { |
| 73 | snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", pid); | 73 | snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", pid); |
| 74 | filename = newfilename; | 74 | filename = newfilename; |
| 75 | } | 75 | } |
| @@ -93,7 +93,7 @@ struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, | |||
| 93 | * functions still return NULL, and we avoid the | 93 | * functions still return NULL, and we avoid the |
| 94 | * unnecessary map__load warning. | 94 | * unnecessary map__load warning. |
| 95 | */ | 95 | */ |
| 96 | if (no_dso) | 96 | if (type != MAP__FUNCTION) |
| 97 | dso__set_loaded(dso, map->type); | 97 | dso__set_loaded(dso, map->type); |
| 98 | } | 98 | } |
| 99 | } | 99 | } |
| @@ -386,7 +386,8 @@ struct symbol *map_groups__find_symbol(struct map_groups *mg, | |||
| 386 | { | 386 | { |
| 387 | struct map *map = map_groups__find(mg, type, addr); | 387 | struct map *map = map_groups__find(mg, type, addr); |
| 388 | 388 | ||
| 389 | if (map != NULL) { | 389 | /* Ensure map is loaded before using map->map_ip */ |
| 390 | if (map != NULL && map__load(map, filter) >= 0) { | ||
| 390 | if (mapp != NULL) | 391 | if (mapp != NULL) |
| 391 | *mapp = map; | 392 | *mapp = map; |
| 392 | return map__find_symbol(map, map->map_ip(map, addr), filter); | 393 | return map__find_symbol(map, map->map_ip(map, addr), filter); |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index a7f1b6a91fdd..d248fca6d7ed 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
| @@ -635,7 +635,7 @@ int parse_events_add_pmu(struct list_head *list, int *idx, | |||
| 635 | struct perf_event_attr attr; | 635 | struct perf_event_attr attr; |
| 636 | struct perf_pmu *pmu; | 636 | struct perf_pmu *pmu; |
| 637 | struct perf_evsel *evsel; | 637 | struct perf_evsel *evsel; |
| 638 | char *unit; | 638 | const char *unit; |
| 639 | double scale; | 639 | double scale; |
| 640 | 640 | ||
| 641 | pmu = perf_pmu__find(name); | 641 | pmu = perf_pmu__find(name); |
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index d9cab4d27192..b752ecb40d86 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c | |||
| @@ -105,7 +105,7 @@ static int perf_pmu__parse_scale(struct perf_pmu_alias *alias, char *dir, char * | |||
| 105 | char scale[128]; | 105 | char scale[128]; |
| 106 | int fd, ret = -1; | 106 | int fd, ret = -1; |
| 107 | char path[PATH_MAX]; | 107 | char path[PATH_MAX]; |
| 108 | char *lc; | 108 | const char *lc; |
| 109 | 109 | ||
| 110 | snprintf(path, PATH_MAX, "%s/%s.scale", dir, name); | 110 | snprintf(path, PATH_MAX, "%s/%s.scale", dir, name); |
| 111 | 111 | ||
| @@ -609,7 +609,7 @@ static struct perf_pmu_alias *pmu_find_alias(struct perf_pmu *pmu, | |||
| 609 | 609 | ||
| 610 | 610 | ||
| 611 | static int check_unit_scale(struct perf_pmu_alias *alias, | 611 | static int check_unit_scale(struct perf_pmu_alias *alias, |
| 612 | char **unit, double *scale) | 612 | const char **unit, double *scale) |
| 613 | { | 613 | { |
| 614 | /* | 614 | /* |
| 615 | * Only one term in event definition can | 615 | * Only one term in event definition can |
| @@ -634,14 +634,18 @@ static int check_unit_scale(struct perf_pmu_alias *alias, | |||
| 634 | * defined for the alias | 634 | * defined for the alias |
| 635 | */ | 635 | */ |
| 636 | int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms, | 636 | int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms, |
| 637 | char **unit, double *scale) | 637 | const char **unit, double *scale) |
| 638 | { | 638 | { |
| 639 | struct parse_events_term *term, *h; | 639 | struct parse_events_term *term, *h; |
| 640 | struct perf_pmu_alias *alias; | 640 | struct perf_pmu_alias *alias; |
| 641 | int ret; | 641 | int ret; |
| 642 | 642 | ||
| 643 | /* | ||
| 644 | * Mark unit and scale as not set | ||
| 645 | * (different from default values, see below) | ||
| 646 | */ | ||
| 643 | *unit = NULL; | 647 | *unit = NULL; |
| 644 | *scale = 0; | 648 | *scale = 0.0; |
| 645 | 649 | ||
| 646 | list_for_each_entry_safe(term, h, head_terms, list) { | 650 | list_for_each_entry_safe(term, h, head_terms, list) { |
| 647 | alias = pmu_find_alias(pmu, term); | 651 | alias = pmu_find_alias(pmu, term); |
| @@ -658,6 +662,18 @@ int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms, | |||
| 658 | list_del(&term->list); | 662 | list_del(&term->list); |
| 659 | free(term); | 663 | free(term); |
| 660 | } | 664 | } |
| 665 | |||
| 666 | /* | ||
| 667 | * if no unit or scale foundin aliases, then | ||
| 668 | * set defaults as for evsel | ||
| 669 | * unit cannot left to NULL | ||
| 670 | */ | ||
| 671 | if (*unit == NULL) | ||
| 672 | *unit = ""; | ||
| 673 | |||
| 674 | if (*scale == 0.0) | ||
| 675 | *scale = 1.0; | ||
| 676 | |||
| 661 | return 0; | 677 | return 0; |
| 662 | } | 678 | } |
| 663 | 679 | ||
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 9183380e2038..8b64125a9281 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h | |||
| @@ -29,7 +29,7 @@ int perf_pmu__config_terms(struct list_head *formats, | |||
| 29 | struct perf_event_attr *attr, | 29 | struct perf_event_attr *attr, |
| 30 | struct list_head *head_terms); | 30 | struct list_head *head_terms); |
| 31 | int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms, | 31 | int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms, |
| 32 | char **unit, double *scale); | 32 | const char **unit, double *scale); |
| 33 | struct list_head *perf_pmu__alias(struct perf_pmu *pmu, | 33 | struct list_head *perf_pmu__alias(struct perf_pmu *pmu, |
| 34 | struct list_head *head_terms); | 34 | struct list_head *head_terms); |
| 35 | int perf_pmu_wrap(void); | 35 | int perf_pmu_wrap(void); |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 7acc03e8f3b2..0b39a48e5110 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
| @@ -1573,7 +1573,7 @@ next: | |||
| 1573 | int perf_session__cpu_bitmap(struct perf_session *session, | 1573 | int perf_session__cpu_bitmap(struct perf_session *session, |
| 1574 | const char *cpu_list, unsigned long *cpu_bitmap) | 1574 | const char *cpu_list, unsigned long *cpu_bitmap) |
| 1575 | { | 1575 | { |
| 1576 | int i; | 1576 | int i, err = -1; |
| 1577 | struct cpu_map *map; | 1577 | struct cpu_map *map; |
| 1578 | 1578 | ||
| 1579 | for (i = 0; i < PERF_TYPE_MAX; ++i) { | 1579 | for (i = 0; i < PERF_TYPE_MAX; ++i) { |
| @@ -1602,13 +1602,17 @@ int perf_session__cpu_bitmap(struct perf_session *session, | |||
| 1602 | if (cpu >= MAX_NR_CPUS) { | 1602 | if (cpu >= MAX_NR_CPUS) { |
| 1603 | pr_err("Requested CPU %d too large. " | 1603 | pr_err("Requested CPU %d too large. " |
| 1604 | "Consider raising MAX_NR_CPUS\n", cpu); | 1604 | "Consider raising MAX_NR_CPUS\n", cpu); |
| 1605 | return -1; | 1605 | goto out_delete_map; |
| 1606 | } | 1606 | } |
| 1607 | 1607 | ||
| 1608 | set_bit(cpu, cpu_bitmap); | 1608 | set_bit(cpu, cpu_bitmap); |
| 1609 | } | 1609 | } |
| 1610 | 1610 | ||
| 1611 | return 0; | 1611 | err = 0; |
| 1612 | |||
| 1613 | out_delete_map: | ||
| 1614 | cpu_map__delete(map); | ||
| 1615 | return err; | ||
| 1612 | } | 1616 | } |
| 1613 | 1617 | ||
| 1614 | void perf_session__fprintf_info(struct perf_session *session, FILE *fp, | 1618 | void perf_session__fprintf_info(struct perf_session *session, FILE *fp, |
