Thread (3 messages) flat view 3 messages, 3 authors, 4d ago
COOLING4d

[PATCH] pmdomain: renesas: r8a78000: Fix lockdep false positive

From: Geert Uytterhoeven <geert+renesas@glider.be>
Date: 2026-09-07 14:32:07
Also in: linux-renesas-soc, lkml
Subsystem: arm/risc-v/renesas architecture, generic pm domains, the rest · Maintainers: Geert Uytterhoeven, Magnus Damm, Ulf Hansson, Linus Torvalds

Lockdep reports a possible circular locking dependency when attaching
devices to an MDLC PM domain:

  - During creation of the singleton PM domain:
      A. r8a78000_genpd_always_on_singleton() takes r8a78000_mdlc_lock,
      B. pm_genpd_init() takes gpd_list_lock.

  - During attachment of devices to PM domains:
      A. pm_genpd_add_device() takes gpd_list_lock,
      B. r8a78000_mdlc_attach_dev() takes r8a78000_mdlc_lock.

As the former is done only once, before any devices are attached, such a
AB-BA deadlock cannot really happen.  Fix this false positive by
introducing a separate lock to protect the creation of the singleton
domain.

Fixes: 89e6a71b35703f10 ("pmdomain: renesas: Add R-Car X5H MDLC driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/pmdomain/renesas/r8a78000-mdlc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pmdomain/renesas/r8a78000-mdlc.c b/drivers/pmdomain/renesas/r8a78000-mdlc.c
index 2668fc2ac9cbd388..1fd71bb3da776eb1 100644
--- a/drivers/pmdomain/renesas/r8a78000-mdlc.c
+++ b/drivers/pmdomain/renesas/r8a78000-mdlc.c
@@ -45,8 +45,9 @@ struct r8a78000_mdlc_priv {
 };
 
 static struct generic_pm_domain *r8a78000_genpd_always_on;
+
 static HLIST_HEAD(r8a78000_mdlc_list);
-static DEFINE_MUTEX(r8a78000_mdlc_lock);	/* protects the two above */
+static DEFINE_MUTEX(r8a78000_mdlc_lock);	/* protects the list above */
 
 static struct generic_pm_domain *r8a78000_genpd_xlate(
 			const struct of_phandle_args *spec, void *data)
@@ -191,10 +192,11 @@ static void r8a78000_genpd_del_provider(void *data)
 
 static int r8a78000_genpd_always_on_singleton(struct device *dev)
 {
+	static DEFINE_MUTEX(singleton_lock);
 	struct generic_pm_domain *genpd;
 	int ret;
 
-	guard(mutex)(&r8a78000_mdlc_lock);
+	guard(mutex)(&singleton_lock);
 
 	if (r8a78000_genpd_always_on)
 		return 0;
-- 
2.43.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help