Skip to contentSkip to conversation

perf record: Don' t pass host machine to guest synthesizer

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Jan 25, 2013 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  7e383de42565ecb2cf641fff11946f9bc45e8235
Gitweb:     http://git.kernel.org/tip/7e383de42565ecb2cf641fff11946f9bc45e8235
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Tue, 18 Dec 2012 15:49:27 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 24 Jan 2013 16:40:11 -0300

perf record: Don't pass host machine to guest synthesizer

We were calling perf_session__process_machines(), that would first pass the struct machine associated with the host to the provided callback, perf_event__synthesize_guest_os() that would test if it was the host and if so wouldn't do anything.

Ditch this contraption, just call directly machines__process with the list of guests.

Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[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]>
---
 tools/perf/builtin-record.c | 11 ++++-------
 tools/perf/util/session.h   |  9 ---------
 2 files changed, 4 insertions(+), 16 deletions(-)
tools/perf/builtin-record.c +4 -7
index de60dd4..69e2895 100644
@@ -328,10 +328,6 @@ static void perf_event__synthesize_guest_os(struct machine *machine, void *data)
 {
 	int err;
 	struct perf_tool *tool = data;
-
-	if (machine__is_host(machine))
-		return;
-
 	/*
 	 *As for guest kernel when processing subcommand record&report,
 	 *we arrange module mmap prior to guest kernel mmap and trigger
@@ -574,9 +570,10 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
 		       "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
 		       "Check /proc/modules permission or run as root.\n");
 
-	if (perf_guest)
-		perf_session__process_machines(session, tool,
-					       perf_event__synthesize_guest_os);
+	if (perf_guest) {
+		machines__process(&session->machines,
+				  perf_event__synthesize_guest_os, tool);
+	}
 
 	if (!opts->target.system_wide)
 		err = perf_event__synthesize_thread_map(tool, evsel_list->threads,
tools/perf/util/session.h +0 -9
index 8c23025..426ca0c 100644
@@ -101,15 +101,6 @@ struct machine *perf_session__findnew_machine(struct perf_session *self, pid_t p
 	return machines__findnew(&self->machines, pid);
 }
 
-static inline
-void perf_session__process_machines(struct perf_session *self,
-				    struct perf_tool *tool,
-				    machine__process_t process)
-{
-	process(&self->host_machine, tool);
-	return machines__process(&self->machines, process, tool);
-}
-
 struct thread *perf_session__findnew(struct perf_session *self, pid_t pid);
 size_t perf_session__fprintf(struct perf_session *self, FILE *fp);