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 <benoit@android.com>
This commit is contained in:
Benoit Goby
2011-01-21 15:53:44 -08:00
committed by 黄涛
parent 9f2a2f5d98
commit 10b41e1029

View File

@@ -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));
}