From: tip-bot for Peter Zijlstra <peterz@infradead.org>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com,
mingo@kernel.org, peterz@infradead.org, gleb@redhat.com,
robert.richter@amd.com, dsahern@gmail.com, tglx@linutronix.de,
avi@redhat.com
Subject: [tip:perf/urgent] perf: Require exclude_guest to use PEBS - kernel side enforcement
Date: Fri, 19 Oct 2012 17:56:36 -0700 [thread overview]
Message-ID: <tip-20b279ddb38ca42f8863cec07b4d45ec24589f13@git.kernel.org> (raw)
In-Reply-To: <1347569955-54626-3-git-send-email-dsahern@gmail.com>
Commit-ID: 20b279ddb38ca42f8863cec07b4d45ec24589f13
Gitweb: http://git.kernel.org/tip/20b279ddb38ca42f8863cec07b4d45ec24589f13
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Thu, 13 Sep 2012 14:59:14 -0600
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 16 Oct 2012 12:43:58 -0300
perf: Require exclude_guest to use PEBS - kernel side enforcement
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.
This patch enforces exclude_guest kernel side.
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Avi Kivity <avi@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Robert Richter <robert.richter@amd.com>
Link: http://lkml.kernel.org/r/1347569955-54626-3-git-send-email-dsahern@gmail.com
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
arch/x86/kernel/cpu/perf_event.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 915b876..3373f84 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -338,6 +338,9 @@ int x86_setup_perfctr(struct perf_event *event)
/* BTS is currently only allowed for user-mode. */
if (!attr->exclude_kernel)
return -EOPNOTSUPP;
+
+ if (!attr->exclude_guest)
+ return -EOPNOTSUPP;
}
hwc->config |= config;
@@ -380,6 +383,9 @@ int x86_pmu_hw_config(struct perf_event *event)
if (event->attr.precise_ip) {
int precise = 0;
+ if (!event->attr.exclude_guest)
+ return -EOPNOTSUPP;
+
/* Support for constant skid */
if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) {
precise++;
next prev parent reply other threads:[~2012-10-20 0:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-13 20:59 [PATCH 0/3 v3] perf: precise mode and exclude_guest David Ahern
2012-09-13 20:59 ` [PATCH 1/3] perf tool: precise mode requires exclude_guest David Ahern
2012-10-20 0:55 ` [tip:perf/urgent] perf tool: Precise " tip-bot for David Ahern
2012-09-13 20:59 ` [PATCH 2/3] perf: require exclude_guest to use PEBS - kernel side enforcement David Ahern
2012-10-20 0:56 ` tip-bot for Peter Zijlstra [this message]
2012-09-13 20:59 ` [PATCH 3/3 v2] perf tool: give user better message if precise is not supported David Ahern
2012-09-14 5:43 ` Ingo Molnar
2012-09-14 11:13 ` David Ahern
2012-09-14 11:36 ` Ingo Molnar
2012-09-14 11:43 ` David Ahern
2012-09-14 18:00 ` Arnaldo Carvalho de Melo
2012-09-14 18:07 ` Peter Zijlstra
2012-09-14 20:05 ` Ingo Molnar
2012-09-14 20:11 ` Ingo Molnar
2012-09-14 21:26 ` Peter Zijlstra
2012-09-17 7:11 ` Ingo Molnar
2012-10-25 8:01 ` [tip:perf/core] perf tools: Give " tip-bot for David Ahern
2012-09-26 1:24 ` [PATCH 0/3 v3] perf: precise mode and exclude_guest David Ahern
2012-10-09 15:08 ` David Ahern
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=tip-20b279ddb38ca42f8863cec07b4d45ec24589f13@git.kernel.org \
--to=peterz@infradead.org \
--cc=acme@redhat.com \
--cc=avi@redhat.com \
--cc=dsahern@gmail.com \
--cc=gleb@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=robert.richter@amd.com \
--cc=tglx@linutronix.de \
/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.