]> git.baikalelectronics.ru Git - kernel.git/commitdiff
interconnect: Teach lockdep about icc_bw_lock order
authorRob Clark <robdclark@chromium.org>
Mon, 7 Aug 2023 17:11:41 +0000 (10:11 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Sep 2023 09:11:13 +0000 (11:11 +0200)
commit 13619170303878e1dae86d9a58b039475c957fcf upstream.

Teach lockdep that icc_bw_lock is needed in code paths that could
deadlock if they trigger reclaim.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Link: https://lore.kernel.org/r/20230807171148.210181-8-robdclark@gmail.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/interconnect/core.c

index f4a493d78ee9ad42423181b40db767657e7dc154..e4b2d9ef61b4d90cb2966093082d2f3981a1c929 100644 (file)
@@ -1145,13 +1145,21 @@ void icc_sync_state(struct device *dev)
                        }
                }
        }
+       mutex_unlock(&icc_bw_lock);
        mutex_unlock(&icc_lock);
 }
 EXPORT_SYMBOL_GPL(icc_sync_state);
 
 static int __init icc_init(void)
 {
-       struct device_node *root = of_find_node_by_path("/");
+       struct device_node *root;
+
+       /* Teach lockdep about lock ordering wrt. shrinker: */
+       fs_reclaim_acquire(GFP_KERNEL);
+       might_lock(&icc_bw_lock);
+       fs_reclaim_release(GFP_KERNEL);
+
+       root = of_find_node_by_path("/");
 
        providers_count = of_count_icc_providers(root);
        of_node_put(root);