diff mbox series

[2/2] powercap/intel_rapl: Use topology interface in rapl_init_domains()

Message ID 20210123100608.2349629-2-yeyunfeng@huawei.com
State Accepted
Commit 65348ba259e27ad4b69459ef477facd4c702bbf6
Headers show
Series None | expand

Commit Message

Yunfeng Ye Jan. 23, 2021, 10:06 a.m. UTC
It's not a good way to access the phys_proc_id of cpuinfo directly.
So using topology_physical_package_id(cpu) instead.

Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
---
 drivers/powercap/intel_rapl_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rafael J. Wysocki Feb. 5, 2021, 12:46 p.m. UTC | #1
On Sat, Jan 23, 2021 at 11:07 AM Yunfeng Ye <yeyunfeng@huawei.com> wrote:
>

> It's not a good way to access the phys_proc_id of cpuinfo directly.

> So using topology_physical_package_id(cpu) instead.

>

> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>


Srinivas, Rui, any concerns?

> ---

>  drivers/powercap/intel_rapl_common.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c

> index 5f3d39b8212a..8888adcb3927 100644

> --- a/drivers/powercap/intel_rapl_common.c

> +++ b/drivers/powercap/intel_rapl_common.c

> @@ -547,7 +547,7 @@ static void rapl_init_domains(struct rapl_package *rp)

>

>                 if (i == RAPL_DOMAIN_PLATFORM && rp->id > 0) {

>                         snprintf(rd->name, RAPL_DOMAIN_NAME_LENGTH, "psys-%d",

> -                               cpu_data(rp->lead_cpu).phys_proc_id);

> +                               topology_physical_package_id(rp->lead_cpu));

>                 } else

>                         snprintf(rd->name, RAPL_DOMAIN_NAME_LENGTH, "%s",

>                                 rapl_domain_names[i]);

> --

> 2.27.0

>
Srinivas Pandruvada Feb. 5, 2021, 5:07 p.m. UTC | #2
On Fri, 2021-02-05 at 13:46 +0100, Rafael J. Wysocki wrote:
> On Sat, Jan 23, 2021 at 11:07 AM Yunfeng Ye <yeyunfeng@huawei.com>

> wrote:

> > It's not a good way to access the phys_proc_id of cpuinfo directly.

> > So using topology_physical_package_id(cpu) instead.

> > 

> > Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>

> 

> Srinivas, Rui, any concerns?

Looks good.

Thanks,
Srinivas

> 

> > ---

> >  drivers/powercap/intel_rapl_common.c | 2 +-

> >  1 file changed, 1 insertion(+), 1 deletion(-)

> > 

> > diff --git a/drivers/powercap/intel_rapl_common.c

> > b/drivers/powercap/intel_rapl_common.c

> > index 5f3d39b8212a..8888adcb3927 100644

> > --- a/drivers/powercap/intel_rapl_common.c

> > +++ b/drivers/powercap/intel_rapl_common.c

> > @@ -547,7 +547,7 @@ static void rapl_init_domains(struct

> > rapl_package *rp)

> > 

> >                 if (i == RAPL_DOMAIN_PLATFORM && rp->id > 0) {

> >                         snprintf(rd->name, RAPL_DOMAIN_NAME_LENGTH,

> > "psys-%d",

> > -                               cpu_data(rp-

> > >lead_cpu).phys_proc_id);

> > +                               topology_physical_package_id(rp-

> > >lead_cpu));

> >                 } else

> >                         snprintf(rd->name, RAPL_DOMAIN_NAME_LENGTH,

> > "%s",

> >                                 rapl_domain_names[i]);

> > --

> > 2.27.0

> >
diff mbox series

Patch

diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
index 5f3d39b8212a..8888adcb3927 100644
--- a/drivers/powercap/intel_rapl_common.c
+++ b/drivers/powercap/intel_rapl_common.c
@@ -547,7 +547,7 @@  static void rapl_init_domains(struct rapl_package *rp)
 
 		if (i == RAPL_DOMAIN_PLATFORM && rp->id > 0) {
 			snprintf(rd->name, RAPL_DOMAIN_NAME_LENGTH, "psys-%d",
-				cpu_data(rp->lead_cpu).phys_proc_id);
+				topology_physical_package_id(rp->lead_cpu));
 		} else
 			snprintf(rd->name, RAPL_DOMAIN_NAME_LENGTH, "%s",
 				rapl_domain_names[i]);