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

Peter Zijlstra
2014-06-18T15:59:16Z

[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]

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@linux.intel.com>

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

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

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 #2: Type: application/pgp-signature, Size: 836 bytes --]