diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-10-10 13:29:49 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-10-14 16:32:53 -0400 |
commit | 1aaf63b1ee912abd7675681f9d6ffaaf2ffc0451 (patch) | |
tree | 65e3dc7602b1437498e02d237c0c53576db225da /tools/perf/util/evlist.c | |
parent | 641556c98c821922a9a2121247b5fa25e4407d11 (diff) |
perf evlist: Check that there is a thread_map when preparing a workload
The perf_evlist__prepare_workload expects a thread map to be in place
so that it can store the pid of the workload being started, so check it
and tell the developer about it instead of segfaulting.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-jvlz2f264e7kpmhjmwltikqw@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/evlist.c')
-rw-r--r-- | tools/perf/util/evlist.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 3cebc9a8d52e..5fc7bd42c803 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -1276,8 +1276,14 @@ int perf_evlist__prepare_workload(struct perf_evlist *evlist, struct target *tar | |||
1276 | sigaction(SIGUSR1, &act, NULL); | 1276 | sigaction(SIGUSR1, &act, NULL); |
1277 | } | 1277 | } |
1278 | 1278 | ||
1279 | if (target__none(target)) | 1279 | if (target__none(target)) { |
1280 | if (evlist->threads == NULL) { | ||
1281 | fprintf(stderr, "FATAL: evlist->threads need to be set at this point (%s:%d).\n", | ||
1282 | __func__, __LINE__); | ||
1283 | goto out_close_pipes; | ||
1284 | } | ||
1280 | evlist->threads->map[0] = evlist->workload.pid; | 1285 | evlist->threads->map[0] = evlist->workload.pid; |
1286 | } | ||
1281 | 1287 | ||
1282 | close(child_ready_pipe[1]); | 1288 | close(child_ready_pipe[1]); |
1283 | close(go_pipe[0]); | 1289 | close(go_pipe[0]); |