Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1580535
| From | Alexander Shishkin <alexander.shishkin@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX operation is on |
| Date | 2017-02-14 14:40 +0100 |
| Message-ID | <taLuN-2sF-3@gated-at.bofh.it> (permalink) |
| References | <taLl8-2pq-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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@linux.intel.com>
Reported-by: Andi Kleen <ak@linux.intel.com>
---
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/2] perf/x86/intel/pt: VMX related updates Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-14 14:30 +0100
[PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX operation is on Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-14 14:40 +0100
Re: [PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX operation is on Peter Zijlstra <peterz@infradead.org> - 2017-02-14 15:10 +0100
Re: [PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX operation is on Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-14 18:50 +0100
Re: [PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX operation is on Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-15 09:40 +0100
Re: [PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX operation is on Peter Zijlstra <peterz@infradead.org> - 2017-02-15 10:00 +0100
Re: [PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX operation is on Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-15 14:10 +0100
Re: [PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX operation is on Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-15 14:20 +0100
Re: [PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX operation is on Peter Zijlstra <peterz@infradead.org> - 2017-02-15 14:40 +0100
Re: [PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX operation is on Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-15 14:00 +0100
Re: [PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX operation is on Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-15 14:10 +0100
Re: [PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX operation is on Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-15 14:20 +0100
[PATCH 1/2] perf/x86/intel/pt: Fail event scheduling on conflict with VMX Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-14 14:40 +0100
Re: [PATCH 1/2] perf/x86/intel/pt: Fail event scheduling on conflict with VMX Peter Zijlstra <peterz@infradead.org> - 2017-02-14 15:00 +0100
Re: [PATCH 1/2] perf/x86/intel/pt: Fail event scheduling on conflict with VMX Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-14 17:20 +0100
Re: [PATCH 1/2] perf/x86/intel/pt: Fail event scheduling on conflict with VMX Peter Zijlstra <peterz@infradead.org> - 2017-02-14 17:30 +0100
Re: [PATCH 1/2] perf/x86/intel/pt: Fail event scheduling on conflict with VMX Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-14 18:30 +0100
Re: [PATCH 1/2] perf/x86/intel/pt: Fail event scheduling on conflict with VMX Peter Zijlstra <peterz@infradead.org> - 2017-02-14 19:40 +0100
Re: [PATCH 1/2] perf/x86/intel/pt: Fail event scheduling on conflict with VMX Peter Zijlstra <peterz@infradead.org> - 2017-02-14 20:50 +0100
Re: [PATCH 1/2] perf/x86/intel/pt: Fail event scheduling on conflict with VMX Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-02-15 09:20 +0100
Re: [PATCH 1/2] perf/x86/intel/pt: Fail event scheduling on conflict with VMX Peter Zijlstra <peterz@infradead.org> - 2017-02-15 10:00 +0100
csiph-web