Re: [PATCH V5 1/2] perf ignore LBR and extra_regs

Paolo Bonzini
2014-07-14T13:48:09Z

Il 14/07/2014 14:48, Peter Zijlstra ha scritto:
>>>> In fact there's no reason why LBR cannot be virtualized (though it does need
>>>> support from the processor), and it may even be possible to support
>>>> OFFCORE_RSP_X in the KVM virtual PMU.
>>>
>>> But its not, so something needs to be done, right?
>>
>> A first thing that could be done, is to have a way for the kernel to detect
>> absence of LBR
>
> Which is exactly what this patch does, no?

A documented (and recommended) way for the kernel to detect it is
superior though...

>> , for example an all-1s setting of the LBR format field of
>> IA32_PERF_CAPABILITIES. If Intel can tell us "all 1s will never be used",
>> we can have KVM set the field that way. The kernel then should disable LBR.
>
> So what's wrong with testing if the MSRs that provide LBR actually work
> or not? That doesn't require any magic co-operation of the host/vm
> machinery and is therefore far more robust.

... because the difference is that whenever we hack the kernel, Windows
and vTune will remain broken forever. Whenever we get Intel to make the
hack part of the spec, there is some hope that Windows and vTune will
eventually get fixed.

The hack certainly works, I'm not disputing that.

Paolo