Skip to content

Commit f747cde

Browse files
ambarusrafaeljw
authored andcommitted
PM: sleep: add kernel parameter to disable asynchronous suspend/resume
On some platforms, device dependencies are not properly represented by device links, which can cause issues when asynchronous power management is enabled. While it is possible to disable this via sysfs, doing so at runtime can race with the first system suspend event. This patch introduces a kernel command-line parameter, "pm_async", which can be set to "off" to globally disable asynchronous suspend and resume operations from early boot. It effectively provides a way to set the initial value of the existing pm_async sysfs knob at boot time. This offers a robust method to fall back to synchronous (sequential) operation, which can stabilize platforms with problematic dependencies and also serve as a useful debugging tool. The default behavior remains unchanged (asynchronous enabled). To disable it, boot the kernel with the "pm_async=off" parameter. Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Link: https://patch.msgid.link/20250709-pm-async-off-v3-1-cb69a6fc8d04@linaro.org Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent f19dc04 commit f747cde

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5000,6 +5000,18 @@
50005000
that number, otherwise (e.g., 'pmu_override=on'), MMCR1
50015001
remains 0.
50025002

5003+
pm_async= [PM]
5004+
Format: off
5005+
This parameter sets the initial value of the
5006+
/sys/power/pm_async sysfs knob at boot time.
5007+
If set to "off", disables asynchronous suspend and
5008+
resume of devices during system-wide power transitions.
5009+
This can be useful on platforms where device
5010+
dependencies are not well-defined, or for debugging
5011+
power management issues. Asynchronous operations are
5012+
enabled by default.
5013+
5014+
50035015
pm_debug_messages [SUSPEND,KNL]
50045016
Enable suspend/resume debug messages during boot up.
50055017

kernel/power/main.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <linux/acpi.h>
1010
#include <linux/export.h>
11+
#include <linux/init.h>
1112
#include <linux/kobject.h>
1213
#include <linux/string.h>
1314
#include <linux/pm-trace.h>
@@ -112,6 +113,14 @@ int pm_notifier_call_chain(unsigned long val)
112113
/* If set, devices may be suspended and resumed asynchronously. */
113114
int pm_async_enabled = 1;
114115

116+
static int __init pm_async_setup(char *str)
117+
{
118+
if (!strcmp(str, "off"))
119+
pm_async_enabled = 0;
120+
return 1;
121+
}
122+
__setup("pm_async=", pm_async_setup);
123+
115124
static ssize_t pm_async_show(struct kobject *kobj, struct kobj_attribute *attr,
116125
char *buf)
117126
{

0 commit comments

Comments
 (0)