[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170214174734.GC4458@kernel.org>
Date: Tue, 14 Feb 2017 14:47:34 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
vince@...ter.net, eranian@...gle.com,
Arnaldo Carvalho de Melo <acme@...radead.org>,
Borislav Petkov <bp@...e.de>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX
operation is on
Em Tue, Feb 14, 2017 at 03:24:16PM +0200, Alexander Shishkin escreveu:
> On systems where PT does not coexist with VMX, users get confused when
> PT turns up with no data because they forgot they're running a kvm
> session at the same time.
>
> This patch adds a preemptive check for any active VMX operations that
> will fail event creation. This does not provide any guarantees or
> protection against racing with a kvm starting in parallel, but is
> intended to serve as a hint for the user. If VMXON happens after an
> event had been created, the event will still produce an empty trace.
>
> Signed-off-by: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
> Reported-by: Andi Kleen <ak@...ux.intel.com>
Yeah, I saw that as well, and Andi told me about this limitation, so,
for quite a while now, everytime I need to test PT on the only machine I
have with it, I have to stop my kvm sessions :-\
Thanks for working on this!
- Arnaldo
> ---
> arch/x86/events/intel/pt.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
> index 9372fa4549..b1490a879c 100644
> --- a/arch/x86/events/intel/pt.c
> +++ b/arch/x86/events/intel/pt.c
> @@ -1444,6 +1444,20 @@ static void pt_event_destroy(struct perf_event *event)
>
> static int pt_event_init(struct perf_event *event)
> {
> + int cpu, vmx_on = 0;
> +
> + get_online_cpus();
> + for_each_online_cpu(cpu) {
> + struct pt *pt = per_cpu_ptr(&pt_ctx, cpu);
> +
> + if (READ_ONCE(pt->vmx_on))
> + vmx_on++;
> + }
> + put_online_cpus();
> +
> + if (vmx_on)
> + return -EBUSY;
> +
> if (event->attr.type != pt_pmu.pmu.type)
> return -ENOENT;
>
> --
> 2.11.0
Powered by blists - more mailing lists