]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PM: s2idle: Extend comment in s2idle_enter()
authorUlf Hansson <ulf.hansson@linaro.org>
Tue, 11 Mar 2025 16:08:23 +0000 (17:08 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 12 Mar 2025 20:14:53 +0000 (21:14 +0100)
The s2idle_lock must be held while checking for a pending wakeup and while
moving into S2IDLE_STATE_ENTER, to make sure a wakeup doesn't get lost.
Let's extend the comment in the code to make this clear.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://patch.msgid.link/20250311160827.1129643-3-ulf.hansson@linaro.org
[ rjw: Rewrote the new comment ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/power/suspend.c

index 1876abf1be15b4c509ea550226492389274ab81f..6fae1e0a331cade8a5bcc19b72dc2717fbb5088d 100644 (file)
@@ -95,8 +95,12 @@ static void s2idle_enter(void)
         * The correctness of the code below depends on the number of online
         * CPUs being stable, but CPUs cannot be taken offline or put online
         * while it is running.
+        *
+        * The s2idle_lock must be acquired before the pending wakeup check to
+        * prevent pm_system_wakeup() from running as a whole between that check
+        * and the subsequent s2idle_state update in which case a wakeup event
+        * would get lost.
         */
-
        raw_spin_lock_irq(&s2idle_lock);
        if (pm_wakeup_pending())
                goto out;