mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Harry Pan <harry.pan@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	gs0622@gmail.com, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, peterz@infradead.org, bp@alien8.de,
	srinivas.pandruvada@linux.intel.com, ray.huang@amd.com
Subject: Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL support
Date: Fri, 9 Sep 2016 17:11:00 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1609091704460.5679@nanos> (raw)
In-Reply-To: <1473433267-10153-2-git-send-email-harry.pan@intel.com>

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

  reply	other threads:[~2016-09-09 15:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09 15:01 [PATCH 1/2] perf/x86/rapl: Enable Apollo Lake " Harry Pan
2016-09-09 15:01 ` [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell " Harry Pan
2016-09-09 15:11   ` Thomas Gleixner [this message]
2016-09-09 17:59     ` Pan, Harry
2016-09-09 21:21       ` Thomas Gleixner
2016-09-11  3:06         ` Pan, Harry
2016-09-11  5:38         ` Pan, Harry
  -- strict thread matches above, loose matches on Subject: below --
2016-09-09 17:53 [PATCH 1/2] perf/x86/rapl: Enable Apollo Lake " Harry Pan
2016-09-09 17:53 ` [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell " Harry Pan
2016-09-09 21:02   ` kbuild test robot
2016-09-08  9:08 [PATCH 1/2] perf/x86/rapl: Enable Apollo Lake " Harry Pan
2016-09-08  9:08 ` [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell " Harry Pan
2016-09-09  9:29   ` Peter Zijlstra
2016-09-09 15:08     ` Pan, Harry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1609091704460.5679@nanos \
    --to=tglx@linutronix.de \
    --cc=bp@alien8.de \
    --cc=gs0622@gmail.com \
    --cc=harry.pan@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=ray.huang@amd.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®