Re: [PATCH net-next v14 6/6] net: wwan: t9xx: Add AT & MBIM WWAN ports
From: Wu. JackBB (GSM)
Date: Fri Dec 04 2026 - 01:16:18 EST
Thanks for the review.
> Can this hold the WWAN core's ops_lock for an unbounded time while the
> modem stalls TX completion?
>
> wwan_port_op_tx() calls this with port->ops_lock held:
>
> drivers/net/wwan/wwan_core.c:wwan_port_op_tx() {
> mutex_lock(&port->ops_lock);
> ...
> else
> ret = port->ops->tx_blocking(port, skb);
> ...
> }
>
> Under that lock, mtk_port_common_write(blocking=true) sleeps twice with
> no timeout. The first sleep is in mtk_port_wait_tx_space():
>
> wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
>
> The second is once per CCCI packet in mtk_port_send_data(), waiting for
> the modem to complete that packet's TRB:
>
> /* no timeout in tx blocking mode */
> ret = wait_event_interruptible(port->trb_wq,
> mtk_port_trb_done(trb) ||
> test_bit(PORT_S_FLUSH, &port->status) ||
> !test_bit(PORT_S_WR, &port->status));
>
> Only a signal to the writer, a port disable or PORT_S_FLUSH ends these
> waits. In the meantime, other ops_lock users of the same wwan_port block
> in an uninterruptible mutex_lock(). These include wwan_port_fops_poll()
> on every poll()/epoll call, open()/close() from another process through
> wwan_port_op_start()/wwan_port_op_stop(), and other writers.
>
> If the CLDMA queue or the firmware stops completing TRBs on the AT or
> MBIM channel, won't those tasks stay in D state for as long as the stall
> lasts, and possibly trigger hung-task warnings?
>
> The commit message cites the t7xx .tx path as precedent. That path only
> waits for queue budget. Waiting for per-packet modem completion under
> ops_lock seems new here. The other in-tree tx_blocking user,
> rpmsg_wwan_ctrl through rpmsg_send(), has a bounded wait.
>
> Would a timeout on the per-packet completion wait, or not waiting for
> completion under ops_lock, avoid this?
True.
Will fix in v15: a blocking write no longer waits for the TX
completion of each packet. It waits for room in the port's TX queue,
queues its packets and returns; a TX error reported later is logged by
the completion, as for a non-blocking write. What is left under ops_lock
is the interruptible wait for queue room, which is what the t7xx .tx
path does (queue->budget > 0, no timeout); port removal still ends it
before wwan_remove_port() takes the lock. Note that rpmsg_send() is
bounded only on the virtio backend; the qcom_smd one waits for FIFO
space without a timeout.
Thanks,
Jack
pw-bot: cr