mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tim JH Chen <tim770802@gmail.com>
To: netdev@vger.kernel.org
Cc: chandrashekar.devegowda@intel.com, haijun.liu@mediatek.com,
	ricardo.martinez@linux.intel.com, 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,
	ilpo.jarvinen@linux.intel.com,
	sreehari.kancharla@linux.intel.com,
	m.chetan.kumar@linux.intel.com, horms@kernel.org,
	linux-kernel@vger.kernel.org, tim.jh.chen@wnc.com.tw,
	Chih.Hung.Huang@wnc.com.tw, Tim JH Chen <tim770802@gmail.com>
Subject: [PATCH net v7 0/6] net: wwan: t7xx: fix TX push kthread soft lockup on suspend and RX stop issues
Date: Fri, 20 Nov 2026 09:55:50 +0800	[thread overview]
Message-ID: <20261120015556.131547-1-tim770802@gmail.com> (raw)

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


             reply	other threads:[~2026-11-20  1:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  1:55 Tim JH Chen [this message]
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

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=20261120015556.131547-1-tim770802@gmail.com \
    --to=tim770802@gmail.com \
    --cc=Chih.Hung.Huang@wnc.com.tw \
    --cc=andrew+netdev@lunn.ch \
    --cc=chandrashekar.devegowda@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=haijun.liu@mediatek.com \
    --cc=horms@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=m.chetan.kumar@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ricardo.martinez@linux.intel.com \
    --cc=ryazanov.s.a@gmail.com \
    --cc=sreehari.kancharla@linux.intel.com \
    --cc=tim.jh.chen@wnc.com.tw \
    /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

all inboxes | Powered by JetHome®