]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PM: sleep: add kernel parameter to disable asynchronous suspend/resume
authorTudor Ambarus <tudor.ambarus@linaro.org>
Wed, 9 Jul 2025 12:31:16 +0000 (12:31 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 10 Jul 2025 12:40:07 +0000 (14:40 +0200)
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>
Documentation/admin-guide/kernel-parameters.txt
kernel/power/main.c

index f1f2c0874da9ddfc95058c464fdf5dabaf0de713..06beacf208de3242a3b4bb2413ab6cd3e0083f15 100644 (file)
                        that number, otherwise (e.g., 'pmu_override=on'), MMCR1
                        remains 0.
 
+       pm_async=       [PM]
+                       Format: off
+                       This parameter sets the initial value of the
+                       /sys/power/pm_async sysfs knob at boot time.
+                       If set to "off", disables asynchronous suspend and
+                       resume of devices during system-wide power transitions.
+                       This can be useful on platforms where device
+                       dependencies are not well-defined, or for debugging
+                       power management issues. Asynchronous operations are
+                       enabled by default.
+
+
        pm_debug_messages       [SUSPEND,KNL]
                        Enable suspend/resume debug messages during boot up.
 
index 3d484630505ae91fea29f7f9b3fbcf7e585955d8..3cf2d7e72567ecbea2cd80acd3c7f6da85f5bef4 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/acpi.h>
 #include <linux/export.h>
+#include <linux/init.h>
 #include <linux/kobject.h>
 #include <linux/string.h>
 #include <linux/pm-trace.h>
@@ -112,6 +113,14 @@ int pm_notifier_call_chain(unsigned long val)
 /* If set, devices may be suspended and resumed asynchronously. */
 int pm_async_enabled = 1;
 
+static int __init pm_async_setup(char *str)
+{
+       if (!strcmp(str, "off"))
+               pm_async_enabled = 0;
+       return 1;
+}
+__setup("pm_async=", pm_async_setup);
+
 static ssize_t pm_async_show(struct kobject *kobj, struct kobj_attribute *attr,
                             char *buf)
 {