linux-kernel.vger.kernel.org archive mirror
 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>,
	Avi Kivity <avi@redhat.com>, Gleb Natapov <gleb@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Robert Richter <robert.richter@amd.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 01/11] perf tool: Precise mode requires exclude_guest
Date: Wed, 17 Oct 2012 14:19:37 -0300	[thread overview]
Message-ID: <1350494387-10987-2-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1350494387-10987-1-git-send-email-acme@infradead.org>

From: David Ahern <dsahern@gmail.com>

Summary of events per Peter:

  "Intel PEBS in VT-x context uses the DS address as a guest linear address,
  even though its programmed by the host as a host linear address. This
  either results in guest memory corruption and or the hardware faulting and
  'crashing' the virtual machine.  Therefore we have to disable PEBS on VT-x
  enter and re-enable on VT-x exit, enforcing a strict exclude_guest.

  AMB IBS does work but doesn't currently support exclude_* at all,
  setting an exclude_* bit will make it fail."

This patch handles userspace perf command, setting the exclude_guest
attribute if precise mode is requested, but only if a user has not
specified a request for guest or host only profiling (G or H attribute).

Kernel side AMD currently ignores all exclude_* bits, so there is no impact
to existing IBS code paths. Robert Richter has a patch where IBS code will
return EINVAL if an exclude_* bit is set. When this goes in it means use
of :p on AMD with IBS will first fail with EINVAL (because exclude_guest
will be set). Then the existing fallback code within perf will unset
exclude_guest and try again. The second attempt will succeed if the CPU
supports IBS profiling.

Signed-off-by: David Ahern <dsahern@gmail.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Robert Richter <robert.richter@amd.com>
Tested-by: Robert Richter <robert.richter@amd.com>
Reviewed-by: Robert Richter <robert.richter@amd.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
Link: http://lkml.kernel.org/r/1347569955-54626-2-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/parse-events.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index aed38e4..75c7b0f 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -690,6 +690,9 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
 			eH = 0;
 		} else if (*str == 'p') {
 			precise++;
+			/* use of precise requires exclude_guest */
+			if (!exclude_GH)
+				eG = 1;
 		} else
 			break;
 
-- 
1.7.1


  reply	other threads:[~2012-10-17 17:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-17 17:19 [GIT PULL 00/11] perf/urgent fixes Arnaldo Carvalho de Melo
2012-10-17 17:19 ` Arnaldo Carvalho de Melo [this message]
2012-10-17 17:19 ` [PATCH 02/11] perf: Require exclude_guest to use PEBS - kernel side enforcement Arnaldo Carvalho de Melo
2012-10-17 17:19 ` [PATCH 03/11] perf tools: Fix segfault when using srcline sort key Arnaldo Carvalho de Melo
2012-10-17 17:19 ` [PATCH 04/11] perf tools: Remove warnings on JIT samples for " Arnaldo Carvalho de Melo
2012-10-17 17:19 ` [PATCH 05/11] perf hists browser: Fix off-by-two bug on the first column Arnaldo Carvalho de Melo
2012-10-17 17:19 ` [PATCH 06/11] lib tools traceevent: Add back pevent assignment in __pevent_parse_format() Arnaldo Carvalho de Melo
2012-10-17 17:19 ` [PATCH 07/11] tools lib traceevent: Fix missed freeing of subargs in free_arg() in filter Arnaldo Carvalho de Melo
2012-10-17 17:19 ` [PATCH 08/11] perf python: Initialize 'page_size' variable Arnaldo Carvalho de Melo
2012-10-18  1:31   ` Namhyung Kim
2012-10-18 13:58     ` Arnaldo Carvalho de Melo
2012-10-17 17:19 ` [PATCH 09/11] perf python: Link with libtraceevent Arnaldo Carvalho de Melo
2012-10-18  1:38   ` Namhyung Kim
2012-10-18 14:00     ` Arnaldo Carvalho de Melo
2012-10-18 14:38       ` Arnaldo Carvalho de Melo
2012-10-18 15:40         ` Namhyung Kim
2012-10-20  0:35           ` Ingo Molnar
2012-10-20 15:04             ` Arnaldo Carvalho de Melo
2012-10-21 13:33               ` Ingo Molnar
2012-10-17 17:19 ` [PATCH 10/11] perf tools: Fix build on sparc Arnaldo Carvalho de Melo
2012-10-18  1:39   ` Namhyung Kim
2012-10-18  2:15     ` David Miller
2012-10-17 17:19 ` [PATCH 11/11] perf hists browser: Add back callchain folding symbol 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=1350494387-10987-2-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=acme@redhat.com \
    --cc=avi@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=gleb@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=robert.richter@amd.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).