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

From: Alexander Shishkin
Date: Tue Feb 14 2017 - 12:21:50 EST


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.

> Now I suppose PT will never normally hit either of those, but you can do
> IOC_PERIOD on it, just for giggles.

True. Should we worry?

> Yes, this very much needs a comment... Also, should not this then live
> in ->add() in the first place?

The output_stop() stuff in the mmap_close path relies on
perf_aux_output_end() being in ->stop(), let me think if there's more.

Regards,
--
Alex