From: Yunfeng Ye <yeyunfeng@huawei.com>
To: <rjw@rjwysocki.net>, <linux-pm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: <hushiyuan@huawei.com>, <hewenliang4@huawei.com>,
<caihongda@huawei.com>, <yeyunfeng@huawei.com>
Subject: [PATCH 1/2] powercap/intel_rapl: Use topology interface in rapl_add_package()
Date: Sat, 23 Jan 2021 05:06:07 -0500 [thread overview]
Message-ID: <20210123100608.2349629-1-yeyunfeng@huawei.com> (raw)
It's not a good way to access phys_proc_id and cpu_die_id directly.
So using topology_physical_package_id(cpu) and topology_die_id(cpu)
instead.
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
---
drivers/powercap/intel_rapl_common.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
index c9e57237d778..5f3d39b8212a 100644
--- a/drivers/powercap/intel_rapl_common.c
+++ b/drivers/powercap/intel_rapl_common.c
@@ -1309,7 +1309,6 @@ struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv)
{
int id = topology_logical_die_id(cpu);
struct rapl_package *rp;
- struct cpuinfo_x86 *c = &cpu_data(cpu);
int ret;
if (!rapl_defaults)
@@ -1326,10 +1325,11 @@ struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv)
if (topology_max_die_per_package() > 1)
snprintf(rp->name, PACKAGE_DOMAIN_NAME_LENGTH,
- "package-%d-die-%d", c->phys_proc_id, c->cpu_die_id);
+ "package-%d-die-%d",
+ topology_physical_package_id(cpu), topology_die_id(cpu));
else
snprintf(rp->name, PACKAGE_DOMAIN_NAME_LENGTH, "package-%d",
- c->phys_proc_id);
+ topology_physical_package_id(cpu));
/* check if the package contains valid domains */
if (rapl_detect_domains(rp, cpu) || rapl_defaults->check_unit(rp, cpu)) {
--
2.27.0
next reply other threads:[~2021-01-23 10:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-23 10:06 Yunfeng Ye [this message]
2021-01-23 10:06 ` [PATCH 2/2] powercap/intel_rapl: Use topology interface in rapl_init_domains() Yunfeng Ye
2021-02-05 12:46 ` Rafael J. Wysocki
2021-02-05 17:07 ` Srinivas Pandruvada
2021-02-05 12:45 ` [PATCH 1/2] powercap/intel_rapl: Use topology interface in rapl_add_package() Rafael J. Wysocki
2021-02-05 17:07 ` Srinivas Pandruvada
2021-02-12 15:54 ` Rafael J. Wysocki
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=20210123100608.2349629-1-yeyunfeng@huawei.com \
--to=yeyunfeng@huawei.com \
--cc=caihongda@huawei.com \
--cc=hewenliang4@huawei.com \
--cc=hushiyuan@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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).