Re: [PATCH 1/2] perf/x86/intel/pt: Fail event scheduling on conflict with VMX

From: Peter Zijlstra
Date: Tue Feb 14 2017 - 13:39:17 EST


On Tue, Feb 14, 2017 at 07:21:34PM +0200, Alexander Shishkin wrote:
> Peter Zijlstra <peterz@xxxxxxxxxxxxx> writes:
>
> > On Tue, Feb 14, 2017 at 06:17:30PM +0200, Alexander Shishkin wrote:
> >> This is called by pmu::add(), which checks hw.state afterwards and if it
> >> finds HES_STOPPED, it returns an error, which event_sched_in() captures
> >> and keeps the event in INACTIVE state. Should I add a comment about it?
> >
> > Egads... so what if ->add() succeeds but we then hit this on
> > ->stop()/->start() due to throttle or period adjust?
>
> It will hang there with hw.state==PERF_HES_STOPPED till the next
> sched_out. But that will be the case anyway if VMXON kicks in while PT
> is running.

Right, so I question the whole 'lets not schedule PT when VMX' premise,
it leads to inconsistencies all over. How about we treat it like
->add() succeeded and VMX simply results in no output.

Esp. when you then emit 'fake' data into/from a vmlaunch/vmresume
instruction.