mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v7 0/6] net: wwan: t7xx: fix TX push kthread soft lockup on suspend and RX stop issues
@ 2026-11-20  1:55 Tim JH Chen
  2026-11-20  1:55 ` [PATCH net v7 1/6] net: wwan: t7xx: fix TX push kthread soft lockup on system suspend Tim JH Chen
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Tim JH Chen @ 2026-11-20  1:55 UTC (permalink / raw)
  To: netdev
  Cc: chandrashekar.devegowda, haijun.liu, ricardo.martinez,
	loic.poulain, ryazanov.s.a, johannes, andrew+netdev, davem,
	edumazet, kuba, pabeni, ilpo.jarvinen, sreehari.kancharla,
	m.chetan.kumar, horms, linux-kernel, tim.jh.chen,
	Chih.Hung.Huang, Tim JH Chen

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/20261002014638.47981-1-tim770802@gmail.com/

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/20261002014638.47981-1-tim770802@gmail.com/
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(-)

-- 
2.43.0


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

end of thread, other threads:[~2026-11-20  2:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20  1:55 [PATCH net v7 0/6] net: wwan: t7xx: fix TX push kthread soft lockup on suspend and RX stop issues Tim JH Chen
2026-11-20  1:55 ` [PATCH net v7 1/6] net: wwan: t7xx: fix TX push kthread soft lockup on system suspend Tim JH Chen
2026-11-20  1:55 ` [PATCH net v7 2/6] net: wwan: t7xx: fix runtime PM usage count underflow on -EACCES Tim JH Chen
2026-11-20  1:55 ` [PATCH net v7 3/6] net: wwan: t7xx: fix skb double free when CLDMA send sees -EACCES Tim JH Chen
2026-11-20  1:55 ` [PATCH net v7 4/6] net: wwan: t7xx: do not exit the TX push kthread on resume failure Tim JH Chen
2026-11-20  1:55 ` [PATCH net v7 5/6] net: wwan: t7xx: complete NAPI on the not-started RX poll early return Tim JH Chen
2026-11-20  1:55 ` [PATCH net v7 6/6] net: wwan: t7xx: fix memory ordering in t7xx_dpmaif_rx_stop() Tim JH Chen
2026-11-20  2:03 ` [PATCH net v7 0/6] net: wwan: t7xx: fix TX push kthread soft lockup on suspend and RX stop issues netdev-bot+sinfo
2026-11-20  2:42   ` Tim JH Chen

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

all inboxes | Powered by JetHome®