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

From: Peter Zijlstra
Date: Mon Jul 14 2014 - 08:48:29 EST

On Mon, Jul 14, 2014 at 02:40:33PM +0200, Paolo Bonzini wrote:
> Hmmm, I thought rdmsr_safe was going to return zero, but it just returns
> whatever happened to be in edx:eax which maybe should also be fixed.
> Kan Liang, what happens if CONFIG_PARAVIRT=y? Do you get garbage or just no
> events reported?

Either way; its not functioning according to 'spec'. Therefore we should
'disable' things.

> >>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?

> , 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.

Attachment: pgpAM9m1pi8ug.pgp
Description: PGP signature