From: netdev-bot+sashiko@kernel.org
To: mika.westerberg@linux.intel.com
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
Subject: Re: [PATCH v3 2/4] net: thunderbolt: Stop queueing Rx buffers if allocation fails
Date: Tue, 01 Dec 2026 12:17:43 +0000 [thread overview]
Message-ID: <179612746376.3146.3895025036613839913@kernel.org> (raw)
In-Reply-To: <20261130113657.3440005-3-mika.westerberg@linux.intel.com>
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
next prev parent reply other threads:[~2026-12-01 12:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 11:36 [PATCH v3 0/4] net: thunderbolt: Various fixes Mika Westerberg
2026-11-30 11:36 ` [PATCH v3 1/4] net: thunderbolt: Fix race condition when the link is torn down Mika Westerberg
2026-12-01 12:17 ` netdev-bot+sashiko
2026-11-30 11:36 ` [PATCH v3 2/4] net: thunderbolt: Stop queueing Rx buffers if allocation fails Mika Westerberg
2026-12-01 12:17 ` netdev-bot+sashiko [this message]
2026-11-30 11:36 ` [PATCH v3 3/4] net: thunderbolt: Prevent Tx descriptor leak in tbnet_start_xmit() Mika Westerberg
2026-11-30 11:36 ` [PATCH v3 4/4] net: thunderbolt: Free partially completed skb when the link is torn down Mika Westerberg
2026-11-30 11:39 ` [PATCH v3 0/4] net: thunderbolt: Various fixes netdev-bot+sinfo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179612746376.3146.3895025036613839913@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=YehezkelShB@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=westeri@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox