[PATCH 1/1] perf/tools: Fix "perf record -C... workload" behaviour

From: Oleg Nesterov
Date: Wed Feb 06 2013 - 14:44:19 EST


Test-case:

# perf record -e probe_libc:syscall -C0 true
true: Terminated

The child process is killed by perf_record__sig_exit(). This is because
perf_evlist__prepare_workload() doesn't initialize threads->map[] and
then perf_event__synthesize_mmap_events() (silently!) fails. This patch
seems to fix the problem, but perhaps we should also move
'pr_err("Couldn't run the workload!\n")' down to 'out_delete_session:',
so that the problems like this would be more understandable.

Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
---
tools/perf/util/evlist.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 7052934..8b3f6ef 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -783,7 +783,7 @@ int perf_evlist__prepare_workload(struct perf_evlist *evlist,
exit(-1);
}

- if (perf_target__none(&opts->target))
+ if (!perf_target__has_task(&opts->target))
evlist->threads->map[0] = evlist->workload.pid;

close(child_ready_pipe[1]);
--
1.5.5.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/