lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161026091644.GB3102@twins.programming.kicks-ass.net>
Date:   Wed, 26 Oct 2016 11:16:44 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Imre Palik <imrep.amz@...il.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        Andi Kleen <ak@...ux.intel.com>,
        Stephane Eranian <eranian@...gle.com>,
        Kan Liang <kan.liang@...el.com>,
        David Carrillo-Cisneros <davidcc@...gle.com>,
        linux-kernel@...r.kernel.org,
        Alexander Kozyrev <alexander.kozyrev@...el.com>,
        Artyom Kuanbekov <artyom.kuanbekov@...el.com>,
        Imre Palik <imrep@...zon.de>, Matt Wilson <msw@...zon.com>,
        David Woodhouse <dwmw@...zon.co.uk>
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!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ