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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 9 Sep 2016 17:11:00 +0200 (CEST)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Harry Pan <harry.pan@...el.com>
cc:     LKML <linux-kernel@...r.kernel.org>, gs0622@...il.com,
        mingo@...hat.com, hpa@...or.com, x86@...nel.org,
        peterz@...radead.org, bp@...en8.de,
        srinivas.pandruvada@...ux.intel.com, ray.huang@....com
Subject: Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL
 support

On Fri, 9 Sep 2016, Harry Pan wrote:
> -	if (apply_quirk)
> +	if (apply_quirk == RAPL_HSX_QUIRK)
>  		rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
>  
>  	/*
> +	 * Some Atom processors (BYT/BSW) have 2^ESU microjoules increment,
> +	 * refer to Software Developers' Manual, Vol. 3C, Order No. 325384,
> +	 * Table 35-8 of MSR_RAPL_POWER_UNIT
> +	 */
> +	if (apply_quirk == RAPL_BYT_QUIRK) {
> +		for (i = 0; i < NR_RAPL_DOMAINS; i++)
> +			rapl_hw_unit[i] = 32 - rapl_hw_unit[i];
> +	}

switch(quirk) if at all, but see below.

> +	/*
>  	 * Calculate the timer rate:
>  	 * Use reference of 200W for scaling the timeout to avoid counter
>  	 * overflows. 200W = 200 Joules/sec
> @@ -702,47 +742,53 @@ static int __init init_rapl_pmus(void)
>  	{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long)&init }
>  
>  struct intel_rapl_init_fun {
> -	bool apply_quirk;
> +	enum rapl_quirk apply_quirk;

This is silly. Make apply_quirk a function pointer and provide functions
for the different quirks.

>  	int cntr_mask;
>  	struct attribute **attrs;
>  };
>  
>  static const struct intel_rapl_init_fun snb_rapl_init __initconst = {
> -	.apply_quirk = false,
> +	.apply_quirk = RAPL_NO_QUIRK,

Zero ininitalization has no real value other than consuming state space.

Thanks,

	tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ