Re: [PATCH 1/2] perf: ignore LBR and offcore_rsp.

From: Peter Zijlstra
Date: Wed Jun 18 2014 - 11:59:28 EST


On Wed, Jun 18, 2014 at 03:52:55PM +0000, Liang, Kan wrote:
> perf ignore LBR and offcore_rsp.
>
> x86, perf: Protect LBR and offcore rsp against KVM lying
>
> With -cpu host, KVM reports LBR and offcore support, if the host has support.
> When the guest perf driver tries to access LBR or offcore_rsp MSR,
> it #GPs all MSR accesses,since KVM doesn't handle LBR and offcore support.
> So LBR and offcore rsp MSRs are needed to be protected by _safe().
>
> For reproducing the issue, please build the kernel with CONFIG_KVM_INTEL = y.
> And CONFIG_PARAVIRT = n and CONFIG_KVM_GUEST = n.
> Start the guest with -cpu host.
> Run perf record with --branch-any or --branch-filter in guest to trigger LBR #GP.
> Run perf stat offcore events (E.g. LLC-loads/LLC-load-misses ...) in guest to trigger offcore_rsp #GP
>
> Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>

This order indicates Andi is the author; but there's no corresponding
From.

> Signed-off-by: Kan Liang <kan.liang@xxxxxxxxx>

And here I thought that Andi was of the opinion that if you set CPUID to
indicate a particular CPU you had better also handle all its MSRs.


Attachment: pgpbVfIXKiJxD.pgp
Description: PGP signature