perf evlist: Check that there is a thread_map when preparing a workload
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: 1aaf63b1ee912abd7675681f9d6ffaaf2ffc0451 Gitweb: http://git.kernel.org/tip/1aaf63b1ee912abd7675681f9d6ffaaf2ffc0451 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Fri, 10 Oct 2014 14:29:49 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 14 Oct 2014 17:32:53 -0300
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 <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc David Ahern <[email protected]>
Cc Don Zickus <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Jean Pihet <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/util/evlist.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/perf/util/evlist.c +7 -1
@@ -1276,8 +1276,14 @@ int perf_evlist__prepare_workload(struct perf_evlist *evlist, struct target *tarsigaction (SIGUSR1 , &act,NULL ); } -if (target__none (target)) +if (target__none (target)) { +if (evlist->threads ==NULL ) { +fprintf (stderr,"FATAL: evlist->threads need to be set at this point (%s:%d).\n" , + __func__, __LINE__); + goto out_close_pipes; + } evlist->threads->map[0 ] = evlist->workload.pid; + }close (child_ready_pipe[1 ]);close (go_pipe[0 ]);