🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #9602

Re: [PATCH net] net: lan966x: don't free XDP buffers in fdma tx clear with budget 0

#9602
From: Simon Horman
Date: Mon, 02 Nov 2026 11:41
80 lines
11464 bytes
On Mon, Nov 02, 2026 at 09:53:39AM +0100, Daniel Machon wrote:

...

> > net: lan966x: don't free XDP buffers in fdma tx clear with budget 0
> > 
> > This patch makes lan966x_fdma_tx_clear_buf() skip completed XDP_TX and
> > ndo_xdp_xmit DCBs when netpoll calls it with a budget of 0. That way the
> > page pool and XDP return APIs are not called with hardirqs disabled. The
> > skipped buffers are left for the next NAPI poll, and skbs are still freed
> > via napi_consume_skb().
> > 
> > > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> > > index 21668bbcc9063..1fbe910c5ec38 100644
> > > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> > > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> > > @@ -353,6 +353,12 @@ static void lan966x_fdma_tx_clear_buf(struct lan966x *lan966x, int weight)
> > >               if (!fdma_db_is_done(db))
> > >                       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;
> > 
> > [Severity: Medium]
> > Can this starve netconsole transmits on the port that owns the FDMA NAPI?
> > 
> > skbs and XDP frames get slots from the same ring through
> > lan966x_fdma_get_next_dcb(), which only checks the used bit:
> > 
> > lan966x_fdma_get_next_dcb() {
> >         ...
> >                 if (!dcb_buf->used &&
> >                     !fdma_is_last(&tx->fdma, &tx->fdma.dcbs[i]))
> >                         return i;
> >         ...
> > }
> > 
> > If heavy XDP_TX or ndo_xdp_xmit traffic fills every usable slot, a
> > netpoll skb ends up here in lan966x_fdma_xmit():
> > 
> >         next_to_use = lan966x_fdma_get_next_dcb(tx);
> >         if (next_to_use < 0) {
> >                 netif_stop_queue(dev);
> >                 return NETDEV_TX_BUSY;
> >         }
> > 
> > __netpoll_send_skb() then polls between retries:
> > 
> > netpoll_poll_dev()->poll_one_napi()->napi->poll(napi, 0)
> >   ->lan966x_fdma_tx_clear_buf(lan966x, 0)
> > 
> > With the new check, every completed XDP DCB is skipped. No slot is freed,
> > clear stays false, and lan966x_fdma_wakeup_netdev() is never called.
> > 
> > Once the retries run out, the skb is put on npinfo->txq and handed to
> > delayed work, and later messages queue behind it. In normal operation a
> > later IRQ-driven NAPI poll frees the DCBs and output only comes late.
> > 
> > During a panic, with the other CPUs stopped and hardirqs off, would that
> > work ever run? If not, the netconsole output is lost.
> > 
> > Before this patch, the budget-0 poll freed those slots, so netpoll could
> > make progress.
> 
> Seems right, however, AFAICT, this is only an issue if the panic hits while the
> ring is completely full of finished XDP frames. Freeing those frames from
> netpoll is what napi.rst forbids: with a budget of 0 the driver cannot call any
> XDP or page pool APIs, and doing so is the splat this patch fixes.
> 
> The only other way I see is to give XDP its own FDMA injection channel, so XDP
> frames can never take the slots netpoll needs. lan966x has free injection
> channels for that, but it is a rework for net-next, not a fix for net.

Yes, agreed.

Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID: <20261102114135.GZ257209@horms.kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354636-linux-kernel-netdev=dewy.ru
References: <20261029-lan966x-fdma-tx-clear-budget-v1-1-38c52d7aab8c@microchip.com> <179339596952.3131.4206946876532380801@kernel.org> <20261102085339.ixdqujaly75yldp7@DEN-DL-M70577.microsemi.net>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354636-linux-kernel-netdev=dewy.ru
From: horms@kernel.org (Simon Horman)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net: lan966x: don't free XDP buffers in fdma tx
 clear with budget 0
Date: Mon, 2 Nov 2026 11:41:35 +0000
Organization: Usenet Network
Message-ID: <20261102114135.GZ257209@horms.kernel.org>
References: <20261029-lan966x-fdma-tx-clear-budget-v1-1-38c52d7aab8c@microchip.com>
 <179339596952.3131.4206946876532380801@kernel.org>
 <20261102085339.ixdqujaly75yldp7@DEN-DL-M70577.microsemi.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="2913578"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:O8wHwakmrgEP6OOKsQIgcHpKTLc= sha256:UOgfSsVldgMt885GtgkQtEdGW5oLog6u10jmjnS1Ee8=
	sha1:510DDrh3UpvojnXb9fBG24VWBPs= sha256:cnLEBZUWvdya7DIrlAYtc9u8bmK2yAm7tL3MbEQE7fE=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id B633B1124B7; Mon,  2 Nov 2026 14:48:02 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id KJiLZ_6RLE7y;
	Mon,  2 Nov 2026 14:48:00 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-354636-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id E379D112494; Mon,  2 Nov 2026 14:47:50 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 9E718322E5; Mon,  2 Nov 2026 11:41:59 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793619707;
	b=RYEk+s9nlwg6o5KvzDXBEZ6j9JhxLxdgPAU0tJVTTGldnJsjQKl4VZTu3iuv9QM6YHz+
	 B/s0La0/7KRq+7aX0WMNb8YENVHMDGJxhb2k0SVWbNSOOXpU77tjxqX/z/DxE2acEEP/9
	 Qd0gbJ/mAeb+7OjwdgrqIuCMCTEVkivqiS+VaOxcVULiwKc8eZP4BjXYMhyBvTHZkoM1i
	 qBO0jSO9UDA3ciCXg+o97OVb4OvCua+BezlN00QYFVSTIuahyRLYfunW6NtPzZrqZ8GAk
	 DPYA7l6J9+pDYxbRjzxZmB2R9Bd9Wyyo9KVbqwAi3YziVVb+r34z+9z4nU2RjWhYaXA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793619707;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=D7JmBEmGxLSymZEgdcnCU2t6UAxvf8KOZhQUE4OtCSk=;
	b=IfP/PuWTZSY6s2RjFFM8YmQCDUjBxwh0C+24US5TU1DoqNl788qMw4R53nBNxCDlXkR3
	 ezfXpGaMUoIFFuqEPF7fXbzxgDKtVEN35tKi20gCYLqZ/m/OtffnqFhwhnEsHVY0ovzEK
	 RoK1aqU0wD/9Q5+UVEb7bqPPcm4LvcEPLqQDerwvB2O28SSigSbqQjrXVarVBSEVRIQO0
	 bhc/cCPJoqZnmWkC9gv0P9rP7rJSZBSMwus6Htkott+MHLGqqJQjzYOlNCg+wGTuAZPdW
	 cAqTePbcL6DIe64KG+0K4wU+1AerAXq6Ohd+mtErFe6YqgacvSYU36qvSYCCZ3gLVyQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Xtt5IeDR;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id DA323606A32F;
	Mon,  2 Nov 2026 11:41:47 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Xtt5IeDR
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793619701;
	b=nHapjpNFovuxvoE6v0OnMW6L2HG+yOC5zAVdNERwkRVkirV3q1yHhsK91/c/bN+kb+pi
	 XftnbMlJ75q/e4JgBT8HY6k6mvS8rAuCeO7B5AcdykH82k3O5xbNKckobs6on+IjR+yLu
	 qpDctR779XNmfxygv24uXKRPL0UYUhaoGE2D3X7GmXjvIZ5F2v04SS5oV/ey4WlglfZ0R
	 fV5PgCcAeh8XPvLjNBCxtp7KmKiHAjTaN5RB4UVclf3cFbpKkBW/SGxF+yED/ulm+Gfz2
	 hoYhavV9WmQQskce9OnbhDNPp68oRDapQNnggNOWLJ6TmzyKMsUDZlYTwpQw4SW9N2w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793619701;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=D7JmBEmGxLSymZEgdcnCU2t6UAxvf8KOZhQUE4OtCSk=;
	b=u7lKxjABSe2bszkzvGupZN8nO8k3PO1IP3kdDlYgeCJ4h1OEBUUbGjGRGeRkAcNYGeRC
	 5Ja6/ZWYbeI4a1W30DDchBiRA4TehFB1ssYaxFRTlUG0E+5TJnTM2gQeFkSQ7+HzwZ3ho
	 fSEumGJUuabe2+Z9I5zlPaH76igomLPT7hcvIDb/vtoZ/lS/3FwlKg3G1kkiFK3LvaQIk
	 jdd9colG0fOnEY2XJ+tcdU9nLQyhb5AB0AXA4aJSU5cnmuUHtmktlKIKjE7u85O18KCFH
	 ExjRqr1Pts3JsD/3YooRBBZNnTnfAIGOaTXhMmQMlRJrd3q2W3/H+iCX1UHw/LwyV2g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Xtt5IeDR;
	arc=none smtp.remote-ip=100.103.45.18
X-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 5AF30606A32C;
	Mon,  2 Nov 2026 11:41:41 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 102AB1F00A17;
	Mon,  2 Nov 2026 11:41:37 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793619701;
	bh=D7JmBEmGxLSymZEgdcnCU2t6UAxvf8KOZhQUE4OtCSk=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=Xtt5IeDR89+p0IFG3i/oji1M7Ob6cWmPDAL2Bqsm52BigcI4+W4gfzBSBhkvWa3Ll
	 bp9Qi5GCpO7jnE8RomT7sZbhYkAZpnUdGGsUU8e5ap9rb7v3vYvzjb86vXpZAEehS3
	 YstXcs5mQmqtQZx1iGVq0adDtIP0/ySLSRk+oiZq/VkdN8FL0ZZCQsREEtAZAAVlqy
	 ks7nWXXmH0TtZJ2jJwXlIJk8dqjLfV6zY05pO1Om4obASa68/LM4Cjs2Jf8rsiqtVI
	 N0YJ8TR8j3B6e2Rq8iKed6uPT7RblHrU+A9yyCIu3bGYlk2kqYCpksuntO3bJHMhyk
	 1RKitP+UOGEtg==
X-Cc: netdev-bot+sashiko@kernel.org, horatiu.vultur@microchip.com,
	UNGLinuxDriver@microchip.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net,
	hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261102085339.ixdqujaly75yldp7@DEN-DL-M70577.microsemi.net>