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

From: Peter Zijlstra
Date: Wed Apr 06 2016 - 07:52:39 EST


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 one's actually clearing TraceEn, see the if-not-set-leave in front
> of it, but that just goes to prove your point I guess. :)

Hehe, indeed. So much for pretending to be awake :-)


> How about this then:

Looks good, however:

> + if (test_cpu_cap(&boot_cpu_data, X86_FEATURE_VMX)) {

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))
> + pt_pmu.vmx = true;
> + }