This is a note to let you know that I've just added the patch titled pmdomain: core: Don't hold the genpd-lock when calling dev_pm_domain_set() to the 6.11-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: pmdomain-core-don-t-hold-the-genpd-lock-when-calling.patch and it can be found in the queue-6.11 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 8966a7528c9ca10e6d8c008c8c8c6704103c7f30 Author: Ulf Hansson <ulf.hansson@xxxxxxxxxx> Date: Mon May 27 16:25:52 2024 +0200 pmdomain: core: Don't hold the genpd-lock when calling dev_pm_domain_set() [ Upstream commit b87eee38605c396f0e1fa435939960e5c6cd41d6 ] There is no need to hold the genpd-lock, while assigning the dev->pm_domain. In fact, it becomes a problem on a PREEMPT_RT based configuration as the genpd-lock may be a raw spinlock, while the lock acquired through the call to dev_pm_domain_set() is a regular spinlock. To fix the problem, let's simply move the calls to dev_pm_domain_set() outside the genpd-lock. Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx> Tested-by: Raghavendra Kakarla <quic_rkakarla@xxxxxxxxxxx> # qcm6490 with PREEMPT_RT set Acked-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20240527142557.321610-3-ulf.hansson@xxxxxxxxxx Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index acdc3e7b2eae2..ca7f780582cf4 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -1758,7 +1758,6 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, genpd_lock(genpd); genpd_set_cpumask(genpd, gpd_data->cpu); - dev_pm_domain_set(dev, &genpd->domain); genpd->device_count++; if (gd) @@ -1767,6 +1766,7 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, list_add_tail(&gpd_data->base.list_node, &genpd->dev_list); genpd_unlock(genpd); + dev_pm_domain_set(dev, &genpd->domain); out: if (ret) genpd_free_dev_data(dev, gpd_data); @@ -1823,12 +1823,13 @@ static int genpd_remove_device(struct generic_pm_domain *genpd, genpd->gd->max_off_time_changed = true; genpd_clear_cpumask(genpd, gpd_data->cpu); - dev_pm_domain_set(dev, NULL); list_del_init(&pdd->list_node); genpd_unlock(genpd); + dev_pm_domain_set(dev, NULL); + if (genpd->detach_dev) genpd->detach_dev(genpd, dev);