On Mon, 2012-07-09 at 17:39 +0300, Avi Kivity wrote:Disabling PEBS events for guests isn't pretty though..
We already have atomic MSR switching at guest entry/exit time. So it's
not pretty in terms of not getting full profiling, but the code won't be
too hard. Basically we just have to exclude_guest any pebs event.
OK, so ideally we'd do something like the below, except of course that
that isn't backwards compatible and will break the world :/
bugger that
---
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -336,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;
@@ -378,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++;