From: netdev-bot+sashiko@kernel.org
To: davidlwesten@gmail.com
Cc: netdev@vger.kernel.org, mail@maciej.szmigiero.name,
loic.poulain@oss.qualcomm.com, ryazanov.s.a@gmail.com,
johannes@sipsolutions.net, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, nihaal@cse.iitm.ac.in,
m.chetan.kumar@intel.com
Subject: Re: [PATCH net v2 1/3] net: wwan: iosm: reset the host PM state when the sleep handshake times out
Date: Fri, 27 Nov 2026 05:28:42 +0000 [thread overview]
Message-ID: <179575732269.3135.16660281513861185989@kernel.org> (raw)
In-Reply-To: <20261124172627.41847-2-davidlwesten@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 (2) · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] host_sleep_complete is initialised only once, in
ipc_pm_init(), and never re-initialised.
- [Medium] The rollback in ipc_protocol_suspend()
(iosm_ipc_protocol.c:189) runs in process context with no lock and no…
Pre-existing issues:
- [Medium] The kernel-doc of ipc_protocol_suspend()
(iosm_ipc_protocol.h:173) says "false if suspend must be aborted", but…
- [Medium] ipc_pm_wait_for_device_active() (iosm_ipc_pm.c:87) checks `if
(!wait_for_completion_interruptible_timeout(...))`.
--
net: wwan: iosm: reset the host PM state when the sleep handshake times out
This patch sets host_pm_state back to IPC_MEM_HOST_PM_ACTIVE in
ipc_protocol_suspend() when ipc_pm_wait_for_device_active() times out.
This matches what the existing ENTER_SLEEP send failure path already does.
Without it the driver is left in SLEEP_WAIT_D3, later suspend and resume
transitions are refused, and doorbells are held back as pending.
> diff --git a/drivers/net/wwan/iosm/iosm_ipc_protocol.c b/drivers/net/wwan/iosm/iosm_ipc_protocol.c
> index 527355a671b64..e120e1e0ba1d8 100644
> --- a/drivers/net/wwan/iosm/iosm_ipc_protocol.c
> +++ b/drivers/net/wwan/iosm/iosm_ipc_protocol.c
> @@ -185,6 +185,8 @@ bool ipc_protocol_suspend(struct iosm_protocol *ipc_protocol)
>
> if (!ipc_pm_wait_for_device_active(&ipc_protocol->pm)) {
[Severity: Medium]
This is a pre-existing issue, but can an interrupted wait skip the new
reset entirely?
ipc_pm_wait_for_device_active() uses an interruptible wait and only checks
for a zero return:
drivers/net/wwan/iosm/iosm_ipc_pm.c:ipc_pm_wait_for_device_active() {
...
if (!wait_for_completion_interruptible_timeout
(&ipc_pm->host_sleep_complete,
msecs_to_jiffies(IPC_PM_ACTIVE_TIMEOUT_MS))) {
...
}
If the suspending task has a pending signal, the wait returns
-ERESTARTSYS and the code treats that as success. The function then
returns true even though ap_state never reached IPC_MEM_DEV_PM_ACTIVE.
That contradicts its kernel-doc ("true if device is active, false on
timeout").
In that case ipc_protocol_suspend() never enters this branch. It sends
ENTER_SLEEP to a modem that is not active and sets host_pm_state to
IPC_MEM_HOST_PM_SLEEP.
This appears to be fixed later in the series by "net: wwan: iosm: fix the
wait for the modem in the host sleep handshake". That commit switches to
wait_for_completion_timeout(), which has no negative return.
> ipc_uevent_send(ipc_protocol->pcie->dev, UEVENT_MDM_TIMEOUT);
> + /* The modem wasn't told to sleep, we are still active */
> + ipc_protocol->pm.host_pm_state = IPC_MEM_HOST_PM_ACTIVE;
[Severity: Medium]
Does restoring ACTIVE here let the next suspend consume a stale completion
count?
host_sleep_complete is initialised once in ipc_pm_init() and never
reinitialised. The modem's late wake-ack can arrive after the 500 ms wait
has timed out but before host_sleep_pend is cleared. In that window this
runs:
drivers/net/wwan/iosm/iosm_ipc_pm.c:ipc_pm_on_link_wake() {
...
if (test_bit(CONSUME_STATE, &ipc_pm->host_sleep_pend))
complete(&ipc_pm->host_sleep_complete);
...
}
That leaves done=1 on the completion. Meanwhile
ipc_pm_wait_for_device_active() has not yet reached:
clear_bit(0, &ipc_pm->host_sleep_pend);
Before this patch the state stayed stuck at SLEEP_WAIT_D3. Later calls to
ipc_pm_prepare_host_sleep() were refused, so the count was never
consumed.
With the reset to ACTIVE, the next ipc_protocol_suspend() reaches the wait
again. It consumes the stale count and returns true at once, even if the
modem has gone back to sleep. ENTER_SLEEP is then parked as a pending
doorbell, and host_pm_state becomes IPC_MEM_HOST_PM_SLEEP although the
modem was never told.
This looks to be fixed later in the series by "net: wwan: iosm: fix the
wait for the modem in the host sleep handshake". That commit adds
reinit_completion(&ipc_pm->host_sleep_complete) before set_bit() in
ipc_pm_wait_for_device_active().
[Severity: Medium]
Is a doorbell parked during SLEEP_WAIT_D3 ever replayed after this
rollback?
While host_pm_state is SLEEP_WAIT_D3, ipc_pm_signal_hpda_doorbell() with
host_slp_check set only records the update:
if (host_slp_check && ipc_pm->host_pm_state != IPC_MEM_HOST_PM_ACTIVE &&
ipc_pm->host_pm_state != IPC_MEM_HOST_PM_ACTIVE_WAIT) {
ipc_pm->pending_hpda_update = true;
The only automatic replay is in ipc_pm_on_link_wake(), and it requires
ACTIVE:
if (ipc_pm->pending_hpda_update &&
ipc_pm->host_pm_state == IPC_MEM_HOST_PM_ACTIVE)
ipc_pm_signal_hpda_doorbell(ipc_pm, IPC_HP_PM_TRIGGER, true);
This store runs in process context with no lock and is not serialised
with the IPC tasklet. The tasklet may handle the modem's late wake-ack
after the timeout but before this store. That window covers dev_err(),
clear_bit() and ipc_uevent_send(). If so, the tasklet still sees
SLEEP_WAIT_D3 and skips the replay.
After this store, nothing checks pending_hpda_update again. On resume,
ipc_protocol_resume() returns early because ipc_pm_prepare_host_active()
finds ACTIVE instead of SLEEP. So the EXIT_SLEEP doorbell that normally
flushes pending updates is not sent either.
Could the parked HP update, for example a DL refill, then stay undelivered
until some unrelated doorbell fires? That would be a smaller form of the
"doorbells to the modem are held back as pending" symptom this commit
message describes.
[Severity: Medium]
This isn't a bug introduced by this patch, but the new comment says "we
are still active" while the suspend still goes ahead. Is the false return
from ipc_protocol_suspend() meant to abort the suspend?
The kernel-doc in iosm_ipc_protocol.h says:
* Returns: true if host can suspend, false if suspend must be aborted.
The only caller throws the result away:
void ipc_imem_pm_suspend(struct iosm_imem *ipc_imem)
{
ipc_protocol_suspend(ipc_imem->ipc_protocol);
}
ipc_pcie_suspend() then always returns 0:
ipc_imem_pm_suspend(ipc_pcie->imem);
dev_dbg(ipc_pcie->dev, "SUSPEND done");
return 0;
So the PM core still puts the device into D3, even though the modem was
never sent ENTER_SLEEP.
On resume, ipc_protocol_resume()->ipc_pm_prepare_host_active() expects
IPC_MEM_HOST_PM_SLEEP, finds ACTIVE, logs an error and returns false. As
a result, ipc_imem_pm_resume() skips ipc_imem_phase_update_check(). The
same happened before this patch, when the state was left at SLEEP_WAIT_D3.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124172627.41847-1-davidlwesten%40gmail.com
next prev parent reply other threads:[~2026-11-27 5:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 17:26 [PATCH net v2 0/3] net: wwan: iosm: send the host sleep message on every suspend David Westen
2026-11-24 17:26 ` [PATCH net v2 1/3] net: wwan: iosm: reset the host PM state when the sleep handshake times out David Westen
2026-11-27 5:28 ` netdev-bot+sashiko [this message]
2026-11-24 17:26 ` [PATCH net v2 2/3] net: wwan: iosm: fix the wait for the modem in the host sleep handshake David Westen
2026-11-24 17:26 ` [PATCH net v2 3/3] net: wwan: iosm: always send the host sleep message on suspend David Westen
2026-11-27 5:28 ` netdev-bot+sashiko
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=179575732269.3135.16660281513861185989@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=davidlwesten@gmail.com \
--cc=edumazet@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=m.chetan.kumar@intel.com \
--cc=mail@maciej.szmigiero.name \
--cc=netdev@vger.kernel.org \
--cc=nihaal@cse.iitm.ac.in \
--cc=pabeni@redhat.com \
--cc=ryazanov.s.a@gmail.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