From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384292; b=etSs8JbyaoV/2K2PStFzssBHGWJP+Hk3VMkY/X7J7nHj+hI1unzLksS4uQqJdRiqpFYV 5ZNtE1O8XnfYsYJgmPjHo+23NrD0ZsGBlCZ8D16zRQM3E/O2OdYXfZZ+RKKkdxjZ5q7aK 9kpWkS+c7Z4gLAPNqL2wXKA2RX0ErYLRnZmSzm2uULBV1jyhqcvPF5NpHLXLET4VJLTGg K4Y0i210iYG8GGVnoFBos7GdJXYZN6zbfpX8mUqVry2gFN+T60wqvSKSwxt2RGJUqeQAx G20BaPm7ogt1CY4pn64eP+py4DHnGs62D2eJ08xsfN8Ev+6Yre+NhYG17wEBbJrAF0A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384292; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=mgkQLqMKatMW8SpMyknBY24wifEjW1/pP4WANp9A4x8=; b=RL1uRAZhLXKO0xHsJ4+gWbIHZxnralfoZC1AYP3SqJkN3pvm9f2Zpn8Ku8JLFAFYoO6L vko+cX5b1xr1xC9n5lQrdQ8DHSxMLPI9y089U2dNekLVU8Z/yKnG+muFe/seXu15S6yMO jW7VEb9/4vHZQkKN61ji9bK23g+90kLoDAo+SmPavCXPlftP07LM0TNehH6u0rhN+Pd3h QOLKdQpNpvWr6gsPgwCXXNOPUIzzkPdoZ/5Mk4nSr9Ng7U5CWOplVQz7d0RIyS8TN3742 iNGfQ3k7KvJXIgQeX4nI0FphEOBIuUT7SN9EoA/iOi5hpDAGhfKWaqF705Xu55xapVg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=q4qyD9Ho; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A890F606A322; Fri, 4 Dec 2026 11:38:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=q4qyD9Ho Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E10A1F000CE; Fri, 4 Dec 2026 11:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384292; bh=mgkQLqMKatMW8SpMyknBY24wifEjW1/pP4WANp9A4x8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=q4qyD9Ho//b+GTjhMLzVaWvYiiyco6DN40UYXyoFlrwbZzf3qquEFzEafU6XdgHpr OSgRUsAyOw5M6g63RbPddjQKvjsvT8EhVT3LKujc0B/+KXbebdEy3GVQwVyQjPq/CH U7iMIld6zwe1fxnkIIygPVjuxSiqMtlBO7VVqoLU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Daniel Machon , Simon Horman , Paolo Abeni , Sasha Levin Subject: [PATCH 6.6 0089/1167] net: lan966x: dont free XDP buffers in fdma tx clear with budget 0 Date: Fri, 4 Dec 2026 18:51:56 +0900 Message-ID: <20261204100704.414409814@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daniel Machon [ Upstream commit 263a5514cb9535380734b5e300b298f82570eb57 ] lan966x_fdma_tx_clear_buf() runs from the NAPI poll and frees the buffers of completed tx DCBs with napi_consume_skb(), page_pool_recycle_direct() and xdp_return_frame_bulk(). netpoll calls the NAPI poll with a budget of 0 and hardirqs disabled. With a budget of 0, a driver cannot call any XDP or page pool API. Before this patch, the XDP_TX pages and ndo_xdp_xmit frames are freed regardless of the budget. With netconsole on the port that owns the FDMA NAPI, such a buffer is freed with hardirqs disabled, and __page_pool_put_page() warns via lockdep_assert_no_hardirq(). Leave the XDP buffers of completed DCBs in place when the budget is 0, and free them in the next NAPI poll. napi_consume_skb() already handles a budget of 0, so skbs are still freed. Found by an AI code review agent. Reproduced on a lan9668 board with a modified kernel that runs the NAPI poll with a budget of 0 and hardirqs disabled. With the fix the warning is gone. Fixes: 19c6f534f636 ("net: lan966x: Add support for XDP_TX") Signed-off-by: Daniel Machon Reviewed-by: Simon Horman Link: https://patch.msgid.link/20261029-lan966x-fdma-tx-clear-budget-v1-1-38c52d7aab8c@microchip.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c index a99feb266c36c..4bebf0c91f30b 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c @@ -416,6 +416,12 @@ static void lan966x_fdma_tx_clear_buf(struct lan966x *lan966x, int weight) if (!(db->status & FDMA_DCB_STATUS_DONE)) continue; + /* XDP and page pool APIs can't be used with a budget of 0. + * Leave these buffers for the next NAPI poll. + */ + if (!weight && !dcb_buf->use_skb) + continue; + dcb_buf->dev->stats.tx_packets++; dcb_buf->dev->stats.tx_bytes += dcb_buf->len; -- 2.53.0