Re: [PATCH v10 3/4] PM / sleep: Go direct_complete if driver has no callbacks
From: Daniel Kurtz
Date: Mon Oct 26 2015 - 08:57:04 EST
Hi Tomeu,
On Wed, Oct 21, 2015 at 11:34 PM, Tomeu Vizoso
<tomeu.vizoso@xxxxxxxxxxxxx> wrote:
> If a suitable prepare callback cannot be found for a given device and
> its driver has no PM callbacks at all, assume that it can go direct to
> complete when the system goes to sleep.
>
> The reason for this is that there's lots of devices in a system that do
> no PM at all and there's no reason for them to prevent their ancestors
> to do direct_complete if they can support it.
>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@xxxxxxxxxxxxx>
> Reviewed-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
> ---
[snip...]
> diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
> index a70f8a5cdfd7..763eee24cb95 100644
> --- a/drivers/base/power/common.c
> +++ b/drivers/base/power/common.c
> @@ -14,6 +14,8 @@
> #include <linux/acpi.h>
> #include <linux/pm_domain.h>
>
> +#include "power.h"
> +
> /**
> * dev_pm_get_subsys_data - Create or refcount power.subsys_data for device.
> * @dev: Device to handle.
> @@ -147,5 +149,6 @@ void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd)
> WARN(device_is_bound(dev),
> "PM domains can only be changed for unbound devices\n");
> dev->pm_domain = pd;
> + device_pm_check_callbacks(dev);
device_pm_check_callbacks(dev) grabs spin_lock_irq(&dev->power.lock);
But, one of the callers of dev_pm_domain_set() that you just added in
the previous patch "PM / Domains: add setter for dev.pm_domain" also
grabs this same spinlock:
--------------------
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 16550c63d611..b75d02aa8d93 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1240,7 +1240,7 @@ static struct generic_pm_domain_data
*genpd_alloc_dev_data(struct device *dev,
}
dev->power.subsys_data->domain_data = &gpd_data->base;
- dev->pm_domain = &genpd->domain;
+ dev_pm_domain_set(dev, &genpd->domain);
spin_unlock_irq(&dev->power.lock);
--------------------
At least on the board I am testing, this causes a deadlock on boot.
-Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/