perf/x86/kvm: Fix Host-Only/Guest-Only counting with SVM disabled
authorJoerg Roedel <joerg.roedel@amd.com>
Wed, 29 Feb 2012 13:57:32 +0000 (14:57 +0100)
committerIngo Molnar <mingo@elte.hu>
Fri, 2 Mar 2012 11:16:39 +0000 (12:16 +0100)
commit1018faa6cf23b256bf25919ef203cd7c129f06f2
tree16f8f223062c41e29431edfa71e66832101dee4e
parent5d85d97c9f6973ba854f35a2d5e80fe68272143e
perf/x86/kvm: Fix Host-Only/Guest-Only counting with SVM disabled

It turned out that a performance counter on AMD does not
count at all when the GO or HO bit is set in the control
register and SVM is disabled in EFER.

This patch works around this issue by masking out the HO bit
in the performance counter control register when SVM is not
enabled.

The GO bit is not touched because it is only set when the
user wants to count in guest-mode only. So when SVM is
disabled the counter should not run at all and the
not-counting is the intended behaviour.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Avi Kivity <avi@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: stable@vger.kernel.org # v3.2
Link: http://lkml.kernel.org/r/1330523852-19566-1-git-send-email-joerg.roedel@amd.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/include/asm/perf_event.h
arch/x86/kernel/cpu/perf_event.h
arch/x86/kernel/cpu/perf_event_amd.c
arch/x86/kvm/svm.c