Netdev List
 help / color / mirror / Atom feed
* [PATCH net v3 0/2] net: wwan: iosm: fix S3 resume by re-binding the driver after it
@ 2026-11-26 19:41 David Westen
  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
  0 siblings, 2 replies; 3+ messages in thread
From: David Westen @ 2026-11-26 19:41 UTC (permalink / raw)
  To: netdev
  Cc: Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	M Chetan Kumar, Maciej S. Szmigiero, David Westen

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-26 19:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 19:41 [PATCH net v3 0/2] net: wwan: iosm: fix S3 resume by re-binding the driver after it David Westen
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox