Skip to content

net: wwan: t7xx: fix TX push kthread soft lockup on suspend and RX stop issues

Tim JH Chen lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v7 Latest6 patches 1 replyIn review

Changes in v7 from the cover letter

- Drop v6 patches 1-3. They need rework based on the review and will be sent separately.
- Patch 1 (v6 4/4): change Fixes: to 5545b7b9f294; remove the code comment.
- Patch 2: new.

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6net: wwan: t7xx: fix TX push kthread soft lockup on system suspenddrivers/net/wwan/t7xx/t7xx_hif_dpmaif_tx.c+17 -30 replies
2/6net: wwan: t7xx: fix runtime PM usage count underflow on -EACCESdrivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c drivers/net/wwan/t7xx/t7xx_hif_dpmaif_tx.c+18 -70 replies
3/6net: wwan: t7xx: fix skb double free when CLDMA send sees -EACCESdrivers/net/wwan/t7xx/t7xx_hif_cldma.c+10 -20 replies
4/6net: wwan: t7xx: do not exit the TX push kthread on resume failuredrivers/net/wwan/t7xx/t7xx_hif_dpmaif_tx.c+13 -10 replies
5/6net: wwan: t7xx: complete NAPI on the not-started RX poll early returndrivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c+1 -00 replies
6/6net: wwan: t7xx: fix memory ordering in t7xx_dpmaif_rx_stop()drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c+15 -80 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v7 yet.

Read the v7 thread

Cover letter [PATCH net v7 0/6] net: wwan: t7xx: fix TX push kthread soft lockup on suspend and RX stop issues

net: wwan: t7xx: fix NAPI completion and rx_stop ordering

Two fixes in t7xx_hif_dpmaif_rx.c.

Patch 1 completes the NAPI on the not-started early return in t7xx_dpmaif_napi_rx_poll().

Patch 2 fixes the memory ordering between t7xx_dpmaif_rx_stop() and t7xx_dpmaif_napi_rx_poll().

v7:
- Drop v6 patches 1-3. They need rework based on the review and will be sent separately.
- Patch 1 (v6 4/4): change Fixes: to 5545b7b9f294; remove the code comment.
- Patch 2: new.

v6: https://lore.kernel.org/netdev/[email protected]/

v6 -> v7:
- Patch 1 (was 3/4): drop the explicit quiesce added to t7xx_dpmaif_suspend() in v6 (interrupt mask reorder, cancel_work_sync() of the TX-done workers and of bat_release_work, hardware stop moved last). The review found it incomplete without synchronize_irq(), losing the UL-DONE unmask and able to deadlock runtime suspend. Also drop the freezer: the kthread now skips the push and waits on tx_wq when it finds the TX queue stopped after the runtime PM resume, which also covers a resume that does not restart the queues (modem exception, shutdown), where the freezer does not apply. Commit message rewritten around the mechanism visible in the captured soft lockup; subject changed accordingly.
- Patch 2 (was 1/4): use pm_runtime_get_noresume() + pm_runtime_resume() at every site instead of per-site flags, which also covers t7xx_dpmaif_irq_rx_done()/t7xx_dpmaif_napi_rx_poll(). State when -EACCES is reachable.
- Patch 3 (new): t7xx_cldma_send_skb() returned -EACCES for a successful send, so the caller freed an skb that was already on the ring; same reference handling as patch 2.
- Patch 4 (was 2/4): retry every second with the first failure of a streak logged, instead of every 20 ms; Reported-by/Closes for the field report on the v6 thread.
- Patch 5 (was 4/4): Fixes: changed to 5545b7b9f294 ("net: wwan:
t7xx: Add NAPI support"); code comment removed; user-visible impact added to the commit message.
- Patch 6 (new): fix the memory ordering between t7xx_dpmaif_rx_stop() and t7xx_dpmaif_napi_rx_poll(), found by the v6 review, and keep the pending PIT release count of a poll that is in flight when the queue is stopped.
- v6: https://lore.kernel.org/netdev/[email protected]/
v5 -> v6:
- Drop the "freezer as a global quiesce" direction: remove every WQ_FREEZABLE annotation added in v4/v5. Marking the data-plane workqueues freezable can deadlock the suspend, because a flush_work()/cancel_work_sync() issued from a context the freezer does not freeze (the FSM kthread, or an unbind holding device_lock) blocks until thaw_workqueues(). (Reported on v5 review.)
- Instead quiesce the DPMAIF data plane explicitly in the system suspend callback: mask interrupts, cancel_work_sync() the TX-done workers, call t7xx_dpmaif_rx_stop() to drain the in-flight NAPI RX poll (the freezer cannot park a softirq), then cancel bat_release_work and stop the hardware last.
- Keep the PM freezer only for the lone TX push kthread, and use kthread_freezable_should_stop() instead of try_to_freeze().
- Fold in the pre-existing fixes previously deferred to a separate
series: the -EACCES runtime PM usage-count underflow (patch 1), the TX push kthread self-exit use-after-free (patch 2), and a NAPI that is never completed on the not-started RX poll early return (patch 4). This revision is therefore a 4-patch series.
- Do not touch t7xx_hif_cldma.c. Restrict the commit messages to the DPMAIF data path; the CLDMA control path uses a different mechanism and is called out as out of scope.
v4 -> v5:
- Fix freeze deadlock in t7xx_do_tx_hw_push(): when the TX-done workqueue (WQ_FREEZABLE) is frozen first it stops draining the DRB ring; the kthread then loops indefinitely in the ring-full retry branch and never reaches try_to_freeze(), causing a freezer timeout and suspend abort. (Simon Horman)
- Extend WQ_FREEZABLE to the BAT-release and CLDMA TX/RX workqueues. (Simon Horman) [reverted in v6, see above]
- Note the -EACCES underflow and the stale kthread pointer as pre-existing issues to be addressed separately. [done in v6, patches 1-2]
v3 -> v4:
- Drop the tx_pm_lock / state-snapshot approach entirely and use the PM freezer instead. The previous approach deadlocked through the runtime PM wait queue and opened ISR windows by writing dpmaif_ctrl->state in suspend/resume.
v2 -> v3: process fixes (Fixes tag, changelog placement).
v1 -> v2: save/restore pre-suspend state; wrap pm_runtime with a mutex.

Tim JH Chen (6):
net: wwan: t7xx: fix TX push kthread soft lockup on system suspend
net: wwan: t7xx: fix runtime PM usage count underflow on -EACCES
net: wwan: t7xx: fix skb double free when CLDMA send sees -EACCES
net: wwan: t7xx: do not exit the TX push kthread on resume failure
net: wwan: t7xx: complete NAPI on the not-started RX poll early return
net: wwan: t7xx: fix memory ordering in t7xx_dpmaif_rx_stop()

 drivers/net/wwan/t7xx/t7xx_hif_cldma.c     | 12 +++++-
 drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c | 35 ++++++++++-----
 drivers/net/wwan/t7xx/t7xx_hif_dpmaif_tx.c | 50 ++++++++++++++++++----
 3 files changed, 75 insertions(+), 22 deletions(-)
Signature · 1 line
2.43.0