Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1693309 > unrolled thread
| Started by | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| First post | 2017-07-21 02:30 +0200 |
| Last post | 2017-07-21 02:30 +0200 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 0/4] PM / suspend: Suspend-to-idle core optimization "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-07-21 02:30 +0200
[PATCH 3/4] PM / core: Add error argument to dpm_show_time() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-07-21 02:30 +0200
[PATCH 4/4] PM / sleep: Check pm_wakeup_pending() in __device_suspend_noirq() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-07-21 02:30 +0200
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Date | 2017-07-21 02:30 +0200 |
| Subject | [PATCH 0/4] PM / suspend: Suspend-to-idle core optimization |
| Message-ID | <u5tZn-68f-3@gated-at.bofh.it> |
Hi, This series is on top of the one I sent a couple of days ago: http://marc.info/?l=linux-pm&m=150042550025820&w=2 but it is mostly independent of that one. Basically, it restores the pm_wakeup_pending() check in __suspend_device_noirq() removed recently, which may avoid unnecessary device ping-pong if there's a wakeup event during "noirq" suspend, and makes suspend-to-idle take that check into account (it actually matters more for suspend-to-idle, because it may carry out "noirq" phases of device suspend/resume for multiple times in one cycle). It also makes debug messages from the core device suspend/resume code look better on failures (or when operations are aborted by pending wakeup events). Thanks, Rafael
[toc] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Date | 2017-07-21 02:30 +0200 |
| Subject | [PATCH 3/4] PM / core: Add error argument to dpm_show_time() |
| Message-ID | <u5tZo-68f-11@gated-at.bofh.it> |
| In reply to | #1693309 |
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Make the core device suspend/resume code also call dpm_show_time()
on failures and add an error argument to this function so that the
message printed by it can reflect the success or failure condition.
This makes the debug messages in question look less confusing in
the failing cases.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/base/power/main.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
Index: linux-pm/drivers/base/power/main.c
===================================================================
--- linux-pm.orig/drivers/base/power/main.c
+++ linux-pm/drivers/base/power/main.c
@@ -418,7 +418,7 @@ static void pm_dev_err(struct device *de
dev_name(dev), pm_verb(state.event), info, error);
}
-static void dpm_show_time(ktime_t starttime, pm_message_t state,
+static void dpm_show_time(ktime_t starttime, pm_message_t state, int error,
const char *info)
{
ktime_t calltime;
@@ -432,8 +432,9 @@ static void dpm_show_time(ktime_t startt
if (usecs == 0)
usecs = 1;
- pm_pr_dbg("%s%s%s of devices complete after %ld.%03ld msecs\n",
+ pm_pr_dbg("%s%s%s of devices %s after %ld.%03ld msecs\n",
info ?: "", info ? " " : "", pm_verb(state.event),
+ error ? "aborted" : "complete",
usecs / USEC_PER_MSEC, usecs % USEC_PER_MSEC);
}
@@ -643,7 +644,7 @@ void dpm_noirq_resume_devices(pm_message
}
mutex_unlock(&dpm_list_mtx);
async_synchronize_full();
- dpm_show_time(starttime, state, "noirq");
+ dpm_show_time(starttime, state, 0, "noirq");
trace_suspend_resume(TPS("dpm_resume_noirq"), state.event, false);
}
@@ -782,7 +783,7 @@ void dpm_resume_early(pm_message_t state
}
mutex_unlock(&dpm_list_mtx);
async_synchronize_full();
- dpm_show_time(starttime, state, "early");
+ dpm_show_time(starttime, state, 0, "early");
trace_suspend_resume(TPS("dpm_resume_early"), state.event, false);
}
@@ -954,7 +955,7 @@ void dpm_resume(pm_message_t state)
}
mutex_unlock(&dpm_list_mtx);
async_synchronize_full();
- dpm_show_time(starttime, state, NULL);
+ dpm_show_time(starttime, state, 0, NULL);
cpufreq_resume();
trace_suspend_resume(TPS("dpm_resume"), state.event, false);
@@ -1211,9 +1212,8 @@ int dpm_noirq_suspend_devices(pm_message
if (error) {
suspend_stats.failed_suspend_noirq++;
dpm_save_failed_step(SUSPEND_SUSPEND_NOIRQ);
- } else {
- dpm_show_time(starttime, state, "noirq");
}
+ dpm_show_time(starttime, state, error, "noirq");
trace_suspend_resume(TPS("dpm_suspend_noirq"), state.event, false);
return error;
}
@@ -1371,9 +1371,8 @@ int dpm_suspend_late(pm_message_t state)
suspend_stats.failed_suspend_late++;
dpm_save_failed_step(SUSPEND_SUSPEND_LATE);
dpm_resume_early(resume_event(state));
- } else {
- dpm_show_time(starttime, state, "late");
}
+ dpm_show_time(starttime, state, error, "late");
trace_suspend_resume(TPS("dpm_suspend_late"), state.event, false);
return error;
}
@@ -1639,8 +1638,8 @@ int dpm_suspend(pm_message_t state)
if (error) {
suspend_stats.failed_suspend++;
dpm_save_failed_step(SUSPEND_SUSPEND);
- } else
- dpm_show_time(starttime, state, NULL);
+ }
+ dpm_show_time(starttime, state, error, NULL);
trace_suspend_resume(TPS("dpm_suspend"), state.event, false);
return error;
}
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Date | 2017-07-21 02:30 +0200 |
| Subject | [PATCH 4/4] PM / sleep: Check pm_wakeup_pending() in __device_suspend_noirq() |
| Message-ID | <u5tZo-68f-17@gated-at.bofh.it> |
| In reply to | #1693309 |
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Restore the pm_wakeup_pending() check in __device_suspend_noirq()
removed by commit eed4d47efe95 (ACPI / sleep: Ignore spurious SCI
wakeups from suspend-to-idle) as that allows the function to return
earlier if there's a wakeup event pending already (so that it may
spend less time on carrying out operations that will be reversed
shortly anyway) and rework the main suspend-to-idle loop to take
that optimization into account.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/base/power/main.c | 5 +++++
kernel/power/suspend.c | 19 ++++++++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
Index: linux-pm/kernel/power/suspend.c
===================================================================
--- linux-pm.orig/kernel/power/suspend.c
+++ linux-pm/kernel/power/suspend.c
@@ -106,19 +106,32 @@ static void s2idle_loop(void)
{
pm_pr_dbg("suspend-to-idle\n");
- while (!dpm_suspend_noirq(PMSG_SUSPEND)) {
+ for (;;) {
+ int error;
+
+ dpm_noirq_begin();
+
/*
* Suspend-to-idle equals
* frozen processes + suspended devices + idle processors.
* Thus freeze_enter() should be called right after
* all devices have been suspended.
*/
- freeze_enter();
+ error = dpm_noirq_suspend_devices(PMSG_SUSPEND);
+ if (!error)
+ freeze_enter();
+
+ dpm_noirq_resume_devices(PMSG_RESUME);
+ if (error && (error != -EBUSY || !pm_wakeup_pending())) {
+ dpm_noirq_end();
+ break;
+ }
if (freeze_ops && freeze_ops->wake)
freeze_ops->wake();
- dpm_resume_noirq(PMSG_RESUME);
+ dpm_noirq_end();
+
if (freeze_ops && freeze_ops->sync)
freeze_ops->sync();
Index: linux-pm/drivers/base/power/main.c
===================================================================
--- linux-pm.orig/drivers/base/power/main.c
+++ linux-pm/drivers/base/power/main.c
@@ -1105,6 +1105,11 @@ static int __device_suspend_noirq(struct
if (async_error)
goto Complete;
+ if (pm_wakeup_pending()) {
+ async_error = -EBUSY;
+ goto Complete;
+ }
+
if (dev->power.syscore || dev->power.direct_complete)
goto Complete;
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web