drivers/pmdomain/renesas/r8a78000-mdlc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
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
On Mon, Sep 7, 2026 at 4:32 PM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> 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>
Applied for next, thanks!
Kind regards
Uffe
> ---
> 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
>
On 26-09-07 16:32:01, Geert Uytterhoeven wrote:
> 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>
Looks OK to me, so:
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
© 2016 - 2026 Red Hat, Inc.