Skip to contentSkip to conversation

powercap/drivers/dtpm: Fix root node initialization

PATCH In review Daniel Lezcano 2 participants 4 messages Feb 24, 2021 – Mar 1, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 powercap/drivers/dtpm: Fix root node initialization

The root node is not set to NULL when the dtpm root node is removed. Consequently, it is not possible to create a new root as it is already set.

Set the root node to NULL when the last node is removed.

---
 drivers/powercap/dtpm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/powercap/dtpm.c +3 -0
index 5a51cd34a7e8..c2185ec5f887 100644
@@ -207,6 +207,9 @@ int dtpm_release_zone(struct powercap_zone *pcz)
 	if (dtpm->ops)
 		dtpm->ops->release(dtpm);
 
+	if (root == dtpm)
+		root = NULL;
+
 	kfree(dtpm);
 
 	return 0;
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 powercap/drivers/dtpm: Add the experimental label to the option description

The DTPM framework will evolve in the next cycles. Let's add a temporary EXPERIMENTAL tag to the option so users will be aware the API may change over time.

---
 drivers/powercap/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/powercap/Kconfig +1 -1
index 20b4325c6161..8242e8c5ed77 100644
@@ -45,7 +45,7 @@ config IDLE_INJECT
 	  on a per CPU basis.
 
 config DTPM
-	bool "Power capping for Dynamic Thermal Power Management"
+	bool "Power capping for Dynamic Thermal Power Management (EXPERIMENTAL)"
 	help
 	  This enables support for the power capping for the dynamic
 	  thermal power management userspace engine.
Signature · 1 line
2.17.1
#2 lore raw
In reply to Daniel Lezcano
Quoted 17 lines · Daniel Lezcano

The root node is not set to NULL when the dtpm root node is removed. Consequently, it is not possible to create a new root as it is already set.

Set the root node to NULL when the last node is removed.

---
 drivers/powercap/dtpm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/powercap/dtpm.c +0 -0
index 5a51cd34a7e8..c2185ec5f887 100644

drivers/powercap/dtpm.c int dtpm_release_zone(struct powercap_zone *pcz)

Quoted 10 lines
drivers/powercap/dtpm.c +3 -1
@@ -207,6 +207,9 @@ int dtpm_release_zone(struct powercap_zone *pcz)
        if (dtpm->ops)
                dtpm->ops->release(dtpm);
 
+       if (root == dtpm)
+               root = NULL;
+
        kfree(dtpm);
 
        return 0;
--

Applied along with the [2/2[ as 5.12-rc material, thanks!

#3 lore raw
Quoted 27 lines · Rafael J. Wysocki
Quoted 25 lines · Daniel Lezcano

The root node is not set to NULL when the dtpm root node is removed. Consequently, it is not possible to create a new root as it is already set.

Set the root node to NULL when the last node is removed.

---
 drivers/powercap/dtpm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/powercap/dtpm.c +3 -0
index 5a51cd34a7e8..c2185ec5f887 100644
@@ -207,6 +207,9 @@ int dtpm_release_zone(struct powercap_zone *pcz)
        if (dtpm->ops)
                dtpm->ops->release(dtpm);
 
+       if (root == dtpm)
+               root = NULL;
+
        kfree(dtpm);
 
Quoted 4 lines

drivers/powercap/dtpm.c int dtpm_release_zone(struct powercap_zone *pcz)

Quoted 2 lines
drivers/powercap/dtpm.c +0 -1
        return 0;
--

Applied along with the [2/2[ as 5.12-rc material, thanks!

Thanks

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog