Linux Power Management development
 help / color / mirror / Atom feed
From: Rose Wu <ya-jou.wu@mediatek.com>
To: <rafael.j.wysocki@intel.com>, <linux-pm@vger.kernel.org>,
	<regressions@lists.linux.dev>
Cc: saravanak@google.com, len.brown@intel.com, pavel@kernel.org,
	linux-kernel@vger.kernel.org,
	wsd_upstream <wsd_upstream@mediatek.com>,
	linux-mediatek@lists.infradead.org,
	"士顏 邱" <artis.chiu@mediatek.com>,
	"靖智 高" <Johnny-cc.Kao@mediatek.com>
Subject: [REGRESSION] PM / sleep: Unbalanced suspend/resume on late abort causes data abort
Date: Mon, 17 Nov 2025 17:31:05 +0800	[thread overview]
Message-ID: <70b25dca6f8c2756d78f076f4a7dee7edaaffc33.camel@mediatek.com> (raw)

Hi Rafael and All,

I am reporting a regression introduced by the commit
443046d1ad66607f324c604b9fbdf11266fa8aad (PM: sleep: Make suspend of
devices more asynchronous), which can lead to a kernel panic (data
abort) if a late suspend aborts.
The commit modifies list handling during suspend. When a device suspend
aborts at the "late" stage, `dpm_suspended_list` is spliced into
`dpm_late_early_list`.
This creates an imbalance. Devices on this list that had not yet
executed `pm_runtime_disable()` in `device_suspend_late()` are now
incorrectly subjected to `pm_runtime_enable()` during the subsequent
`device_resume_early()` sequence.

This causes two issues:

1. Numerous error messages in dmesg: "Attempt to enable runtime PM when
it is blocked."
2. A critical failure for simple-bus devices: When
`simple_pm_bus_runtime_resume()` is called for a device whose bus is
`NULL`, the kernel attempts to access the null bus struct, triggering a
data abort.

Steps to Reproduce:

The issue can be reliably reproduced by forcing a late suspend to
abort.

1. Apply the following modification to the `device_suspend_late()`
function to simulate a wakeup event:
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1568,7 +1568,7 @@ static int device_suspend_late(struct device
*dev, pm_message_t state, bool asyn
 	if (async_error)
 		goto Complete;
 
-	if (pm_wakeup_pending()) {
+	if (1) { /* Force abort for testing */
 		async_error = -EBUSY;
 		goto Complete;
 	}
2. Trigger a system suspend.
3. The system will attempt to suspend, abort at the late stage, and
then trigger the data abort during the resume sequence.

Call Trace:

Unable to handle kernel NULL pointer dereference at virtual address
0000000000000008
pc : [0xffffffe3988e81e4] simple_pm_bus_runtime_resume+0x1c/0x90
lr : [0xffffffe398a848d0] pm_generic_runtime_resume+0x40/0x58

As a potential fix, I am wondering if a conditional check is needed in
`device_resume_early()` before invoking `pm_runtime_enable()` for a
device?

Best Regards,
Rose

             reply	other threads:[~2025-11-17  9:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17  9:31 Rose Wu [this message]
2025-11-17 16:59 ` [REGRESSION] PM / sleep: Unbalanced suspend/resume on late abort causes data abort Rafael J. Wysocki
2025-11-17 18:57   ` [PATCH v1] PM: sleep: core: Fix runtime PM enabling in device_resume_early() Rafael J. Wysocki
2025-11-18  8:31     ` Rose Wu
2025-11-18 11:48       ` [PATCH v2] " Rafael J. Wysocki
2025-11-18 12:17         ` Ulf Hansson
2025-11-18 12:26           ` Rafael J. Wysocki
2025-11-18 12:45             ` [PATCH v3] " Rafael J. Wysocki
2025-11-18 12:57               ` Ulf Hansson
2025-11-18 13:01                 ` Rafael J. Wysocki
2025-11-18 14:16               ` [PATCH v4] " Rafael J. Wysocki
2025-11-18 14:44                 ` Ulf Hansson
2025-11-18 12:49             ` [PATCH v2] " Ulf Hansson
2025-11-18 12:52               ` Rafael J. Wysocki

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=70b25dca6f8c2756d78f076f4a7dee7edaaffc33.camel@mediatek.com \
    --to=ya-jou.wu@mediatek.com \
    --cc=Johnny-cc.Kao@mediatek.com \
    --cc=artis.chiu@mediatek.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=regressions@lists.linux.dev \
    --cc=saravanak@google.com \
    --cc=wsd_upstream@mediatek.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