Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1480101

Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL support

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL support
Date 2016-09-09 17:20 +0200
Message-ID <sfvKW-4Fq-23@gated-at.bofh.it> (permalink)
References <sfvBf-4BZ-15@gated-at.bofh.it> <sfvBg-4BZ-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] perf/x86/rapl: Enable Apollo Lake RAPL support Harry Pan <harry.pan@intel.com> - 2016-09-09 17:10 +0200
  [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL support Harry Pan <harry.pan@intel.com> - 2016-09-09 17:10 +0200
    Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL  support Thomas Gleixner <tglx@linutronix.de> - 2016-09-09 17:20 +0200
      Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL support "Pan, Harry" <harry.pan@intel.com> - 2016-09-09 20:00 +0200
        Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL  support Thomas Gleixner <tglx@linutronix.de> - 2016-09-09 23:30 +0200
          Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL support "Pan, Harry" <harry.pan@intel.com> - 2016-09-11 05:10 +0200
          Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL support "Pan, Harry" <harry.pan@intel.com> - 2016-09-11 07:40 +0200

csiph-web