2019-05-06 21:29:41

by Len Brown

[permalink] [raw]
Subject: [PATCH 10/22] powercap/intel_rapl: Support multi-die/package

From: Zhang Rui <[email protected]>

RAPL "package" domains are actually implemented in hardware per-die.
Thus, the new multi-die/package systems have mulitple domains
within each physical package.

Update the intel_rapl driver to be "die aware" -- exporting multiple
domains within a single package, when present.
No change on single die/package systems.

Signed-off-by: Zhang Rui <[email protected]>
Signed-off-by: Len Brown <[email protected]>
Acked-by: Rafael J. Wysocki <[email protected]>
Cc: [email protected]
---
drivers/powercap/intel_rapl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
index 3c3c0c23180b..9202dbcef96d 100644
--- a/drivers/powercap/intel_rapl.c
+++ b/drivers/powercap/intel_rapl.c
@@ -266,7 +266,7 @@ static struct rapl_domain *platform_rapl_domain; /* Platform (PSys) domain */
/* caller to ensure CPU hotplug lock is held */
static struct rapl_package *rapl_find_package_domain(int cpu)
{
- int id = topology_physical_package_id(cpu);
+ int id = topology_logical_die_id(cpu);
struct rapl_package *rp;

list_for_each_entry(rp, &rapl_packages, plist) {
@@ -1459,7 +1459,7 @@ static void rapl_remove_package(struct rapl_package *rp)
/* called from CPU hotplug notifier, hotplug lock held */
static struct rapl_package *rapl_add_package(int cpu)
{
- int id = topology_physical_package_id(cpu);
+ int id = topology_logical_die_id(cpu);
struct rapl_package *rp;
int ret;

--
2.18.0-rc0


2019-05-07 12:18:47

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 10/22] powercap/intel_rapl: Support multi-die/package

On Mon, May 06, 2019 at 05:26:05PM -0400, Len Brown wrote:
> From: Zhang Rui <[email protected]>
>
> RAPL "package" domains are actually implemented in hardware per-die.
> Thus, the new multi-die/package systems have mulitple domains
> within each physical package.
>
> Update the intel_rapl driver to be "die aware" -- exporting multiple
> domains within a single package, when present.
> No change on single die/package systems.
>
> Signed-off-by: Zhang Rui <[email protected]>
> Signed-off-by: Len Brown <[email protected]>
> Acked-by: Rafael J. Wysocki <[email protected]>
> Cc: [email protected]
> ---
> drivers/powercap/intel_rapl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
> index 3c3c0c23180b..9202dbcef96d 100644
> --- a/drivers/powercap/intel_rapl.c
> +++ b/drivers/powercap/intel_rapl.c
> @@ -266,7 +266,7 @@ static struct rapl_domain *platform_rapl_domain; /* Platform (PSys) domain */
> /* caller to ensure CPU hotplug lock is held */
> static struct rapl_package *rapl_find_package_domain(int cpu)
> {
> - int id = topology_physical_package_id(cpu);
> + int id = topology_logical_die_id(cpu);
> struct rapl_package *rp;
>
> list_for_each_entry(rp, &rapl_packages, plist) {
> @@ -1459,7 +1459,7 @@ static void rapl_remove_package(struct rapl_package *rp)
> /* called from CPU hotplug notifier, hotplug lock held */
> static struct rapl_package *rapl_add_package(int cpu)
> {
> - int id = topology_physical_package_id(cpu);
> + int id = topology_logical_die_id(cpu);
> struct rapl_package *rp;
> int ret;

Both functions are still misnomers. rapl_find_package_domain() does in
fact now do rapl_find_die_domain(), right? Same for rapl_add_package()

2019-05-08 19:48:28

by Len Brown

[permalink] [raw]
Subject: Re: [PATCH 10/22] powercap/intel_rapl: Support multi-die/package

On Tue, May 7, 2019 at 8:15 AM Peter Zijlstra <[email protected]> wrote:
>
> On Mon, May 06, 2019 at 05:26:05PM -0400, Len Brown wrote:
> > From: Zhang Rui <[email protected]>
> >
> > RAPL "package" domains are actually implemented in hardware per-die.
> > Thus, the new multi-die/package systems have mulitple domains
> > within each physical package.
> >
> > Update the intel_rapl driver to be "die aware" -- exporting multiple
> > domains within a single package, when present.
> > No change on single die/package systems.
> >
> > Signed-off-by: Zhang Rui <[email protected]>
> > Signed-off-by: Len Brown <[email protected]>
> > Acked-by: Rafael J. Wysocki <[email protected]>
> > Cc: [email protected]
> > ---
> > drivers/powercap/intel_rapl.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
> > index 3c3c0c23180b..9202dbcef96d 100644
> > --- a/drivers/powercap/intel_rapl.c
> > +++ b/drivers/powercap/intel_rapl.c
> > @@ -266,7 +266,7 @@ static struct rapl_domain *platform_rapl_domain; /* Platform (PSys) domain */
> > /* caller to ensure CPU hotplug lock is held */
> > static struct rapl_package *rapl_find_package_domain(int cpu)
> > {
> > - int id = topology_physical_package_id(cpu);
> > + int id = topology_logical_die_id(cpu);
> > struct rapl_package *rp;

> Both functions are still misnomers. rapl_find_package_domain() does in
> fact now do rapl_find_die_domain(), right? Same for rapl_add_package()

A "RAPL Package Domain" (rapl_package, above) is a known proper noun --
it is a known documented capability.

When there could be just 1 die in a package, the name of this capability
also always matched the scope of a physical package.

Now that some products have two die in the same package, there
can be two of these inside a package, and they are associated with
each die.

There are no plans to re-name the Package RAPL Domain capability
in the hardware documentation.

Similarly, there are no plans to re-name any of the other "PACKAGE"
scoped MSRs to have "DIE" in their name instead. The ship with
those names sailed long ago.

I think the code above reflects its function, and that somebody maintaining
it will be clear on this. That is important, because in the future, there will
be a concept of PACKAGE scoped MSRs that span multiple DIE...

cheers,
Len Brown, Intel Open Source Technology Center