From: "Pan, Harry" <harry.pan@intel.com>
To: "tglx@linutronix.de" <tglx@linutronix.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"peterz@infradead.org" <peterz@infradead.org>,
"ray.huang@amd.com" <ray.huang@amd.com>,
"x86@kernel.org" <x86@kernel.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"srinivas.pandruvada@linux.intel.com"
<srinivas.pandruvada@linux.intel.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"bp@alien8.de" <bp@alien8.de>
Subject: Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL support
Date: Fri, 9 Sep 2016 17:59:37 +0000 [thread overview]
Message-ID: <1473443970.3685.20.camel@intel.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1609091704460.5679@nanos>
I refined/uploaded again, kindly advise.
On Fri, 2016-09-09 at 17:11 +0200, Thomas Gleixner wrote:
> 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.
Yes, v3 I refined as switch.
>
> > + /*
> > * 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.
I read the rapl_check_hw_unit() as: read MSR_RAPL_POWER_UNIT, apply
quirk if need, then estimate timer rate.
In case to refine struct intel_rapl_init_fun adding callback, then
either the quirk moving outside the rapl_check_hw_unit(), or replace
input parameter as whole rapl_init in order to assess quirk callback, by
far it looks to me centralize these two quirks inside this function more
easily to maintain.
>
> > 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.
To enable more than one quirk I extended bool to enum, I thought the
__initconst space would be freed after kernel initialized, is there more
detail concern I missed?
Sincerely,
Harry
next prev parent reply other threads:[~2016-09-09 17:59 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 RAPL support 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
2016-09-09 17:59 ` Pan, Harry [this message]
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=1473443970.3685.20.camel@intel.com \
--to=harry.pan@intel.com \
--cc=bp@alien8.de \
--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=tglx@linutronix.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.