diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-17 13:37:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-17 13:37:46 -0400 |
commit | a706797febf4ff60ad61f855a01707be9fc3cf4c (patch) | |
tree | 3046e1dfb6d0c7b1214421ae19018f116da105e8 /tools | |
parent | 9786cff38a31c452e32fd2f9a479dd7d19d91712 (diff) | |
parent | f6cf87f748ff9480f97ff9c5caf6d6faacf52aa1 (diff) |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo MOlnar:
"Mostly tooling fixes, but also two x86 PMU driver fixes"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf tests: Fix software clock events test setting maps
perf tests: Fix task exit test setting maps
perf evlist: Fix create_syswide_maps() not propagating maps
perf evlist: Fix add() not propagating maps
perf evlist: Factor out a function to propagate maps for a single evsel
perf evlist: Make create_maps() use set_maps()
perf evlist: Make set_maps() more resilient
perf evsel: Add own_cpus member
perf evlist: Fix missing thread_map__put in propagate_maps()
perf evlist: Fix splice_list_tail() not setting evlist
perf evlist: Add has_user_cpus member
perf evlist: Remove redundant validation from propagate_maps()
perf evlist: Simplify set_maps() logic
perf evlist: Simplify propagate_maps() logic
perf top: Fix segfault pressing -> with no hist entries
perf header: Fixup reading of HEADER_NRCPUS feature
perf/x86/intel: Fix constraint access
perf/x86/intel/bts: Set event->hw.itrace_started in pmu::start to match the new logic
perf tools: Fix use of wrong event when processing exit events
perf tools: Fix parse_events_add_pmu caller
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-script.c | 4 | ||||
-rw-r--r-- | tools/perf/tests/sw-clock.c | 18 | ||||
-rw-r--r-- | tools/perf/tests/task-exit.c | 18 | ||||
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 12 | ||||
-rw-r--r-- | tools/perf/util/evlist.c | 138 | ||||
-rw-r--r-- | tools/perf/util/evlist.h | 9 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 1 | ||||
-rw-r--r-- | tools/perf/util/evsel.h | 1 | ||||
-rw-r--r-- | tools/perf/util/header.c | 4 | ||||
-rw-r--r-- | tools/perf/util/intel-bts.c | 2 | ||||
-rw-r--r-- | tools/perf/util/intel-pt.c | 2 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 7 | ||||
-rw-r--r-- | tools/perf/util/parse-events.y | 2 |
13 files changed, 131 insertions, 87 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index eb51325e8ad9..284a76e04628 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -768,8 +768,8 @@ static int process_exit_event(struct perf_tool *tool, | |||
768 | if (!evsel->attr.sample_id_all) { | 768 | if (!evsel->attr.sample_id_all) { |
769 | sample->cpu = 0; | 769 | sample->cpu = 0; |
770 | sample->time = 0; | 770 | sample->time = 0; |
771 | sample->tid = event->comm.tid; | 771 | sample->tid = event->fork.tid; |
772 | sample->pid = event->comm.pid; | 772 | sample->pid = event->fork.pid; |
773 | } | 773 | } |
774 | print_sample_start(sample, thread, evsel); | 774 | print_sample_start(sample, thread, evsel); |
775 | perf_event__fprintf(event, stdout); | 775 | perf_event__fprintf(event, stdout); |
diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c index 1aa21c90731b..5b83f56a3b6f 100644 --- a/tools/perf/tests/sw-clock.c +++ b/tools/perf/tests/sw-clock.c | |||
@@ -34,6 +34,8 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) | |||
34 | .disabled = 1, | 34 | .disabled = 1, |
35 | .freq = 1, | 35 | .freq = 1, |
36 | }; | 36 | }; |
37 | struct cpu_map *cpus; | ||
38 | struct thread_map *threads; | ||
37 | 39 | ||
38 | attr.sample_freq = 500; | 40 | attr.sample_freq = 500; |
39 | 41 | ||
@@ -50,14 +52,19 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) | |||
50 | } | 52 | } |
51 | perf_evlist__add(evlist, evsel); | 53 | perf_evlist__add(evlist, evsel); |
52 | 54 | ||
53 | evlist->cpus = cpu_map__dummy_new(); | 55 | cpus = cpu_map__dummy_new(); |
54 | evlist->threads = thread_map__new_by_tid(getpid()); | 56 | threads = thread_map__new_by_tid(getpid()); |
55 | if (!evlist->cpus || !evlist->threads) { | 57 | if (!cpus || !threads) { |
56 | err = -ENOMEM; | 58 | err = -ENOMEM; |
57 | pr_debug("Not enough memory to create thread/cpu maps\n"); | 59 | pr_debug("Not enough memory to create thread/cpu maps\n"); |
58 | goto out_delete_evlist; | 60 | goto out_free_maps; |
59 | } | 61 | } |
60 | 62 | ||
63 | perf_evlist__set_maps(evlist, cpus, threads); | ||
64 | |||
65 | cpus = NULL; | ||
66 | threads = NULL; | ||
67 | |||
61 | if (perf_evlist__open(evlist)) { | 68 | if (perf_evlist__open(evlist)) { |
62 | const char *knob = "/proc/sys/kernel/perf_event_max_sample_rate"; | 69 | const char *knob = "/proc/sys/kernel/perf_event_max_sample_rate"; |
63 | 70 | ||
@@ -107,6 +114,9 @@ next_event: | |||
107 | err = -1; | 114 | err = -1; |
108 | } | 115 | } |
109 | 116 | ||
117 | out_free_maps: | ||
118 | cpu_map__put(cpus); | ||
119 | thread_map__put(threads); | ||
110 | out_delete_evlist: | 120 | out_delete_evlist: |
111 | perf_evlist__delete(evlist); | 121 | perf_evlist__delete(evlist); |
112 | return err; | 122 | return err; |
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index 3a8fedef83bc..add16385f13e 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c | |||
@@ -43,6 +43,8 @@ int test__task_exit(void) | |||
43 | }; | 43 | }; |
44 | const char *argv[] = { "true", NULL }; | 44 | const char *argv[] = { "true", NULL }; |
45 | char sbuf[STRERR_BUFSIZE]; | 45 | char sbuf[STRERR_BUFSIZE]; |
46 | struct cpu_map *cpus; | ||
47 | struct thread_map *threads; | ||
46 | 48 | ||
47 | signal(SIGCHLD, sig_handler); | 49 | signal(SIGCHLD, sig_handler); |
48 | 50 | ||
@@ -58,14 +60,19 @@ int test__task_exit(void) | |||
58 | * perf_evlist__prepare_workload we'll fill in the only thread | 60 | * perf_evlist__prepare_workload we'll fill in the only thread |
59 | * we're monitoring, the one forked there. | 61 | * we're monitoring, the one forked there. |
60 | */ | 62 | */ |
61 | evlist->cpus = cpu_map__dummy_new(); | 63 | cpus = cpu_map__dummy_new(); |
62 | evlist->threads = thread_map__new_by_tid(-1); | 64 | threads = thread_map__new_by_tid(-1); |
63 | if (!evlist->cpus || !evlist->threads) { | 65 | if (!cpus || !threads) { |
64 | err = -ENOMEM; | 66 | err = -ENOMEM; |
65 | pr_debug("Not enough memory to create thread/cpu maps\n"); | 67 | pr_debug("Not enough memory to create thread/cpu maps\n"); |
66 | goto out_delete_evlist; | 68 | goto out_free_maps; |
67 | } | 69 | } |
68 | 70 | ||
71 | perf_evlist__set_maps(evlist, cpus, threads); | ||
72 | |||
73 | cpus = NULL; | ||
74 | threads = NULL; | ||
75 | |||
69 | err = perf_evlist__prepare_workload(evlist, &target, argv, false, | 76 | err = perf_evlist__prepare_workload(evlist, &target, argv, false, |
70 | workload_exec_failed_signal); | 77 | workload_exec_failed_signal); |
71 | if (err < 0) { | 78 | if (err < 0) { |
@@ -114,6 +121,9 @@ retry: | |||
114 | err = -1; | 121 | err = -1; |
115 | } | 122 | } |
116 | 123 | ||
124 | out_free_maps: | ||
125 | cpu_map__put(cpus); | ||
126 | thread_map__put(threads); | ||
117 | out_delete_evlist: | 127 | out_delete_evlist: |
118 | perf_evlist__delete(evlist); | 128 | perf_evlist__delete(evlist); |
119 | return err; | 129 | return err; |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index cf86f2d3a5e7..c04c60d4863c 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -1968,7 +1968,8 @@ skip_annotation: | |||
1968 | &options[nr_options], dso); | 1968 | &options[nr_options], dso); |
1969 | nr_options += add_map_opt(browser, &actions[nr_options], | 1969 | nr_options += add_map_opt(browser, &actions[nr_options], |
1970 | &options[nr_options], | 1970 | &options[nr_options], |
1971 | browser->selection->map); | 1971 | browser->selection ? |
1972 | browser->selection->map : NULL); | ||
1972 | 1973 | ||
1973 | /* perf script support */ | 1974 | /* perf script support */ |
1974 | if (browser->he_selection) { | 1975 | if (browser->he_selection) { |
@@ -1976,6 +1977,15 @@ skip_annotation: | |||
1976 | &actions[nr_options], | 1977 | &actions[nr_options], |
1977 | &options[nr_options], | 1978 | &options[nr_options], |
1978 | thread, NULL); | 1979 | thread, NULL); |
1980 | /* | ||
1981 | * Note that browser->selection != NULL | ||
1982 | * when browser->he_selection is not NULL, | ||
1983 | * so we don't need to check browser->selection | ||
1984 | * before fetching browser->selection->sym like what | ||
1985 | * we do before fetching browser->selection->map. | ||
1986 | * | ||
1987 | * See hist_browser__show_entry. | ||
1988 | */ | ||
1979 | nr_options += add_script_opt(browser, | 1989 | nr_options += add_script_opt(browser, |
1980 | &actions[nr_options], | 1990 | &actions[nr_options], |
1981 | &options[nr_options], | 1991 | &options[nr_options], |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index d51a5200c8af..c8fc8a258f42 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -124,6 +124,33 @@ void perf_evlist__delete(struct perf_evlist *evlist) | |||
124 | free(evlist); | 124 | free(evlist); |
125 | } | 125 | } |
126 | 126 | ||
127 | static void __perf_evlist__propagate_maps(struct perf_evlist *evlist, | ||
128 | struct perf_evsel *evsel) | ||
129 | { | ||
130 | /* | ||
131 | * We already have cpus for evsel (via PMU sysfs) so | ||
132 | * keep it, if there's no target cpu list defined. | ||
133 | */ | ||
134 | if (!evsel->own_cpus || evlist->has_user_cpus) { | ||
135 | cpu_map__put(evsel->cpus); | ||
136 | evsel->cpus = cpu_map__get(evlist->cpus); | ||
137 | } else if (evsel->cpus != evsel->own_cpus) { | ||
138 | cpu_map__put(evsel->cpus); | ||
139 | evsel->cpus = cpu_map__get(evsel->own_cpus); | ||
140 | } | ||
141 | |||
142 | thread_map__put(evsel->threads); | ||
143 | evsel->threads = thread_map__get(evlist->threads); | ||
144 | } | ||
145 | |||
146 | static void perf_evlist__propagate_maps(struct perf_evlist *evlist) | ||
147 | { | ||
148 | struct perf_evsel *evsel; | ||
149 | |||
150 | evlist__for_each(evlist, evsel) | ||
151 | __perf_evlist__propagate_maps(evlist, evsel); | ||
152 | } | ||
153 | |||
127 | void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry) | 154 | void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry) |
128 | { | 155 | { |
129 | entry->evlist = evlist; | 156 | entry->evlist = evlist; |
@@ -133,18 +160,19 @@ void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry) | |||
133 | 160 | ||
134 | if (!evlist->nr_entries++) | 161 | if (!evlist->nr_entries++) |
135 | perf_evlist__set_id_pos(evlist); | 162 | perf_evlist__set_id_pos(evlist); |
163 | |||
164 | __perf_evlist__propagate_maps(evlist, entry); | ||
136 | } | 165 | } |
137 | 166 | ||
138 | void perf_evlist__splice_list_tail(struct perf_evlist *evlist, | 167 | void perf_evlist__splice_list_tail(struct perf_evlist *evlist, |
139 | struct list_head *list, | 168 | struct list_head *list) |
140 | int nr_entries) | ||
141 | { | 169 | { |
142 | bool set_id_pos = !evlist->nr_entries; | 170 | struct perf_evsel *evsel, *temp; |
143 | 171 | ||
144 | list_splice_tail(list, &evlist->entries); | 172 | __evlist__for_each_safe(list, temp, evsel) { |
145 | evlist->nr_entries += nr_entries; | 173 | list_del_init(&evsel->node); |
146 | if (set_id_pos) | 174 | perf_evlist__add(evlist, evsel); |
147 | perf_evlist__set_id_pos(evlist); | 175 | } |
148 | } | 176 | } |
149 | 177 | ||
150 | void __perf_evlist__set_leader(struct list_head *list) | 178 | void __perf_evlist__set_leader(struct list_head *list) |
@@ -210,7 +238,7 @@ static int perf_evlist__add_attrs(struct perf_evlist *evlist, | |||
210 | list_add_tail(&evsel->node, &head); | 238 | list_add_tail(&evsel->node, &head); |
211 | } | 239 | } |
212 | 240 | ||
213 | perf_evlist__splice_list_tail(evlist, &head, nr_attrs); | 241 | perf_evlist__splice_list_tail(evlist, &head); |
214 | 242 | ||
215 | return 0; | 243 | return 0; |
216 | 244 | ||
@@ -1103,71 +1131,56 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages, | |||
1103 | return perf_evlist__mmap_ex(evlist, pages, overwrite, 0, false); | 1131 | return perf_evlist__mmap_ex(evlist, pages, overwrite, 0, false); |
1104 | } | 1132 | } |
1105 | 1133 | ||
1106 | static int perf_evlist__propagate_maps(struct perf_evlist *evlist, | ||
1107 | bool has_user_cpus) | ||
1108 | { | ||
1109 | struct perf_evsel *evsel; | ||
1110 | |||
1111 | evlist__for_each(evlist, evsel) { | ||
1112 | /* | ||
1113 | * We already have cpus for evsel (via PMU sysfs) so | ||
1114 | * keep it, if there's no target cpu list defined. | ||
1115 | */ | ||
1116 | if (evsel->cpus && has_user_cpus) | ||
1117 | cpu_map__put(evsel->cpus); | ||
1118 | |||
1119 | if (!evsel->cpus || has_user_cpus) | ||
1120 | evsel->cpus = cpu_map__get(evlist->cpus); | ||
1121 | |||
1122 | evsel->threads = thread_map__get(evlist->threads); | ||
1123 | |||
1124 | if ((evlist->cpus && !evsel->cpus) || | ||
1125 | (evlist->threads && !evsel->threads)) | ||
1126 | return -ENOMEM; | ||
1127 | } | ||
1128 | |||
1129 | return 0; | ||
1130 | } | ||
1131 | |||
1132 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) | 1134 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) |
1133 | { | 1135 | { |
1134 | evlist->threads = thread_map__new_str(target->pid, target->tid, | 1136 | struct cpu_map *cpus; |
1135 | target->uid); | 1137 | struct thread_map *threads; |
1138 | |||
1139 | threads = thread_map__new_str(target->pid, target->tid, target->uid); | ||
1136 | 1140 | ||
1137 | if (evlist->threads == NULL) | 1141 | if (!threads) |
1138 | return -1; | 1142 | return -1; |
1139 | 1143 | ||
1140 | if (target__uses_dummy_map(target)) | 1144 | if (target__uses_dummy_map(target)) |
1141 | evlist->cpus = cpu_map__dummy_new(); | 1145 | cpus = cpu_map__dummy_new(); |
1142 | else | 1146 | else |
1143 | evlist->cpus = cpu_map__new(target->cpu_list); | 1147 | cpus = cpu_map__new(target->cpu_list); |
1144 | 1148 | ||
1145 | if (evlist->cpus == NULL) | 1149 | if (!cpus) |
1146 | goto out_delete_threads; | 1150 | goto out_delete_threads; |
1147 | 1151 | ||
1148 | return perf_evlist__propagate_maps(evlist, !!target->cpu_list); | 1152 | evlist->has_user_cpus = !!target->cpu_list; |
1153 | |||
1154 | perf_evlist__set_maps(evlist, cpus, threads); | ||
1155 | |||
1156 | return 0; | ||
1149 | 1157 | ||
1150 | out_delete_threads: | 1158 | out_delete_threads: |
1151 | thread_map__put(evlist->threads); | 1159 | thread_map__put(threads); |
1152 | evlist->threads = NULL; | ||
1153 | return -1; | 1160 | return -1; |
1154 | } | 1161 | } |
1155 | 1162 | ||
1156 | int perf_evlist__set_maps(struct perf_evlist *evlist, | 1163 | void perf_evlist__set_maps(struct perf_evlist *evlist, struct cpu_map *cpus, |
1157 | struct cpu_map *cpus, | 1164 | struct thread_map *threads) |
1158 | struct thread_map *threads) | ||
1159 | { | 1165 | { |
1160 | if (evlist->cpus) | 1166 | /* |
1167 | * Allow for the possibility that one or another of the maps isn't being | ||
1168 | * changed i.e. don't put it. Note we are assuming the maps that are | ||
1169 | * being applied are brand new and evlist is taking ownership of the | ||
1170 | * original reference count of 1. If that is not the case it is up to | ||
1171 | * the caller to increase the reference count. | ||
1172 | */ | ||
1173 | if (cpus != evlist->cpus) { | ||
1161 | cpu_map__put(evlist->cpus); | 1174 | cpu_map__put(evlist->cpus); |
1175 | evlist->cpus = cpus; | ||
1176 | } | ||
1162 | 1177 | ||
1163 | evlist->cpus = cpus; | 1178 | if (threads != evlist->threads) { |
1164 | |||
1165 | if (evlist->threads) | ||
1166 | thread_map__put(evlist->threads); | 1179 | thread_map__put(evlist->threads); |
1180 | evlist->threads = threads; | ||
1181 | } | ||
1167 | 1182 | ||
1168 | evlist->threads = threads; | 1183 | perf_evlist__propagate_maps(evlist); |
1169 | |||
1170 | return perf_evlist__propagate_maps(evlist, false); | ||
1171 | } | 1184 | } |
1172 | 1185 | ||
1173 | int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel) | 1186 | int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel) |
@@ -1387,6 +1400,8 @@ void perf_evlist__close(struct perf_evlist *evlist) | |||
1387 | 1400 | ||
1388 | static int perf_evlist__create_syswide_maps(struct perf_evlist *evlist) | 1401 | static int perf_evlist__create_syswide_maps(struct perf_evlist *evlist) |
1389 | { | 1402 | { |
1403 | struct cpu_map *cpus; | ||
1404 | struct thread_map *threads; | ||
1390 | int err = -ENOMEM; | 1405 | int err = -ENOMEM; |
1391 | 1406 | ||
1392 | /* | 1407 | /* |
@@ -1398,20 +1413,19 @@ static int perf_evlist__create_syswide_maps(struct perf_evlist *evlist) | |||
1398 | * error, and we may not want to do that fallback to a | 1413 | * error, and we may not want to do that fallback to a |
1399 | * default cpu identity map :-\ | 1414 | * default cpu identity map :-\ |
1400 | */ | 1415 | */ |
1401 | evlist->cpus = cpu_map__new(NULL); | 1416 | cpus = cpu_map__new(NULL); |
1402 | if (evlist->cpus == NULL) | 1417 | if (!cpus) |
1403 | goto out; | 1418 | goto out; |
1404 | 1419 | ||
1405 | evlist->threads = thread_map__new_dummy(); | 1420 | threads = thread_map__new_dummy(); |
1406 | if (evlist->threads == NULL) | 1421 | if (!threads) |
1407 | goto out_free_cpus; | 1422 | goto out_put; |
1408 | 1423 | ||
1409 | err = 0; | 1424 | perf_evlist__set_maps(evlist, cpus, threads); |
1410 | out: | 1425 | out: |
1411 | return err; | 1426 | return err; |
1412 | out_free_cpus: | 1427 | out_put: |
1413 | cpu_map__put(evlist->cpus); | 1428 | cpu_map__put(cpus); |
1414 | evlist->cpus = NULL; | ||
1415 | goto out; | 1429 | goto out; |
1416 | } | 1430 | } |
1417 | 1431 | ||
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index b39a6198f4ac..115d8b53c601 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -42,6 +42,7 @@ struct perf_evlist { | |||
42 | int nr_mmaps; | 42 | int nr_mmaps; |
43 | bool overwrite; | 43 | bool overwrite; |
44 | bool enabled; | 44 | bool enabled; |
45 | bool has_user_cpus; | ||
45 | size_t mmap_len; | 46 | size_t mmap_len; |
46 | int id_pos; | 47 | int id_pos; |
47 | int is_pos; | 48 | int is_pos; |
@@ -155,9 +156,8 @@ int perf_evlist__enable_event_idx(struct perf_evlist *evlist, | |||
155 | void perf_evlist__set_selected(struct perf_evlist *evlist, | 156 | void perf_evlist__set_selected(struct perf_evlist *evlist, |
156 | struct perf_evsel *evsel); | 157 | struct perf_evsel *evsel); |
157 | 158 | ||
158 | int perf_evlist__set_maps(struct perf_evlist *evlist, | 159 | void perf_evlist__set_maps(struct perf_evlist *evlist, struct cpu_map *cpus, |
159 | struct cpu_map *cpus, | 160 | struct thread_map *threads); |
160 | struct thread_map *threads); | ||
161 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target); | 161 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target); |
162 | int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel); | 162 | int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel); |
163 | 163 | ||
@@ -179,8 +179,7 @@ bool perf_evlist__valid_sample_id_all(struct perf_evlist *evlist); | |||
179 | bool perf_evlist__valid_read_format(struct perf_evlist *evlist); | 179 | bool perf_evlist__valid_read_format(struct perf_evlist *evlist); |
180 | 180 | ||
181 | void perf_evlist__splice_list_tail(struct perf_evlist *evlist, | 181 | void perf_evlist__splice_list_tail(struct perf_evlist *evlist, |
182 | struct list_head *list, | 182 | struct list_head *list); |
183 | int nr_entries); | ||
184 | 183 | ||
185 | static inline struct perf_evsel *perf_evlist__first(struct perf_evlist *evlist) | 184 | static inline struct perf_evsel *perf_evlist__first(struct perf_evlist *evlist) |
186 | { | 185 | { |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index c53f79123b37..5410483d5219 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -1033,6 +1033,7 @@ void perf_evsel__exit(struct perf_evsel *evsel) | |||
1033 | perf_evsel__free_config_terms(evsel); | 1033 | perf_evsel__free_config_terms(evsel); |
1034 | close_cgroup(evsel->cgrp); | 1034 | close_cgroup(evsel->cgrp); |
1035 | cpu_map__put(evsel->cpus); | 1035 | cpu_map__put(evsel->cpus); |
1036 | cpu_map__put(evsel->own_cpus); | ||
1036 | thread_map__put(evsel->threads); | 1037 | thread_map__put(evsel->threads); |
1037 | zfree(&evsel->group_name); | 1038 | zfree(&evsel->group_name); |
1038 | zfree(&evsel->name); | 1039 | zfree(&evsel->name); |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 298e6bbca200..ef8925f7211a 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -98,6 +98,7 @@ struct perf_evsel { | |||
98 | struct cgroup_sel *cgrp; | 98 | struct cgroup_sel *cgrp; |
99 | void *handler; | 99 | void *handler; |
100 | struct cpu_map *cpus; | 100 | struct cpu_map *cpus; |
101 | struct cpu_map *own_cpus; | ||
101 | struct thread_map *threads; | 102 | struct thread_map *threads; |
102 | unsigned int sample_size; | 103 | unsigned int sample_size; |
103 | int id_pos; | 104 | int id_pos; |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 41814547da15..fce6634aebe2 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -1438,7 +1438,7 @@ static int process_nrcpus(struct perf_file_section *section __maybe_unused, | |||
1438 | if (ph->needs_swap) | 1438 | if (ph->needs_swap) |
1439 | nr = bswap_32(nr); | 1439 | nr = bswap_32(nr); |
1440 | 1440 | ||
1441 | ph->env.nr_cpus_online = nr; | 1441 | ph->env.nr_cpus_avail = nr; |
1442 | 1442 | ||
1443 | ret = readn(fd, &nr, sizeof(nr)); | 1443 | ret = readn(fd, &nr, sizeof(nr)); |
1444 | if (ret != sizeof(nr)) | 1444 | if (ret != sizeof(nr)) |
@@ -1447,7 +1447,7 @@ static int process_nrcpus(struct perf_file_section *section __maybe_unused, | |||
1447 | if (ph->needs_swap) | 1447 | if (ph->needs_swap) |
1448 | nr = bswap_32(nr); | 1448 | nr = bswap_32(nr); |
1449 | 1449 | ||
1450 | ph->env.nr_cpus_avail = nr; | 1450 | ph->env.nr_cpus_online = nr; |
1451 | return 0; | 1451 | return 0; |
1452 | } | 1452 | } |
1453 | 1453 | ||
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c index ea768625ab5b..eb0e7f8bf515 100644 --- a/tools/perf/util/intel-bts.c +++ b/tools/perf/util/intel-bts.c | |||
@@ -623,7 +623,7 @@ static int intel_bts_process_event(struct perf_session *session, | |||
623 | if (err) | 623 | if (err) |
624 | return err; | 624 | return err; |
625 | if (event->header.type == PERF_RECORD_EXIT) { | 625 | if (event->header.type == PERF_RECORD_EXIT) { |
626 | err = intel_bts_process_tid_exit(bts, event->comm.tid); | 626 | err = intel_bts_process_tid_exit(bts, event->fork.tid); |
627 | if (err) | 627 | if (err) |
628 | return err; | 628 | return err; |
629 | } | 629 | } |
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c index bb41c20e6005..535d86f8e4d1 100644 --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c | |||
@@ -1494,7 +1494,7 @@ static int intel_pt_process_event(struct perf_session *session, | |||
1494 | if (pt->timeless_decoding) { | 1494 | if (pt->timeless_decoding) { |
1495 | if (event->header.type == PERF_RECORD_EXIT) { | 1495 | if (event->header.type == PERF_RECORD_EXIT) { |
1496 | err = intel_pt_process_timeless_queues(pt, | 1496 | err = intel_pt_process_timeless_queues(pt, |
1497 | event->comm.tid, | 1497 | event->fork.tid, |
1498 | sample->time); | 1498 | sample->time); |
1499 | } | 1499 | } |
1500 | } else if (timestamp) { | 1500 | } else if (timestamp) { |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index d826e6f515db..21ed6ee63da9 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -287,8 +287,8 @@ __add_event(struct list_head *list, int *idx, | |||
287 | if (!evsel) | 287 | if (!evsel) |
288 | return NULL; | 288 | return NULL; |
289 | 289 | ||
290 | if (cpus) | 290 | evsel->cpus = cpu_map__get(cpus); |
291 | evsel->cpus = cpu_map__get(cpus); | 291 | evsel->own_cpus = cpu_map__get(cpus); |
292 | 292 | ||
293 | if (name) | 293 | if (name) |
294 | evsel->name = strdup(name); | 294 | evsel->name = strdup(name); |
@@ -1140,10 +1140,9 @@ int parse_events(struct perf_evlist *evlist, const char *str, | |||
1140 | ret = parse_events__scanner(str, &data, PE_START_EVENTS); | 1140 | ret = parse_events__scanner(str, &data, PE_START_EVENTS); |
1141 | perf_pmu__parse_cleanup(); | 1141 | perf_pmu__parse_cleanup(); |
1142 | if (!ret) { | 1142 | if (!ret) { |
1143 | int entries = data.idx - evlist->nr_entries; | ||
1144 | struct perf_evsel *last; | 1143 | struct perf_evsel *last; |
1145 | 1144 | ||
1146 | perf_evlist__splice_list_tail(evlist, &data.list, entries); | 1145 | perf_evlist__splice_list_tail(evlist, &data.list); |
1147 | evlist->nr_groups += data.nr_groups; | 1146 | evlist->nr_groups += data.nr_groups; |
1148 | last = perf_evlist__last(evlist); | 1147 | last = perf_evlist__last(evlist); |
1149 | last->cmdline_group_boundary = true; | 1148 | last->cmdline_group_boundary = true; |
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index 591905a02b92..9cd70819c795 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y | |||
@@ -255,7 +255,7 @@ PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc | |||
255 | list_add_tail(&term->list, head); | 255 | list_add_tail(&term->list, head); |
256 | 256 | ||
257 | ALLOC_LIST(list); | 257 | ALLOC_LIST(list); |
258 | ABORT_ON(parse_events_add_pmu(list, &data->idx, "cpu", head)); | 258 | ABORT_ON(parse_events_add_pmu(data, list, "cpu", head)); |
259 | parse_events__free_terms(head); | 259 | parse_events__free_terms(head); |
260 | $$ = list; | 260 | $$ = list; |
261 | } | 261 | } |