From: Borislav Petkov <[email protected]> qemu/kvm doesn't support RAPL and RAPL doesn't have a CPUID feature bit so check whether we're in a guest instead.
Reported-by: Hannes Reinecke <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jacob Pan <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Thomas Gleixner <[email protected]> --- arch/x86/kernel/cpu/perf_event_intel_rapl.c | 3 +++ drivers/powercap/intel_rapl.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c b/arch/x86/kernel/cpu/perf_event_intel_rapl.c index ed446bdcbf31..bc60bc1118b4 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c +++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c @@ -711,6 +711,9 @@ static int __init rapl_pmu_init(void) struct x86_pmu_quirk *quirk; int i; + if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) + return 0; + /* * check for Intel processor family 6 */ diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c index cc97f0869791..297a9b5074e2 100644 --- a/drivers/powercap/intel_rapl.c +++ b/drivers/powercap/intel_rapl.c @@ -1511,6 +1511,9 @@ static int __init rapl_init(void) int ret = 0; const struct x86_cpu_id *id; + if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) + return -ENODEV; + id = x86_match_cpu(rapl_ids); if (!id) { pr_err("driver does not support CPU family %d model %d\n", -- 2.3.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

