From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752096AbaALShn (ORCPT ); Sun, 12 Jan 2014 13:37:43 -0500 Received: from terminus.zytor.com ([198.137.202.10]:45863 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752082AbaALShh (ORCPT ); Sun, 12 Jan 2014 13:37:37 -0500 Date: Sun, 12 Jan 2014 10:37:23 -0800 From: tip-bot for Dongsheng Yang Message-ID: Cc: acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org, namhyung.kim@lge.com, jolsa@redhat.com, dsahern@gmail.com, tglx@linutronix.de, yangds.fnst@cn.fujitsu.com Reply-To: mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, acme@redhat.com, namhyung.kim@lge.com, jolsa@redhat.com, dsahern@gmail.com, tglx@linutronix.de, yangds.fnst@cn.fujitsu.com In-Reply-To: <22455abe107c618a361e7b667ad0f098f7c9b4a3.1387572416.git.yangds.fnst@cn.fujitsu.com> References: <22455abe107c618a361e7b667ad0f098f7c9b4a3.1387572416.git.yangds.fnst@cn.fujitsu.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf tools: Use machine-> pid for tgid if machine is guest. Git-Commit-ID: f5db57c4c47f3985dfc677152e25636a3401fa13 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.1 (terminus.zytor.com [127.0.0.1]); Sun, 12 Jan 2014 10:37:29 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: f5db57c4c47f3985dfc677152e25636a3401fa13 Gitweb: http://git.kernel.org/tip/f5db57c4c47f3985dfc677152e25636a3401fa13 Author: Dongsheng Yang AuthorDate: Fri, 20 Dec 2013 15:52:59 -0500 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 23 Dec 2013 16:49:50 -0300 perf tools: Use machine->pid for tgid if machine is guest. When we synthesize an comm event, if machine is guest, we should use the pid of machine as the event->comm.pid, rather than tgid of thread. Signed-off-by: Dongsheng Yang Cc: David Ahern Cc: Ingo Molnar Cc: Jiri Olsa Cc: Namhyung Kim Link: http://lkml.kernel.org/r/22455abe107c618a361e7b667ad0f098f7c9b4a3.1387572416.git.yangds.fnst@cn.fujitsu.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/event.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 07c0783..2905771 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -106,8 +106,12 @@ static pid_t perf_event__synthesize_comm(struct perf_tool *tool, memset(&event->comm, 0, sizeof(event->comm)); - tgid = perf_event__get_comm_tgid(pid, event->comm.comm, - sizeof(event->comm.comm)); + if (machine__is_host(machine)) + tgid = perf_event__get_comm_tgid(pid, event->comm.comm, + sizeof(event->comm.comm)); + else + tgid = machine->pid; + if (tgid < 0) goto out;