From: Benoit Goby Date: Fri, 21 Jan 2011 23:53:44 +0000 (-0800) Subject: PM: Dump suspend thread stack on dpm suspend timeout X-Git-Tag: firefly_0821_release~10785^2~12^2~11 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=10b41e10292b412a3e0cc506cd5344d0898cdab9;p=firefly-linux-kernel-4.4.55.git PM: Dump suspend thread stack on dpm suspend timeout When a driver takes more than 3 seconds to suspend, dump the suspend thread stack since BUG() might only dump the idle thread stack. Change-Id: If854db355fdcf3b773ea20b1b5e031def6d4b114 Signed-off-by: Benoit Goby --- diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 55b9e6bd4f1b..0855a10337ee 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -46,6 +46,10 @@ static DEFINE_MUTEX(dpm_list_mtx); static void dpm_drv_timeout(unsigned long data); static DEFINE_TIMER(dpm_drv_wd, dpm_drv_timeout, 0, 0); +static struct { + struct device *dev; + struct task_struct *tsk; +} dpm_drv_wd_data; /* * Set once the preparation of devices for a PM transition has started, reset @@ -446,10 +450,15 @@ static int device_resume(struct device *dev, pm_message_t state) */ static void dpm_drv_timeout(unsigned long data) { - struct device *dev = (struct device *) data; + struct device *dev = dpm_drv_wd_data.dev; + struct task_struct *tsk = dpm_drv_wd_data.tsk; printk(KERN_EMERG "**** DPM device timeout: %s (%s)\n", dev_name(dev), (dev->driver ? dev->driver->name : "no driver")); + + printk(KERN_EMERG "dpm suspend stack:\n"); + show_stack(tsk, NULL); + BUG(); } @@ -460,7 +469,9 @@ static void dpm_drv_timeout(unsigned long data) */ static void dpm_drv_wdset(struct device *dev) { - dpm_drv_wd.data = (unsigned long) dev; + dpm_drv_wd_data.dev = dev; + dpm_drv_wd_data.tsk = get_current(); + dpm_drv_wd.data = (unsigned long) &dpm_drv_wd_data; mod_timer(&dpm_drv_wd, jiffies + (HZ * 3)); }