Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-13 Thread Alexander Shishkin
it it into two > functions ... Ok, so I'll use this one then. Thanks! Peter, here's an updated patch against perf/urgent. It also doesn't introduce new ACCESS_ONCE()s any more. >From 89b85412c46270a675cf77918fc9fda520a7bdd2 Mon Sep 17 00:00:00 2001 From: Alexander Shishkin <alexander.sh

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-13 Thread Alexander Shishkin
an updated patch against perf/urgent. It also doesn't introduce new ACCESS_ONCE()s any more. >From 89b85412c46270a675cf77918fc9fda520a7bdd2 Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Tue, 29 Mar 2016 17:43:10 +0300 Subject: [PATCH] perf/x86/intel/pt: Don't die on VMXON S

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-13 Thread Ingo Molnar
* Alexander Shishkin wrote: > Ingo Molnar writes: > > >> @@ -3144,6 +3146,8 @@ static void vmclear_local_loaded_vmcss(void) > >> static void kvm_cpu_vmxoff(void) > >> { > >>asm volatile (__ex(ASM_VMX_VMXOFF) : : : "cc"); > >> + > >>

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-13 Thread Ingo Molnar
* Alexander Shishkin wrote: > Ingo Molnar writes: > > >> @@ -3144,6 +3146,8 @@ static void vmclear_local_loaded_vmcss(void) > >> static void kvm_cpu_vmxoff(void) > >> { > >>asm volatile (__ex(ASM_VMX_VMXOFF) : : : "cc"); > >> + > >> + intel_pt_vmx(0); > >> } > > > > Yeah so the name

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-13 Thread Alexander Shishkin
Ingo Molnar writes: >> @@ -3144,6 +3146,8 @@ static void vmclear_local_loaded_vmcss(void) >> static void kvm_cpu_vmxoff(void) >> { >> asm volatile (__ex(ASM_VMX_VMXOFF) : : : "cc"); >> + >> +intel_pt_vmx(0); >> } > > Yeah so the name intel_pt_vmx() is pretty

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-13 Thread Alexander Shishkin
Ingo Molnar writes: >> @@ -3144,6 +3146,8 @@ static void vmclear_local_loaded_vmcss(void) >> static void kvm_cpu_vmxoff(void) >> { >> asm volatile (__ex(ASM_VMX_VMXOFF) : : : "cc"); >> + >> +intel_pt_vmx(0); >> } > > Yeah so the name intel_pt_vmx() is pretty information-free because

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-13 Thread Ingo Molnar
* Alexander Shishkin wrote: > Signed-off-by: Alexander Shishkin > --- > arch/x86/events/intel/pt.c| 75 > +-- > arch/x86/events/intel/pt.h| 2 ++ >

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-13 Thread Ingo Molnar
* Alexander Shishkin wrote: > Signed-off-by: Alexander Shishkin > --- > arch/x86/events/intel/pt.c| 75 > +-- > arch/x86/events/intel/pt.h| 2 ++ > arch/x86/include/asm/perf_event.h | 4 +++ > arch/x86/kvm/vmx.c| 4 +++ >

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-06 Thread Alexander Shishkin
tch as well. 3x a charm: >From 1ac911d5096af88217b3a26b26d594b02f0db614 Mon Sep 17 00:00:00 2001 From: Alexander Shishkin <alexander.shish...@linux.intel.com> Date: Tue, 29 Mar 2016 17:43:10 +0300 Subject: [PATCH] perf/x86/intel/pt: Don't die on VMXON Some versions of Intel PT do not s

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-06 Thread Alexander Shishkin
3x a charm: >From 1ac911d5096af88217b3a26b26d594b02f0db614 Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Tue, 29 Mar 2016 17:43:10 +0300 Subject: [PATCH] perf/x86/intel/pt: Don't die on VMXON Some versions of Intel PT do not support tracing across VMXON, more specifically, VMXON will clear TraceE

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-06 Thread Alexander Shishkin
Borislav Petkov writes: > On Wed, Apr 06, 2016 at 01:52:15PM +0200, Peter Zijlstra wrote: >> Borislav tells me this ought to be boot_cpu_has(X86_FEATURE_VMX) >> >> > + /* Intel SDM, 36.5 "Tracing post-VMXON" */ >> > + rdmsrl(MSR_IA32_VMX_MISC, reg); >> > +

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-06 Thread Alexander Shishkin
Borislav Petkov writes: > On Wed, Apr 06, 2016 at 01:52:15PM +0200, Peter Zijlstra wrote: >> Borislav tells me this ought to be boot_cpu_has(X86_FEATURE_VMX) >> >> > + /* Intel SDM, 36.5 "Tracing post-VMXON" */ >> > + rdmsrl(MSR_IA32_VMX_MISC, reg); >> > + if (reg &

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-06 Thread Borislav Petkov
On Wed, Apr 06, 2016 at 01:52:15PM +0200, Peter Zijlstra wrote: > Borislav tells me this ought to be boot_cpu_has(X86_FEATURE_VMX) > > > + /* Intel SDM, 36.5 "Tracing post-VMXON" */ > > + rdmsrl(MSR_IA32_VMX_MISC, reg); > > + if (reg & BIT(14)) Also, I needz to

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-06 Thread Borislav Petkov
On Wed, Apr 06, 2016 at 01:52:15PM +0200, Peter Zijlstra wrote: > Borislav tells me this ought to be boot_cpu_has(X86_FEATURE_VMX) > > > + /* Intel SDM, 36.5 "Tracing post-VMXON" */ > > + rdmsrl(MSR_IA32_VMX_MISC, reg); > > + if (reg & BIT(14)) Also, I needz to

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-06 Thread Peter Zijlstra
On Wed, Apr 06, 2016 at 02:10:49PM +0300, Alexander Shishkin wrote: > >> + /* may be already stopped by a PMI*/ > >> + if (!(ctl & RTIT_CTL_TRACEEN)) > >> + return; > >> + > >> + ctl ^= RTIT_CTL_TRACEEN; > > > > Would that not be much less confusing when written like |= ? > > This

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-06 Thread Peter Zijlstra
On Wed, Apr 06, 2016 at 02:10:49PM +0300, Alexander Shishkin wrote: > >> + /* may be already stopped by a PMI*/ > >> + if (!(ctl & RTIT_CTL_TRACEEN)) > >> + return; > >> + > >> + ctl ^= RTIT_CTL_TRACEEN; > > > > Would that not be much less confusing when written like |= ? > > This

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-06 Thread Alexander Shishkin
ind .entry a very confusing > argument name. I did struggle with this one indeed. How about this then: >From 9faf95f173decda1f2e3101ced9d9370c14f2339 Mon Sep 17 00:00:00 2001 From: Alexander Shishkin <alexander.shish...@linux.intel.com> Date: Tue, 29 Mar 2016 17:43:10 +0300 Subject: [PATCH] perf/

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-06 Thread Alexander Shishkin
ument name. I did struggle with this one indeed. How about this then: >From 9faf95f173decda1f2e3101ced9d9370c14f2339 Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Tue, 29 Mar 2016 17:43:10 +0300 Subject: [PATCH] perf/x86/intel/pt: Don't die on VMXON Some versions of Intel PT do not

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-06 Thread Peter Zijlstra
On Fri, Apr 01, 2016 at 07:24:14PM +0300, Alexander Shishkin wrote: > +static void pt_config_stop(struct perf_event *event) > { > + u64 ctl = READ_ONCE(event->hw.config); > > + /* may be already stopped by a PMI*/ > + if (!(ctl & RTIT_CTL_TRACEEN)) > + return; > + > +

Re: [PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-06 Thread Peter Zijlstra
On Fri, Apr 01, 2016 at 07:24:14PM +0300, Alexander Shishkin wrote: > +static void pt_config_stop(struct perf_event *event) > { > + u64 ctl = READ_ONCE(event->hw.config); > > + /* may be already stopped by a PMI*/ > + if (!(ctl & RTIT_CTL_TRACEEN)) > + return; > + > +

[PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-01 Thread Alexander Shishkin
Some versions of Intel PT do not support tracing across VMXON, more specifically, VMXON will clear TraceEn control bit and any attempt to set it before VMXOFF will throw a #GP, which in the current state of things will crash the kernel. Namely, $ perf record -e intel_pt// kvm -nographic on such

[PATCH] perf/x86/intel/pt: Don't die on VMXON

2016-04-01 Thread Alexander Shishkin
Some versions of Intel PT do not support tracing across VMXON, more specifically, VMXON will clear TraceEn control bit and any attempt to set it before VMXOFF will throw a #GP, which in the current state of things will crash the kernel. Namely, $ perf record -e intel_pt// kvm -nographic on such