Linux Power Management development
 help / color / mirror / Atom feed
From: Samuel Wu <wusamuel@google.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
	Pavel Machek <pavel@kernel.org>, Len Brown <lenb@kernel.org>,
	 Rajat Jain <rajatja@google.com>
Cc: Samuel Wu <wusamuel@google.com>,
	kernel-team@android.com,  Pavel Machek <pavel@ucw.cz>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	linux-pm@vger.kernel.org
Subject: [PATCH] PM: suspend: Clear events_check_enabled on early error
Date: Sat, 28 Nov 2026 19:52:20 -0800	[thread overview]
Message-ID: <20261129035220.1079109-2-wusamuel@google.com> (raw)

On an early error in enter_state(), such as during filesystem sync,
prepare notifiers, or freezer, events_check_enabled is not cleared and
is left on outside a suspend window. This means wakeup sources' wakeup
counts are erroneously incremented outside a suspend window.

Clear events_check_enabled at the Unlock label to handle early errors.
Keep clearing events_check_enabled at the Finish label so that
wakeup_count is not incremented during a normal resume path.

Fixes: 95b982b45122 ("PM / s2idle: Clear the events_check_enabled flag")
Signed-off-by: Samuel Wu <wusamuel@google.com>
---
 kernel/power/suspend.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 32c055df02da..d91593f9a3cf 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -626,6 +626,7 @@ static int enter_state(suspend_state_t state)
 	pm_pr_dbg("Finishing wakeup.\n");
 	suspend_finish();
  Unlock:
+	events_check_enabled = false;
 	mutex_unlock(&system_transition_mutex);
 	return error;
 }
-- 
2.56.1.839.g22a8290db9-goog


                 reply	other threads:[~2026-11-29  3:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261129035220.1079109-2-wusamuel@google.com \
    --to=wusamuel@google.com \
    --cc=kernel-team@android.com \
    --cc=lenb@kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=rajatja@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox