Article View: linux.kernel.netdev
Article #25218Re: [PATCH v3 2/4] net: thunderbolt: Stop queueing Rx buffers if allocation fails
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 12:17
Date: Tue, 01 Dec 2026 12:17
81 lines
10556 bytes
10556 bytes
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] tbnet_connected_work() in drivers/net/thunderbolt/main.c gains a
napi_enable()/napi_schedule() pair in this patch.
--
net: thunderbolt: Stop queueing Rx buffers if allocation fails
With this patch, tbnet_alloc_rx_buffers() stops and keeps the buffers it
has already queued when an allocation fails, instead of freeing them while
their descriptors are still in the hardware ring. tbnet_poll() keeps NAPI
polling so the allocation can be retried. NAPI enable and disable move into
tbnet_connected_work() and tbnet_tear_down() so that they bracket the time
the rings are running.
Closes: https://sashiko.dev/#/patchset/20260902082128.1148463-1-mika.westerberg%40linux.intel.com
> diff --git a/drivers/net/thunderbolt/main.c b/drivers/net/thunderbolt/main.c
> index ede105cdc3a37..d5e49bc381041 100644
> --- a/drivers/net/thunderbolt/main.c
> +++ b/drivers/net/thunderbolt/main.c
[ ... ]
> @@ -691,7 +698,11 @@ static void tbnet_connected_work(struct work_struct *work)
>
> ret = tbnet_alloc_tx_buffers(net);
> if (ret)
> - goto err_free_rx_buffers;
> + goto err_stop_rings;
> +
> + napi_enable(&net->napi);
> + /* Unmasks the ring interrupt if it was masked */
> + napi_schedule(&net->napi);
[Severity: Low]
tbnet_connected_work() is a work item queued on system_long_wq. It runs in
a kworker in process context with BH enabled.
Called from there, napi_schedule() leads to:
napi_schedule()
__napi_schedule()
____napi_schedule()
raise_softirq_irqoff(NET_RX_SOFTIRQ)
Because !in_interrupt(), raise_softirq_irqoff() only marks NET_RX_SOFTIRQ
pending and wakes ksoftirqd. The softirq does not run right away.
Does that mean the first tbnet_poll() waits for ksoftirqd or the next
irq_exit? If so, the tb_ring_poll_complete() call that unmasks the Rx ring
interrupt, which the comment above refers to, waits as well.
Other drivers wrap this call in a BH-disabled section, for example
virtnet_napi_do_enable() in drivers/net/virtio_net.c:
napi_enable(napi);
...
* Call local_bh_enable after to trigger softIRQ processing.
*/
local_bh_disable();
virtqueue_napi_schedule(napi, vq);
local_bh_enable();
Would wrapping this napi_schedule() in local_bh_disable() and
local_bh_enable() make the initial poll run as soon as BH is re-enabled?
>
> ret = tb_xdomain_enable_paths(net->xd, net->local_transmit_path,
> net->tx_ring.ring->hop,
[ ... ]
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130113657.3440005-1-mika.westerberg%40linux.intel.com
Technical Details
Message-ID:
<179612746376.3146.3895025036613839913@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375005-linux-kernel-netdev=dewy.ruReferences:
<20261130113657.3440005-3-mika.westerberg@linux.intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375005-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH v3 2/4] net: thunderbolt: Stop queueing Rx buffers if allocation fails Date: Tue, 01 Dec 2026 12:17:43 +0000 Organization: Usenet Network Message-ID: <179612746376.3146.3895025036613839913@kernel.org> References: <20261130113657.3440005-3-mika.westerberg@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1706715"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:n+If09ZijHiBNZvIASbZU3IbovU= sha256:XoCt6zrTGya9s9L0J6PspuMNtccURLbHDlm4HMTzock= sha1:nyWGvvL+tfsrQNwgVkvOqElDi0Q= sha256:MQvIgQwKnE3MqI1SPNgMGtZtMbzMFizl7xHRwBOVXog= 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 CC1C8117367; Tue, 1 Dec 2026 15:18:06 +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 C3ii-fUbWfDq; Tue, 1 Dec 2026 15:18:03 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-375005-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id B62CE117359; Tue, 1 Dec 2026 15:17:53 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id C54B724838; Tue, 1 Dec 2026 12:17:49 +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=1796127465; b=CmBjTyOxkJXla0agag+GWjEWRf6tJpht2SoR/zt6UlroEijamYfgo50Y8CyRvVHBv7RW DkXty+y9f31YtvckHttJ473vC5LpGZcceddWXsr2LKPZ6L3t/cJT3oupQBED56ueyonsg Lvz38OGvT7ZiwJV/H+J+D8eFtR0utKaPaVHygOQKSxyU+TzGcIt/KB5N5Ae/FgOZsC2dg kzI841wNJuY7KSfYaAEL0gBXIuAPykcskbyyCPSxoRuKdcbFq1o5s58FBh6s2MsjIk8K1 WXJ/iTHw0iWaW2x58WCq2jq0AZRtl4H5TuSms0B97H5bIZ2bsDEDZdvCtpr4fWP0qig== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796127465; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=c7KPueoXj3VzGcxKSPMkMvI/Yg+NjtMgOs6A6l3ZL6s=; b=nf6OhdqlsFs7rJZeUfND1qLVAlnnMvI1sUAjptQtMxKuxdysGH+jcR/PgSrh3jN4kiwb rJOdux0YLup0jPs26rcCyY/Qk3Uy5YVm7ulyDtZTDDhS/8goDQjoSptkZWzrIptwdSVff RUv2z9srNcZWf4UhUX2GWLVBxWVBBKYUwzxx5SFYbomBRO1522Bce8ZUx7oyChP3bd+ii 1NMsAi0TxhtHn8Kua1OWHmC2FfgjNL/VUXexPLKsxf4C2I8txZ8RP9OGJDcYLrzQUw6zb eRjovRasx6B/51PEJhC2ZLJcrl0mU9fF13gxmNflclUchZwIzZX8U72gVXZ2C/000Fw== 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=TYv6IGWX; 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 B2EF6606A685; Tue, 1 Dec 2026 12:17:45 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TYv6IGWX 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=1796127464; b=2tsTiCK2jWVFDqhVdIe5OpOFFbk5kqRi2pSdCthWrOnVYjob0AtPF+TLX8u9AZXQGEO8 qjEAKNAEwKr2+nTFG9GMqGxoPItBbqkUqdA20uico//uopxWVl3lCtrzpnaYiTbjoWOwQ ra6GunL7pHuxFga5NaxlKv/fi6wb0M4uf5rWkjIyRvNQeFLDERuSpcRrz/0P5w2vUUASV 3eNXzEScEc3tdO3tUm/OoJFRVUoy3i1yDVVrD4tF0cw3w1o9CzusxN2thEFgp5VRTDw8m 53uj+EJek6nkbyMnOzuIWXBDqVV9wsNq8xHy+V4O49SGx7CT6HVKJo7Z4sKqWmboCxg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796127464; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=c7KPueoXj3VzGcxKSPMkMvI/Yg+NjtMgOs6A6l3ZL6s=; b=302R7XyaHGEONEOqx4rheX/BIKlLfLoMIYPqgr0URiEkMjbGhI7H1Y9pXDGu/sU4qpqg SYH5ouWiaF073FA2acHWsSL3r2nx5UYw5DkATMVmZBjZFKpKR+W/azL8j4Fmx0P82O3wz DtHpjCaSEtAgD/6BydwYi1zpMiAIbCnuLLEkj7yJC0reJvksSDSjWMn4JmLw00cEuS/f1 DGQEP0M8WPi1HQ8sz0vOVGjQaC881JwP++0FI25X3xPmfW9kyhxXrFXrcPnNivdnp7px/ zV2VnDcZWwUbXWfC/TKqVsEhdrP9PMugc0Nty7Q18jzwHKUcaF2em4WymSHKki5NowQ== 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=TYv6IGWX; 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 D4363606A33F for <netdev@vger.kernel.org>; Tue, 1 Dec 2026 12:17:44 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 372C01F0089B; Tue, 1 Dec 2026 12:17:44 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796127464; bh=c7KPueoXj3VzGcxKSPMkMvI/Yg+NjtMgOs6A6l3ZL6s=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=TYv6IGWXvtLsZrpfleyR+z8ge9Yv45hcW6YJ69F10CPoN2gmQbq7vR2ni46lJL3yP vskU5qH1Y7F1PdswqOHpV0eYu0lnN7cBix7vUhAcV9Mu9quz6u6R2krv+bAUqWNIRc Gi2wdpPHmhXyK4/8G6+D1O/amKm+lx5eFMhBpgEBJyHPYM0vAgb/+NYP0FqYvQpu4b RPdPcqmVIrphdUYfy8dqR9khs6ittOt0iU8I8gHJ0O4a9OMNE6EVosAypZFrXujoCi g80aQ9qmVpjb1+fgwRyimbA2FWS3B/paS1QpXwDrkujCOIDmS01dvZpwlBsANnmwpr d7QhESAxV/qKA== X-Cc: netdev@vger.kernel.org, YehezkelShB@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, westeri@kernel.org X-In-Reply-To: <20261130113657.3440005-3-mika.westerberg@linux.intel.com> X-sashiko-severity: Low 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