linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] powercap/intel_rapl: Use topology interface in rapl_add_package()
@ 2021-01-23 10:06 Yunfeng Ye
  2021-01-23 10:06 ` [PATCH 2/2] powercap/intel_rapl: Use topology interface in rapl_init_domains() Yunfeng Ye
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Yunfeng Ye @ 2021-01-23 10:06 UTC (permalink / raw)
  To: rjw, linux-pm, linux-kernel; +Cc: hushiyuan, hewenliang4, caihongda, yeyunfeng

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] powercap/intel_rapl: Use topology interface in rapl_init_domains()
  2021-01-23 10:06 [PATCH 1/2] powercap/intel_rapl: Use topology interface in rapl_add_package() Yunfeng Ye
@ 2021-01-23 10:06 ` Yunfeng Ye
  2021-02-05 12:46   ` Rafael J. Wysocki
  2021-02-05 12:45 ` [PATCH 1/2] powercap/intel_rapl: Use topology interface in rapl_add_package() Rafael J. Wysocki
  2021-02-12 15:54 ` Rafael J. Wysocki
  2 siblings, 1 reply; 7+ messages in thread
From: Yunfeng Ye @ 2021-01-23 10:06 UTC (permalink / raw)
  To: rjw, linux-pm, linux-kernel; +Cc: hushiyuan, hewenliang4, caihongda, yeyunfeng

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(-)

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] powercap/intel_rapl: Use topology interface in rapl_add_package()
  2021-01-23 10:06 [PATCH 1/2] powercap/intel_rapl: Use topology interface in rapl_add_package() Yunfeng Ye
  2021-01-23 10:06 ` [PATCH 2/2] powercap/intel_rapl: Use topology interface in rapl_init_domains() Yunfeng Ye
@ 2021-02-05 12:45 ` Rafael J. Wysocki
  2021-02-05 17:07   ` Srinivas Pandruvada
  2021-02-12 15:54 ` Rafael J. Wysocki
  2 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2021-02-05 12:45 UTC (permalink / raw)
  To: Yunfeng Ye, Srinivas Pandruvada, Zhang, Rui
  Cc: Rafael J. Wysocki, Linux PM, Linux Kernel Mailing List,
	hushiyuan, hewenliang4, caihongda

On Sat, Jan 23, 2021 at 11:07 AM Yunfeng Ye <yeyunfeng@huawei.com> wrote:
>
> 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>

Srinivas, Rui, any concerns?

> ---
>  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
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] powercap/intel_rapl: Use topology interface in rapl_init_domains()
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2021-02-05 12:46 UTC (permalink / raw)
  To: Yunfeng Ye, Srinivas Pandruvada, Zhang, Rui
  Cc: Rafael J. Wysocki, Linux PM, Linux Kernel Mailing List,
	hushiyuan, hewenliang4, caihongda

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
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] powercap/intel_rapl: Use topology interface in rapl_add_package()
  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
  0 siblings, 0 replies; 7+ messages in thread
From: Srinivas Pandruvada @ 2021-02-05 17:07 UTC (permalink / raw)
  To: Rafael J. Wysocki, Yunfeng Ye, Zhang, Rui
  Cc: Rafael J. Wysocki, Linux PM, Linux Kernel Mailing List,
	hushiyuan, hewenliang4, caihongda

On Fri, 2021-02-05 at 13:45 +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 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>
> 
> Srinivas, Rui, any concerns?
Looks good.

Thanks,
Srinivas

> 
> > ---
> >  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
> > 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] powercap/intel_rapl: Use topology interface in rapl_init_domains()
  2021-02-05 12:46   ` Rafael J. Wysocki
@ 2021-02-05 17:07     ` Srinivas Pandruvada
  0 siblings, 0 replies; 7+ messages in thread
From: Srinivas Pandruvada @ 2021-02-05 17:07 UTC (permalink / raw)
  To: Rafael J. Wysocki, Yunfeng Ye, Zhang, Rui
  Cc: Rafael J. Wysocki, Linux PM, Linux Kernel Mailing List,
	hushiyuan, hewenliang4, caihongda

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
> > 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] powercap/intel_rapl: Use topology interface in rapl_add_package()
  2021-01-23 10:06 [PATCH 1/2] powercap/intel_rapl: Use topology interface in rapl_add_package() Yunfeng Ye
  2021-01-23 10:06 ` [PATCH 2/2] powercap/intel_rapl: Use topology interface in rapl_init_domains() Yunfeng Ye
  2021-02-05 12:45 ` [PATCH 1/2] powercap/intel_rapl: Use topology interface in rapl_add_package() Rafael J. Wysocki
@ 2021-02-12 15:54 ` Rafael J. Wysocki
  2 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2021-02-12 15:54 UTC (permalink / raw)
  To: Yunfeng Ye
  Cc: Rafael J. Wysocki, Linux PM, Linux Kernel Mailing List,
	hushiyuan, hewenliang4, caihongda

On Sat, Jan 23, 2021 at 11:07 AM Yunfeng Ye <yeyunfeng@huawei.com> wrote:
>
> 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)) {
> --

Applied along with the [2/2] with some minor changelog edits as 5.12 material.

Thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-12 15:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-23 10:06 [PATCH 1/2] powercap/intel_rapl: Use topology interface in rapl_add_package() Yunfeng Ye
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

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).