From: "David E. Box" <david.e.box@linux.intel.com>
To: david.e.box@linux.intel.com, jacob.jun.pan@linux.intel.com,
linux-pm@vger.kernel.org, rafael.j.wysocki@intel.com,
linux-kernel@vger.kernel.org, hpa@linux.intel.com
Cc: alan@linux.intel.com, durgadoss.r@intel.com, kristen.c.accardi@intel.com
Subject: [PATCH v2 1/4] powercap/rapl: further relax energy counter checks
Date: Tue, 29 Apr 2014 15:33:06 -0700 [thread overview]
Message-ID: <1398810789-2301-2-git-send-email-david.e.box@linux.intel.com> (raw)
In-Reply-To: <1398810789-2301-1-git-send-email-david.e.box@linux.intel.com>
From: Jacob Pan <jacob.jun.pan@linux.intel.com>
Energy counters may roll slowly for some RAPL domains, checking all
of them can be time consuming and takes unpredictable amount of time.
Therefore, we relax the sanity check by only checking availability of the
MSRs and non-zero value of the energy status counters. It has been shown
sufficient for all the platforms tested to filter out inactive domains.
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
---
drivers/powercap/intel_rapl.c | 29 +++++++++--------------------
1 file changed, 9 insertions(+), 20 deletions(-)
diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
index d9a0770..1c987d2 100644
--- a/drivers/powercap/intel_rapl.c
+++ b/drivers/powercap/intel_rapl.c
@@ -1124,8 +1124,7 @@ err_cleanup_package:
static int rapl_check_domain(int cpu, int domain)
{
unsigned msr;
- u64 val1, val2 = 0;
- int retry = 0;
+ u64 val = 0;
switch (domain) {
case RAPL_DOMAIN_PACKAGE:
@@ -1144,26 +1143,13 @@ static int rapl_check_domain(int cpu, int domain)
pr_err("invalid domain id %d\n", domain);
return -EINVAL;
}
- if (rdmsrl_safe_on_cpu(cpu, msr, &val1))
- return -ENODEV;
-
- /* PP1/uncore/graphics domain may not be active at the time of
- * driver loading. So skip further checks.
+ /* make sure domain counters are available and contains non-zero
+ * values, otherwise skip it.
*/
- if (domain == RAPL_DOMAIN_PP1)
- return 0;
- /* energy counters roll slowly on some domains */
- while (++retry < 10) {
- usleep_range(10000, 15000);
- rdmsrl_safe_on_cpu(cpu, msr, &val2);
- if ((val1 & ENERGY_STATUS_MASK) != (val2 & ENERGY_STATUS_MASK))
- return 0;
- }
- /* if energy counter does not change, report as bad domain */
- pr_info("domain %s energy ctr %llu:%llu not working, skip\n",
- rapl_domain_names[domain], val1, val2);
+ if (rdmsrl_safe_on_cpu(cpu, msr, &val) || !val)
+ return -ENODEV;
- return -ENODEV;
+ return 0;
}
/* Detect active and valid domains for the given CPU, caller must
@@ -1180,6 +1166,9 @@ static int rapl_detect_domains(struct rapl_package *rp, int cpu)
/* use physical package id to read counters */
if (!rapl_check_domain(cpu, i))
rp->domain_map |= 1 << i;
+ else
+ pr_warn("RAPL domain %s detection failed\n",
+ rapl_domain_names[i]);
}
rp->nr_domains = bitmap_weight(&rp->domain_map, RAPL_DOMAIN_MAX);
if (!rp->nr_domains) {
--
1.7.10.4
next prev parent reply other threads:[~2014-04-29 22:35 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-28 14:04 [PATCH 0/5] RAPL driver updates Jacob Pan
2014-04-28 14:04 ` [PATCH 1/5] powercap/rapl: further relax energy counter checks Jacob Pan
2014-04-28 14:04 ` [PATCH 2/5] powercap/rapl: add new cpu ids Jacob Pan
2014-04-28 14:04 ` [PATCH 3/5] x86, iosf: Add dummy functions for loadable modules Jacob Pan
2014-04-28 14:04 ` [PATCH 4/5] x86/iosf: kconfig and used by other drivers Jacob Pan
2014-04-28 14:04 ` [PATCH 5/5] powercap/rapl: change floor frequency for vallewview Jacob Pan
2014-04-29 2:45 ` R, Durgadoss
2014-04-29 13:02 ` Jacob Pan
2014-04-29 14:40 ` R, Durgadoss
2014-04-29 8:23 ` Jacob Pan
2014-04-29 22:33 ` [PATCH v2 0/4] RAPL driver updates David E. Box
2014-04-29 22:33 ` David E. Box [this message]
2014-04-30 5:29 ` [PATCH v2 1/4] powercap/rapl: further relax energy counter checks R, Durgadoss
2014-04-29 22:33 ` [PATCH v2 2/4] powercap/rapl: add new cpu ids David E. Box
2014-04-29 22:33 ` [PATCH v2 3/4] x86/iosf: Make IOSF driver modular and usable by more drivers David E. Box
2014-04-29 22:33 ` [PATCH v2 4/4] powercap/rapl: change floor frequency for vallewview David E. Box
2014-04-29 23:02 ` [PATCH v2 0/4] RAPL driver updates Rafael J. Wysocki
2014-04-29 23:38 ` Jacob Pan
2014-05-02 17:36 ` [PATCH v3] x86/iosf: Make IOSF driver modular and usable by more drivers David E. Box
2014-05-07 16:48 ` One Thousand Gnomes
2014-05-07 17:04 ` H. Peter Anvin
2014-05-07 17:10 ` One Thousand Gnomes
2014-05-07 17:14 ` H. Peter Anvin
2014-05-07 18:58 ` One Thousand Gnomes
2014-05-07 17:52 ` David E. Box
2014-05-09 20:44 ` [PATCH v4 0/4] x86/iosf: IOSF additional driver/device support David E. Box
2014-05-09 20:44 ` [PATCH v4 1/4] x86/iosf: Make IOSF driver modular and usable by more drivers David E. Box
2014-05-28 21:24 ` [tip:x86/platform] x86, iosf: " tip-bot for David E. Box
2014-05-09 20:44 ` [PATCH v4 2/4] arch: x86: added Quark MBI support David E. Box
2014-05-28 21:24 ` [tip:x86/platform] x86, iosf: Added Quark MBI identifiers tip-bot for Ong Boon Leong
2014-05-09 20:44 ` [PATCH v4 3/4] arch: x86: iosf_mbi: add Quark X1000 pci id David E. Box
2014-05-28 21:25 ` [tip:x86/platform] x86, iosf: Add Quark X1000 PCI ID tip-bot for Ong Boon Leong
2014-05-09 20:44 ` [PATCH v4 4/4] arch: x86: iosf_mbi: add pci id macros for better readability David E. Box
2014-05-28 21:25 ` [tip:x86/platform] x86, iosf: Add PCI ID " tip-bot for Ong Boon Leong
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=1398810789-2301-2-git-send-email-david.e.box@linux.intel.com \
--to=david.e.box@linux.intel.com \
--cc=alan@linux.intel.com \
--cc=durgadoss.r@intel.com \
--cc=hpa@linux.intel.com \
--cc=jacob.jun.pan@linux.intel.com \
--cc=kristen.c.accardi@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).