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 7FE8E606A32D for ; Tue, 1 Dec 2026 04:37:18 +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=Q2ZGPEfR; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=F04MA/cb 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=xRNFrqvGnz/l8X4U3VNaq2y3kjRE03UdEtIOqk/0tgg=; b=Q2ZGPEfRzq7F4lHeB9s+LXgtMf pzgDzdtmiQ64JAEoJO9bsn3GcI/Of7vlti5rLjEv+kE26+RA/DBx8s0GKtGjJaLrdjcq/136dxhoz YRSA8pAzECKThsw3rBXWVF5oes3+UC59ncbk46sxZGCz/CjLegZL4F3OAA/hTobvCTcugkK89+8GY /OUbc2CBfqgAU1k/BkoebAgpvvbTQ4GApFuH81eylSfz+B+UZI++9jpfXPjyxUDncZowExxMO3e6z htEwT6EizMSS6oDKMnYSJdL6qgJEd3gFfjq/Snh82T4Dh1NKIafE33nP1tbKCOIfMNy7YX+x7i7D/ 3IEu4u1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYFc7-00000006cX1-08Ym; Tue, 01 Dec 2026 04:37:11 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYFc5-00000006cWX-3wmm; Tue, 01 Dec 2026 04:37:09 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 50F98400B0; Tue, 1 Dec 2026 04:37:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9384D1F00893; Tue, 1 Dec 2026 04:37:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796099829; bh=xRNFrqvGnz/l8X4U3VNaq2y3kjRE03UdEtIOqk/0tgg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=F04MA/cbwauZjo90f3rGrzD81ZNdoAlwRBH3t2gLAOipR1DfcpNf1FvDL8ZyJmupZ P4W47X3vxjPZevOiVbj+Cvz/Xwkyy2OdOeJCCfx+sWp8WyKel9r/7EnwIWRoeN8P3u YcuJWgcafqt9jUDlJIslmegJAWB0sYNUgxJ2XvjgDDbxobhU2ctShUlbQ+xAlfSQZ2 KiXt9jj2+iyetvmbBK0IaJGU82pSP1hhGxcy+KSgOg8q3VCXl+Wtx6SqmcLoosziDC qWVibZovkK+4o2hNM04WnTwO3KY/SCs0amgXNbBZAAgz7kwYVW9s0Ab0F35Ge2D93y z4jJCz5vEvAQw== Subject: Re: [PATCH net 1/2] net: airoha: fix NPU mailbox notification ordering From: netdev-bot+sashiko@kernel.org To: faliang.wang@airoha.com Cc: netdev@vger.kernel.org, lorenzo@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Date: Tue, 01 Dec 2026 04:37:08 +0000 Message-ID: <179609982804.3146.10880112368695516095@kernel.org> In-Reply-To: <20261130034106.869059-2-faliang.wang@airoha.com> References: <20261130034106.869059-2-faliang.wang@airoha.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Archived-By: MIME-Version: 1.0 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" 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=unavailable 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 more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] net: airoha: malformed placeholder Fixes trailer in commit message Pre-existing issues: - [Medium] airoha_npu_send_msg() maps the caller's buffer with dma_map_single(..., DMA_BIDIRECTIONAL) and writes its bus address to… -- net: airoha: fix NPU mailbox notification ordering This patch changes the write order in airoha_npu_send_msg(). The function information is now written to CTRL(3) before the CTRL(2) message counter is incremented. Incrementing that counter is what tells the NPU a new message is ready, so the NPU now sees the function information before the notification. > diff --git a/drivers/net/ethernet/airoha/airoha_npu.c b/drivers/net/ethernet/airoha/airoha_npu.c > index edec6b1118956..7f7cdc2553ad4 100644 > --- a/drivers/net/ethernet/airoha/airoha_npu.c > +++ b/drivers/net/ethernet/airoha/airoha_npu.c > @@ -178,10 +178,10 @@ static int airoha_npu_send_msg(struct airoha_npu *npu, int func_id, > > regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(0) + offset, dma_addr); > regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(1) + offset, size); > - regmap_read(npu->regmap, REG_CR_MBQ0_CTRL(2) + offset, &val); > - regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(2) + offset, val + 1); > val = FIELD_PREP(MBOX_MSG_FUNC_ID, func_id) | MBOX_MSG_WAIT_RSP; > regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(3) + offset, val); > + regmap_read(npu->regmap, REG_CR_MBQ0_CTRL(2) + offset, &val); > + regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(2) + offset, val + 1); > > ret = regmap_read_poll_timeout_atomic(npu->regmap, > REG_CR_MBQ0_CTRL(3) + offset, [Severity: Low] The Fixes tag in the commit message still contains the template placeholder: Fixes: REAL_LINUX_SHA ("EXACT_ORIGINAL_COMMIT_SUBJECT") That is not a valid trailer. checkpatch will flag it. The stable tooling also has no commit to match against, so this fix may not be picked up for the kernels that carry the original ordering. The history suggests that airoha_npu_send_msg() and the original CTRL(2)-then-CTRL(3) write sequence came in with the initial NPU support. If so, the tag should read: Fixes: 23290c7bc190 ("net: airoha: Introduce Airoha NPU support") Could you confirm that this is the commit that introduced the problem and update the trailer in v2? [Severity: Medium] This is a pre-existing issue, not one introduced by this patch. What happens to the DMA buffer when this poll times out? After the CTRL(2) increment, the poll waits for MBOX_MSG_DONE with a timeout of 100 * MSEC_PER_SEC us, which is 100 ms. On -ETIMEDOUT the rest of airoha_npu_send_msg() runs as normal: spin_unlock_bh(&npu->cores[core].lock); dma_unmap_single(npu->dev, dma_addr, size, DMA_BIDIRECTIONAL); return ret; On this path nothing tells the NPU to drop the message. CTRL(0) and CTRL(1) still hold the buffer address and size, and the counter is not rolled back. Every caller then frees the buffer, whatever the return value. For example, in airoha_npu_wlan_msg_send(): err = airoha_npu_send_msg(npu, NPU_FUNC_WIFI, wlan_data, len); kfree(wlan_data); The same holds for airoha_npu_wlan_msg_get(), airoha_npu_ppe_init(), airoha_npu_ppe_deinit(), airoha_npu_ppe_flush_sram_entries(), airoha_npu_foe_commit_entry() and airoha_npu_ppe_stats_setup(). The NPU writes responses back into this buffer. Could it then DMA into memory that is already unmapped and freed, if the firmware finishes a timed-out request late? A later airoha_npu_send_msg() call would also overwrite CTRL(0), CTRL(1) and CTRL(3) while the earlier request might still be in progress. Whether the firmware actually completes a request after the host gives up cannot be confirmed from the kernel source alone. The follow-up patch in this series, "net: airoha: retry WLAN initialization commands", resends WLAN init commands after a failure, including -ETIMEDOUT, without any abort step. Does that make the timeout-then-reuse sequence more likely? Would it help to have an abort or ownership handshake with the NPU before unmapping and freeing the buffer on timeout? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130034106.869059-1-faliang.wang%40airoha.com