lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250326-pmdomain_core-v1-1-c35d342f934f@pengutronix.de>
Date: Wed, 26 Mar 2025 00:13:02 +0100
From: Michael Grzeschik <m.grzeschik@...gutronix.de>
To: Ulf Hansson <ulf.hansson@...aro.org>
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org, 
 kernel@...gutronix.de, Michael Grzeschik <m.grzeschik@...gutronix.de>
Subject: [PATCH] pmdomain: core: only disable unused domains after
 genpd_power_off_unused has passed

If the genpd_power_off_unsused late_initcall did not pass yet, skip any
genpd_power_off call. During the boot phase possible domain consumers
could show up, so it is not helpful to disable and enable the power
domains during that time.

Signed-off-by: Michael Grzeschik <m.grzeschik@...gutronix.de>
---
 drivers/pmdomain/core.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index 6c94137865c9b568666fb296e20e8669574a9576..493eee39e726abd62df8b8def047434871d15125 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -44,6 +44,8 @@ static DEFINE_IDA(genpd_ida);
 static LIST_HEAD(gpd_list);
 static DEFINE_MUTEX(gpd_list_lock);
 
+static bool genpd_power_off_unused_passed;
+
 struct genpd_lock_ops {
 	void (*lock)(struct generic_pm_domain *genpd);
 	void (*lock_nested)(struct generic_pm_domain *genpd, int depth);
@@ -1023,6 +1025,14 @@ static void genpd_power_off_work_fn(struct work_struct *work)
 
 	genpd = container_of(work, struct generic_pm_domain, power_off_work);
 
+	/*
+	 * If the genpd_power_off_unsused late_initcall did not pass yet
+	 * skip any genpd_power_off call since we are still in boot phase
+	 * where possible pw domain consumers could show up.
+	 */
+	if (!genpd_power_off_unused_passed)
+		return;
+
 	genpd_lock(genpd);
 	genpd_power_off(genpd, false, 0);
 	genpd_unlock(genpd);
@@ -1249,6 +1259,8 @@ static int __init genpd_power_off_unused(void)
 		return 0;
 	}
 
+	genpd_power_off_unused_passed = true;
+
 	pr_info("genpd: Disabling unused power domains\n");
 	mutex_lock(&gpd_list_lock);
 
@@ -3272,6 +3284,8 @@ EXPORT_SYMBOL_GPL(of_genpd_parse_idle_states);
 
 static int __init genpd_bus_init(void)
 {
+	genpd_power_off_unused_passed = false;
+
 	return bus_register(&genpd_bus_type);
 }
 core_initcall(genpd_bus_init);

---
base-commit: b3c623b9a94f7f798715c87e7a75ceeecf15292f
change-id: 20250326-pmdomain_core-db2a2f2bc0a6

Best regards,
-- 
Michael Grzeschik <m.grzeschik@...gutronix.de>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ