From: David Westen <davidlwesten@gmail.com>
To: netdev@vger.kernel.org
Cc: Loic Poulain <loic.poulain@oss.qualcomm.com>,
Sergey Ryazanov <ryazanov.s.a@gmail.com>,
Johannes Berg <johannes@sipsolutions.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
M Chetan Kumar <m.chetan.kumar@intel.com>,
"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>,
David Westen <davidlwesten@gmail.com>
Subject: [PATCH net v3 0/2] net: wwan: iosm: fix S3 resume by re-binding the driver after it
Date: Thu, 26 Nov 2026 11:41:41 -0800 [thread overview]
Message-ID: <20261126194143.32283-1-davidlwesten@gmail.com> (raw)
On platforms where S3 cuts power to the WWAN card, the modem boots again
on its own while the driver still treats it as running, and the modem
can't be used after resume until the driver is re-bound. Patch 2 detects
this on resume and re-binds the driver then. Patch 1 fixes a
use-after-free in the cleanup, which the re-bind would hit with wwan0 up.
v2 unbound the driver before every S3 suspend. That runs the cleanup
against a modem that is still running, and the AI review and my tests
showed how many ways that goes wrong: the modem kept writing into the
freed MUX buffers (DMA faults with a strict IOMMU), and timers, tasks
and MSIs could outlive what they use. Fixing that properly means
reworking the cleanup. v3 instead lets the modem lose power, as it did
before, and re-binds the driver after resume, when the modem no longer
holds any of the driver's memory.
Changes in v3:
- Re-bind after resume, and only if the modem rebooted, instead of
unbinding before every S3 suspend. Nothing changes where the card
keeps power in S3 (AI review), or for s2idle, opportunistic sleep and
an explicit freeze or standby (Maciej).
- Dropped "cancel the ADB timer on cleanup". Closing that race for a
normal unbind needs a larger rework of the cleanup; patch 2 keeps the
re-bind out of it, and out of the MSI race the AI review found.
- New patch 1.
On the ThinkPad X1 Carbon 6th gen I tested on, S3 takes the same suspend
path as s2idle, and the modem crashes before it loses power. That is
where the CD_READY in patch 2's log comes from. The s2idle series [1]
removes that crash, but the modem still boots again after S3, so both
are needed there. They don't depend on each other.
Tested on an XMM7360 in that ThinkPad:
- With KASAN, lockdep and a strict IOMMU: re-bound and connected again
after each of five S3 cycles, also with wwan0 up through the suspend;
no re-bind after s2idle; three unbinds with wwan0 up and traffic. No
reports.
- Together with the s2idle series, on a kernel without debug options:
the same, and s2idle connected again without a re-bind.
Not tested: the XMM7560 (MUX aggregation), platforms that use the D3L2
path, and hibernation, which this series doesn't change. Known limits:
- On the D3L2 path, interrupts from the rebooted modem reach the driver
until its resume callback runs, as without this series.
- A modem that stays in its boot stage after losing power delays the end
of resume by up to 10 s before the re-bind.
- For a normal unbind, the cleanup races with the ADB timer and with
MSIs are unchanged.
- Re-binding three times or more without a power cycle can leave the
link without downlink until the bearer is reconnected. That happens
without this series too, and doesn't affect S3, where the modem loses
power.
Patch 2 builds on commit 0b6f6593aa8c ("net: wwan: iosm: Fix hibernation
by re-binding the driver around it").
[1] https://lore.kernel.org/r/20261124172505.41520-1-davidlwesten@gmail.com
v2: https://lore.kernel.org/r/20261119042714.505405-1-davidlwesten@gmail.com
v1: https://lore.kernel.org/r/20261116031148.333990-1-davidlwesten@gmail.com
The investigation and the patches were done with an AI coding assistant
(Claude Opus 5.5). We wrote the patches together, and I ran the tests.
David Westen (2):
net: wwan: iosm: free the MUX after the netdevs that use it
net: wwan: iosm: re-bind the driver when the modem rebooted during S3
drivers/net/wwan/iosm/iosm_ipc_imem.c | 54 ++++++++++++++++++++--
drivers/net/wwan/iosm/iosm_ipc_imem.h | 18 ++++++++
drivers/net/wwan/iosm/iosm_ipc_imem_ops.c | 4 ++
drivers/net/wwan/iosm/iosm_ipc_irq.c | 3 ++
drivers/net/wwan/iosm/iosm_ipc_mux_codec.c | 6 +++
drivers/net/wwan/iosm/iosm_ipc_pcie.c | 37 +++++++++++++++
drivers/net/wwan/iosm/iosm_ipc_protocol.c | 3 ++
7 files changed, 121 insertions(+), 4 deletions(-)
--
2.56.0
next reply other threads:[~2026-11-26 19:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 19:41 David Westen [this message]
2026-11-26 19:41 ` [PATCH net v3 1/2] net: wwan: iosm: free the MUX after the netdevs that use it David Westen
2026-11-26 19:41 ` [PATCH net v3 2/2] net: wwan: iosm: re-bind the driver when the modem rebooted during S3 David Westen
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=20261126194143.32283-1-davidlwesten@gmail.com \
--to=davidlwesten@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--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=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