All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 03/19] perf kvm: Guest userspace samples should not be lumped with host uspace
Date: Wed, 25 Jul 2012 14:41:18 -0300	[thread overview]
Message-ID: <1343238094-12481-4-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1343238094-12481-1-git-send-email-acme@infradead.org>

From: David Ahern <dsahern@gmail.com>

e.g., perf kvm --host  --guest report -i perf.data --stdio -D
shows:

1 599127912065356 0x143b8 [0x48]: PERF_RECORD_SAMPLE(IP, 5): 5671/5676: 0x7fdf95a061c0 period: 1 addr: 0
... chain: nr:2
.....  0: ffffffffffffff80
.....  1: fffffffffffffe00
 ... thread: qemu-kvm:5671
 ...... dso: <not found>

(IP, 5) means sample in guest userspace. Those samples should not be lumped
into the VMM's host thread. i.e, the report output:

    56.86%  qemu-kvm  [unknown]         [u] 0x00007fdf95a061c0

With this patch the output emphasizes it is a guest userspace hit:

    56.86%  [guest/5671]  [unknown]         [u] 0x00007fdf95a061c0

Looking at 3 VMs (2 64-bit, 1 32-bit) with each running a CPU bound
process (openssl speed), perf report currently shows:

  93.84%  117726   qemu-kvm  [unknown]   [u] 0x00007fd7dcaea8e5

which is wrong. With this patch you get:

  31.50%   39258   [guest/18772]  [unknown]   [u] 0x00007fd7dcaea8e5
  31.50%   39236   [guest/11230]  [unknown]   [u] 0x0000000000a57340
  30.84%   39232   [guest/18395]  [unknown]   [u] 0x00007f66f641e107

Tested-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1342826756-64663-4-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 8e48559..90ee39d 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -918,7 +918,9 @@ static struct machine *
 {
 	const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
 
-	if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) {
+	if (perf_guest &&
+	    ((cpumode == PERF_RECORD_MISC_GUEST_KERNEL) ||
+	     (cpumode == PERF_RECORD_MISC_GUEST_USER))) {
 		u32 pid;
 
 		if (event->header.type == PERF_RECORD_MMAP)
-- 
1.7.1


  parent reply	other threads:[~2012-07-25 17:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25 17:41 [GIT PULL 00/19] perf/core fixes and improvements Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 01/19] perf symbols: Add machine id to modules debug message Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 02/19] perf kvm: Set name for VM process in guest machine Arnaldo Carvalho de Melo
2012-07-25 17:41 ` Arnaldo Carvalho de Melo [this message]
2012-07-25 17:41 ` [PATCH 04/19] perf kvm: Fix bug resolving guest kernel syms Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 05/19] perf kvm: Limit repetitive guestmount message to once per directory Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 06/19] perf tools: Dump exclude_{guest,host}, precise_ip header info too Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 07/19] perf hists: Return correct number of characters printed in callchain Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 08/19] perf tools: Fix trace events storms due to weight demux Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 09/19] perf hists: Print newline between hists callchains Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 10/19] perf symbols: Factor DSO symtab types to generic binary types Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 11/19] perf symbols: Add interface to read DSO image data Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 12/19] perf symbols: Add dso data caching Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 13/19] perf test: Add dso data caching tests Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 14/19] perf tools: Make the breakpoint events sample period default to 1 Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 15/19] perf tools: use XSI-complaint version of strerror_r() instead of GNU-specific Arnaldo Carvalho de Melo
2012-07-25 17:54   ` Kirill A. Shutemov
2012-07-25 18:23     ` Arnaldo Carvalho de Melo
2012-07-25 18:54       ` Ingo Molnar
2012-07-26  0:39   ` Namhyung Kim
2012-07-26  1:50     ` [PATCH] perf target: Fix check on buffer size Namhyung Kim
2012-08-05 16:45       ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2012-07-25 17:41 ` [PATCH 16/19] perf tools: Fix build error with bison 2.6 Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 17/19] tools lib traceevent: Detect build environment changes Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 18/19] tools lib traceevent: Ignore TRACEEVENT-CFLAGS file Arnaldo Carvalho de Melo
2012-07-25 17:41 ` [PATCH 19/19] perf annotate: Prevent overflow in size calculation Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1343238094-12481-4-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.