From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DB3D606A32C for ; Thu, 3 Dec 2026 09:46:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=rUkb+Fyd; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XqyJ036f DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Message-ID:Date :Cc:To:From:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=OOn7/eqh3KxtpBwWVeK0W09M0kLW3PnrkOFEM/caKHM=; b=rUkb+FydjICedJ+N1P006SwqLq HyCT2ZwMGyLC+I9rHOZaX3CE/ssbvDXuV8ssMtXoiobCrxe812j7pOuhQ9NcoqG8WTvhPicdYXLSw tvxDD+hrLsTc5BTdncEmP3ABeR1E4Ay9dMbhEMSE8EcXsNyjGXgZPN5LmmmHyvMY5n3QQ1zvga0R2 hHuZMSvujhjmFp02wPyaqwKmlqCbRh7gzrNLBI8CuBY8bzCaAv6VDsLgWca9Cc2xcktbSW7hjKseQ htGieEsJ1xsdvROcI9FT6qw2EkWLzeMybhqdcxWFIPqjvprG29SUOqoHE3m/XiHDWtqJjRMgMjFZf O8QYxGxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ3Oz-0000000E2lQ-426w; Thu, 03 Dec 2026 09:46:58 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ3On-0000000E2Zm-2CWk; Thu, 03 Dec 2026 09:46:45 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 4632841144; Thu, 3 Dec 2026 09:46:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F21EB1F0092C; Thu, 3 Dec 2026 09:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796291205; bh=OOn7/eqh3KxtpBwWVeK0W09M0kLW3PnrkOFEM/caKHM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=XqyJ036fxOzEz8OGPduw6lawJ47eKa1CcflLhO9B3tisGYdx7Au0tmlTwYgihh/sZ JpX6zKhaNEAUNpJH9JJkofGewGJO0+sO8qpnbjka2MZwOF11hG2Zn7RLIlBvIAGdVO kDvHtFsw0sQ2uoKwZ80WWVweMcRIlRPeFpftEPsaG/2wvFWV5kUJCSQS/wlj8/Gl0g bzB+8Ir+Oj/qCFMfmr2JS5u29kwU1U7oZLLnzJ3fR8Z1YHLKx6dxz+N5ZzBBaRpxsM 5ma4k0Kh3K0A2/e4yYeeQgybvfhJSU+7dwuyALsGNBDI+MLKRkzdESR13fgV5w1HEx 6W6eUIrrsV0gQ== Subject: Re: [PATCH net-next v14 6/6] net: wwan: t9xx: Add AT & MBIM WWAN ports 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 Date: Thu, 03 Dec 2026 09:46:43 +0000 Message-ID: <179629120355.3146.3262911149272753703@kernel.org> In-Reply-To: <20261202-t9xx_driver_v1-v14-6-08ebc870ea94@compal.com> References: <20261202-t9xx_driver_v1-v14-6-08ebc870ea94@compal.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Archived-By: MIME-Version: 1.0 X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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