[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5009EB4B.5030107@gmail.com>
Date: Fri, 20 Jul 2012 17:35:39 -0600
From: David Ahern <dsahern@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
CC: Avi Kivity <avi@...hat.com>, Gleb Natapov <gleb@...hat.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: perf with precise attribute kills all KVM based VMs
On 7/9/12 8:47 AM, Peter Zijlstra wrote:
> 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++;
>
Tested-by: David Ahern <dsahern@...il.com>
Gleb's patch is required as well. It takes both to fix the problem. And
my userspace patch keeps compatibility for users who currently use -e
cycles:pp (they won't be forced to add 'H'). (lkml is slow to show it so
I can't pull a link for reference, but it's in your email ahead of this
one).
Be nice to get this set into stable releases as well.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists