From: netdev-bot+sashiko@kernel.org
To: jackbb_wu@compal.com
Cc: loic.poulain@oss.qualcomm.com, ryazanov.s.a@gmail.com,
johannes@sipsolutions.net, andrew+netdev@lunn.ch,
davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
wen-zhi.huang@mediatek.com, shi-wei.yeh@mediatek.com,
Minano.tseng@mediatek.com, matthias.bgg@gmail.com,
angelogioacchino.delregno@collabora.com, horms@kernel.org,
corbet@lwn.net, skhan@linuxfoundation.org, robert_yu@compal.com,
Jeff_Chang@compal.com, edumazet@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH net-next v14 6/6] net: wwan: t9xx: Add AT & MBIM WWAN ports
Date: Thu, 03 Dec 2026 09:46:43 +0000 [thread overview]
Message-ID: <179629120355.3146.3262911149272753703@kernel.org> (raw)
In-Reply-To: <20261202-t9xx_driver_v1-v14-6-08ebc870ea94@compal.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The new .tx_blocking op mtk_port_wwan_write_blocking() is
called by wwan_port_op_tx() (drivers/net/wwan/wwan_core.c:830-839)…
- [Low] The new READY hook mtk_port_enable_by_type()
(drivers/net/wwan/t9xx/mtk_port.c) calls ->enable() on every…
--
net: wwan: t9xx: Add AT & MBIM WWAN ports
This adds AT and MBIM WWAN ports to the t9xx port infrastructure. The
WWAN ports are created from mtk_port_wwan_enable(), which runs on
FSM_STATE_READY through a new mtk_port_enable_by_type() hook. The patch
also adds start/stop/tx/tx_blocking WWAN ops, with TX back-pressure
reported through wwan_port_txon()/txoff().
> diff --git a/drivers/net/wwan/t9xx/mtk_port.c b/drivers/net/wwan/t9xx/mtk_port.c
> index 92fc791452851..b305ec9c8fcfc 100644
> --- a/drivers/net/wwan/t9xx/mtk_port.c
> +++ b/drivers/net/wwan/t9xx/mtk_port.c
[ ... ]
> @@ -605,6 +611,21 @@ int mtk_port_ch_disable(struct mtk_port *port)
> return ret;
> }
>
> +static void mtk_port_enable_by_type(struct mtk_port_mngr *port_mngr, int tbl_type)
> +{
> + struct mtk_port *port;
> + unsigned long index;
> +
> + /* READY is reached at most once per bind and FSM_STATE_OFF is
> + * terminal, so port->peer_enabled never carries over from an
> + * earlier port enumeration.
> + */
> + xa_for_each(&port_mngr->port_tbl[tbl_type], index, port) {
> + if (port->peer_enabled)
> + mtk_port_get_ops(port->info.type)->enable(port);
> + }
> +}
[Severity: Low]
Is this comment accurate? Several MD port enumerations can run before
the single READY.
In mtk_fsm_startup_act(), a bare STARTUP that arrives in BOOTUP is
treated as a new boot, and the HS2 results are dropped:
drivers/net/wwan/t9xx/mtk_fsm.c:mtk_fsm_startup_act() {
...
if (fsm->state != FSM_STATE_BOOTUP)
mtk_fsm_switch_state(fsm, to_state, event);
else
fsm->fsm_flag &= ~FSM_HS2_DONE_MASK;
...
}
A repeated HS1 also clears that side's HS2 flag. The next HS2 then goes
through mtk_fsm_parse_hs2_msg() and calls mtk_port_status_update()
again. That function only writes peer_enabled for channels listed in
the current message:
drivers/net/wwan/t9xx/mtk_port.c:mtk_port_status_update() {
...
port = mtk_port_search_by_id(port_mngr, ch_id);
if (!port)
continue;
port->peer_enabled = FIELD_GET(MTK_INFO_FLD_EN, le16_to_cpu(port_info->channel));
...
}
Nothing resets peer_enabled when the new boot is detected. Suppose the
first enumeration marks a channel enabled and the rebooted firmware
omits it. That port then keeps peer_enabled == true.
When READY arrives, wouldn't mtk_port_enable_by_type() call
mtk_port_wwan_enable() on it? That would run mtk_port_ch_enable() and
wwan_create_port() for a channel the current firmware did not
advertise. The same stale state seems possible if a first HS2 sets some
peer_enabled values and then fails inside mtk_fsm_parse_hs2_msg()
before the device reboots.
Should peer_enabled be cleared on a new boot, or before the parse loop
in mtk_port_status_update()?
[ ... ]
> diff --git a/drivers/net/wwan/t9xx/mtk_port_io.c b/drivers/net/wwan/t9xx/mtk_port_io.c
> index 392d2ae54ef55..dd0a8ed4ed79a 100644
> --- a/drivers/net/wwan/t9xx/mtk_port_io.c
> +++ b/drivers/net/wwan/t9xx/mtk_port_io.c
[ ... ]
> +/* Called with the WWAN core's ops_lock held and sleeps interruptibly. Port
> + * disable clears PORT_S_WR and wakes trb_wq before wwan_remove_port() takes
> + * that lock, so removal ends the wait.
> + */
> +static int mtk_port_wwan_write_blocking(struct wwan_port *w_port, struct sk_buff *skb)
> +{
> + return mtk_port_wwan_tx(w_port, skb, true);
> +}
[Severity: Medium]
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?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-t9xx_driver_v1-v14-0-08ebc870ea94%40compal.com
prev parent reply other threads:[~2026-12-03 9:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 8:58 [PATCH net-next v14 0/6] net: wwan: t9xx: Add MediaTek T9XX WWAN driver Jack Wu via B4 Relay
2026-12-02 8:59 ` [PATCH net-next v14 1/6] net: wwan: t9xx: Add PCIe core Jack Wu via B4 Relay
2026-12-03 9:46 ` netdev-bot+sashiko
2026-12-02 8:59 ` [PATCH net-next v14 2/6] net: wwan: t9xx: Add control plane transaction layer framework Jack Wu via B4 Relay
2026-12-02 8:59 ` [PATCH net-next v14 3/6] net: wwan: t9xx: Add control DMA interface Jack Wu via B4 Relay
2026-12-03 9:46 ` netdev-bot+sashiko
2026-12-02 8:59 ` [PATCH net-next v14 4/6] net: wwan: t9xx: Add control port Jack Wu via B4 Relay
2026-12-03 9:46 ` netdev-bot+sashiko
2026-12-02 8:59 ` [PATCH net-next v14 5/6] net: wwan: t9xx: Add FSM thread Jack Wu via B4 Relay
2026-12-03 9:46 ` netdev-bot+sashiko
2026-12-02 8:59 ` [PATCH net-next v14 6/6] net: wwan: t9xx: Add AT & MBIM WWAN ports Jack Wu via B4 Relay
2026-12-03 9:46 ` netdev-bot+sashiko [this message]
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=179629120355.3146.3262911149272753703@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=Jeff_Chang@compal.com \
--cc=Minano.tseng@mediatek.com \
--cc=andrew+netdev@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jackbb_wu@compal.com \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robert_yu@compal.com \
--cc=ryazanov.s.a@gmail.com \
--cc=shi-wei.yeh@mediatek.com \
--cc=skhan@linuxfoundation.org \
--cc=wen-zhi.huang@mediatek.com \
/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