diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index ce6f51162386..f079b2e808be 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1013,6 +1013,7 @@ static struct machine * union perf_event *event) { const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; + struct machine *machine; if (perf_guest && ((cpumode == PERF_RECORD_MISC_GUEST_KERNEL) || @@ -1024,7 +1025,11 @@ static struct machine * else pid = event->ip.pid; - return perf_session__findnew_machine(session, pid); + machine = perf_session__find_machine(session, pid); + if (!machine) + machine = perf_session__findnew_machine(session, + DEFAULT_GUEST_KERNEL_ID); + return machine; } return perf_session__find_host_machine(session);