lkml.org 
[lkml]   [2016]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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!

\
 
 \ /
  Last update: 2016-10-26 11:20    [W:0.411 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site