PM / sleep: add pm-trace support for suspending phase
Occasionally, the system can't come back up after suspend/resume due to problems of device suspending phase. This patch make PM_TRACE infrastructure cover device suspending phase of suspend/resume process, and the information in RTC can tell developers which device suspending function make system hang. Signed-off-by: Zhonghui Fu <zhonghui.fu@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Esse commit está contido em:
@@ -23,7 +23,7 @@
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/resume-trace.h>
|
||||
#include <linux/pm-trace.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/async.h>
|
||||
@@ -1017,6 +1017,9 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a
|
||||
char *info = NULL;
|
||||
int error = 0;
|
||||
|
||||
TRACE_DEVICE(dev);
|
||||
TRACE_SUSPEND(0);
|
||||
|
||||
if (async_error)
|
||||
goto Complete;
|
||||
|
||||
@@ -1057,6 +1060,7 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a
|
||||
|
||||
Complete:
|
||||
complete_all(&dev->power.completion);
|
||||
TRACE_SUSPEND(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1078,7 +1082,7 @@ static int device_suspend_noirq(struct device *dev)
|
||||
{
|
||||
reinit_completion(&dev->power.completion);
|
||||
|
||||
if (pm_async_enabled && dev->power.async_suspend) {
|
||||
if (is_async(dev)) {
|
||||
get_device(dev);
|
||||
async_schedule(async_suspend_noirq, dev);
|
||||
return 0;
|
||||
@@ -1157,6 +1161,9 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as
|
||||
char *info = NULL;
|
||||
int error = 0;
|
||||
|
||||
TRACE_DEVICE(dev);
|
||||
TRACE_SUSPEND(0);
|
||||
|
||||
__pm_runtime_disable(dev, false);
|
||||
|
||||
if (async_error)
|
||||
@@ -1198,6 +1205,7 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as
|
||||
async_error = error;
|
||||
|
||||
Complete:
|
||||
TRACE_SUSPEND(error);
|
||||
complete_all(&dev->power.completion);
|
||||
return error;
|
||||
}
|
||||
@@ -1219,7 +1227,7 @@ static int device_suspend_late(struct device *dev)
|
||||
{
|
||||
reinit_completion(&dev->power.completion);
|
||||
|
||||
if (pm_async_enabled && dev->power.async_suspend) {
|
||||
if (is_async(dev)) {
|
||||
get_device(dev);
|
||||
async_schedule(async_suspend_late, dev);
|
||||
return 0;
|
||||
@@ -1338,6 +1346,9 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
|
||||
int error = 0;
|
||||
DECLARE_DPM_WATCHDOG_ON_STACK(wd);
|
||||
|
||||
TRACE_DEVICE(dev);
|
||||
TRACE_SUSPEND(0);
|
||||
|
||||
dpm_wait_for_children(dev, async);
|
||||
|
||||
if (async_error)
|
||||
@@ -1444,6 +1455,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
|
||||
if (error)
|
||||
async_error = error;
|
||||
|
||||
TRACE_SUSPEND(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1465,7 +1477,7 @@ static int device_suspend(struct device *dev)
|
||||
{
|
||||
reinit_completion(&dev->power.completion);
|
||||
|
||||
if (pm_async_enabled && dev->power.async_suspend) {
|
||||
if (is_async(dev)) {
|
||||
get_device(dev);
|
||||
async_schedule(async_suspend, dev);
|
||||
return 0;
|
||||
|
Referência em uma nova issue
Block a user