Messages in this thread | | | Date | Wed, 26 Oct 2016 11:16:44 +0200 | From | Peter Zijlstra <> | Subject | Re: [RFC PATCH v2] perf: honouring the cpuid for number of fixed counters in hypervisors |
| |
On Fri, Oct 21, 2016 at 01:18:59AM -0700, Imre Palik wrote: > +++ 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, when not running in a hypervisor: > */ > + if (version > 1) { > + if (static_cpu_has(X86_FEATURE_HYPERVISOR)) > + x86_pmu.num_counters_fixed = edx.split.num_counters_fixed; > + else > + x86_pmu.num_counters_fixed = max((int)edx.split.num_counters_fixed, 3); > + }
I made that:
/* * Quirk: v2 perfmon does not report fixed-purpose events, so + * assume at least 3 events, when not running in a hypervisor: */ + 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); + }
Thanks!
| |