[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-f92b7604149a55cb601fc0b52911b1e11f0f2514@git.kernel.org>
Date: Fri, 28 Oct 2016 03:11:03 -0700
From: tip-bot for Imre Palik <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: torvalds@...ux-foundation.org, peterz@...radead.org, hpa@...or.com,
ak@...ux.intel.com, imrep@...zon.de, acme@...hat.com,
alexander.kozyrev@...el.com, jolsa@...hat.com, msw@...zon.com,
linux-kernel@...r.kernel.org, eranian@...gle.com,
kan.liang@...el.com, dwmw@...zon.co.uk,
alexander.shishkin@...ux.intel.com, davidcc@...gle.com,
mingo@...nel.org, tglx@...utronix.de, artyom.kuanbekov@...el.com
Subject: [tip:perf/urgent] perf/x86/intel: Honour the CPUID for number of
fixed counters in hypervisors
Commit-ID: f92b7604149a55cb601fc0b52911b1e11f0f2514
Gitweb: http://git.kernel.org/tip/f92b7604149a55cb601fc0b52911b1e11f0f2514
Author: Imre Palik <imrep@...zon.de>
AuthorDate: Fri, 21 Oct 2016 01:18:59 -0700
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 28 Oct 2016 11:06:25 +0200
perf/x86/intel: Honour the CPUID for number of fixed counters in hypervisors
perf doesn't seem to honour the number of fixed counters specified by CPUID
leaf 0xa. It always assumes that Intel CPUs have at least 3 fixed counters.
So if some of the fixed counters are masked out by the hypervisor, it still
tries to check/set them.
This patch makes perf behave nicer when the kernel is running under a
hypervisor that doesn't expose all the counters.
This patch contains some ideas from Matt Wilson.
Signed-off-by: Imre Palik <imrep@...zon.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Andi Kleen <ak@...ux.intel.com>
Cc: Alexander Kozyrev <alexander.kozyrev@...el.com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Artyom Kuanbekov <artyom.kuanbekov@...el.com>
Cc: David Carrillo-Cisneros <davidcc@...gle.com>
Cc: David Woodhouse <dwmw@...zon.co.uk>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Kan Liang <kan.liang@...el.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Matt Wilson <msw@...zon.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Stephane Eranian <eranian@...gle.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Link: http://lkml.kernel.org/r/1477037939-15605-1-git-send-email-imrep.amz@gmail.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
arch/x86/events/intel/core.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index eab0915..a74a2db 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3607,10 +3607,14 @@ __init int intel_pmu_init(void)
/*
* Quirk: v2 perfmon does not report fixed-purpose events, so
- * assume at least 3 events:
+ * assume at least 3 events, when not running in a hypervisor:
*/
- if (version > 1)
- x86_pmu.num_counters_fixed = max((int)edx.split.num_counters_fixed, 3);
+ if (version > 1) {
+ int assume = 3 * !boot_cpu_has(X86_FEATURE_HYPERVISOR);
+
+ x86_pmu.num_counters_fixed =
+ max((int)edx.split.num_counters_fixed, assume);
+ }
if (boot_cpu_has(X86_FEATURE_PDCM)) {
u64 capabilities;
Powered by blists - more mailing lists