this patch fixed the bug:
commit 338b522ca43cfd32d11a370f4203bcd089c6c877
Author: Kan Liang <email address hidden>
Date: Mon Jul 14 12:25:56 2014 -0700
perf/x86/intel: Protect LBR and extra_regs against KVM lying
With -cpu host, KVM reports LBR and extra_regs support, if the host has
support.
When the guest perf driver tries to access LBR or extra_regs MSR,
it #GPs all MSR accesses,since KVM doesn't handle LBR and extra_regs support.
So check the related MSRs access right once at initialization time to avoid
the error access at runtime.
For reproducing the issue, please build the kernel with CONFIG_KVM_INTEL = y
(for host kernel).
And CONFIG_PARAVIRT = n and CONFIG_KVM_GUEST = n (for guest kernel).
Start the guest with -cpu host.
Run perf record with --branch-any or --branch-filter in guest to trigger LBR
Run perf stat offcore events (E.g. LLC-loads/LLC-load-misses ...) in guest to
trigger offcore_rsp #GP
this patch fixed the bug: 2d11a370f4203bc d089c6c877
commit 338b522ca43cfd3
Author: Kan Liang <email address hidden>
Date: Mon Jul 14 12:25:56 2014 -0700
perf/x86/intel: Protect LBR and extra_regs against KVM lying
With -cpu host, KVM reports LBR and extra_regs support, if the host has
support.
When the guest perf driver tries to access LBR or extra_regs MSR,
it #GPs all MSR accesses,since KVM doesn't handle LBR and extra_regs support.
So check the related MSRs access right once at initialization time to avoid
the error access at runtime.
For reproducing the issue, please build the kernel with CONFIG_KVM_INTEL = y LLC-load- misses ...) in guest to
(for host kernel).
And CONFIG_PARAVIRT = n and CONFIG_KVM_GUEST = n (for guest kernel).
Start the guest with -cpu host.
Run perf record with --branch-any or --branch-filter in guest to trigger LBR
Run perf stat offcore events (E.g. LLC-loads/
trigger offcore_rsp #GP
Signed-off-by: Kan Liang <email address hidden>
Signed-off-by: Peter Zijlstra <email address hidden>
Cc: Andi Kleen <email address hidden>
Cc: Arnaldo Carvalho de Melo <email address hidden>
Cc: Linus Torvalds <email address hidden>
Cc: Maria Dimakopoulou <email address hidden>
Cc: Mark Davies <email address hidden>
Cc: Paul Mackerras <email address hidden>
Cc: Stephane Eranian <email address hidden>
Cc: Yan, Zheng <email address hidden>
Link: http://<email address hidden>
Signed-off-by: Ingo Molnar <email address hidden>