public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, YehezkelShB@gmail.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com
Subject: Re: [PATCH 1/2] net: thunderbolt: Call tbnet_stop() upon shutdown
Date: Wed, 29 Apr 2026 07:30:46 +0200	[thread overview]
Message-ID: <20260429053046.GZ557136@black.igk.intel.com> (raw)
In-Reply-To: <20260429011224.1505785-1-kuba@kernel.org>

On Tue, Apr 28, 2026 at 06:12:24PM -0700, Jakub Kicinski wrote:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> ---
> net: thunderbolt: Call tbnet_stop() upon shutdown
>     
> This commit updates the shutdown callback for the Thunderbolt network service
> driver to call tbnet_stop() if the interface is running. This ensures the
> service drivers release the rings upon shutdown.
> 
> > diff --git a/drivers/net/thunderbolt/main.c b/drivers/net/thunderbolt/main.c
> > index 7aae5d915a1e..631af237998d 100644
> > --- a/drivers/net/thunderbolt/main.c
> > +++ b/drivers/net/thunderbolt/main.c
> > @@ -1417,7 +1417,10 @@ static void tbnet_remove(struct tb_service *svc)
> >  
> >  static void tbnet_shutdown(struct tb_service *svc)
> >  {
> > -	tbnet_tear_down(tb_service_get_drvdata(svc), true);
> > +	struct tbnet *net = tb_service_get_drvdata(svc);
> > +
> > +	if (netif_running(net->dev))
> > +		tbnet_stop(net->dev);
> 
> Does calling tbnet_stop() directly bypass the network stack teardown sequence?

This is called when the machine is rebooted or shut down to quiesce the
device. I don't think the network stack has anything similar?

> tbnet_stop() appears to be the driver's ndo_stop callback. By bypassing
> dev_close(), netif_tx_disable() is not called and the device's transmit queues
> remain active.

tbnet_stop() calls tbnet_tear_down() that calls netif_stop_queue() which
should stop the queue.

> tbnet_stop() destroys the DMA rings and explicitly sets net->tx_ring.ring
> to NULL:
> 
> drivers/net/thunderbolt/main.c:tbnet_stop() {
>     ...
>     tb_ring_free(net->tx_ring.ring);
>     net->tx_ring.ring = NULL;
>     ...
> }
> 
> If a concurrent transmission occurs, will tbnet_start_xmit() access the null
> pointer and cause a crash?

It should not happen see above.

> Additionally, since this does not hold the rtnl_lock(), could this race
> with concurrent administrative state changes (like 'ip link set dev down')
> and lead to a double-execution of tbnet_stop()?

As far as I can tell no because when these hooks are called userspace is
not running anymore (we are rebooting or shutting down).

  reply	other threads:[~2026-04-29  5:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27  8:16 [PATCH 1/2] net: thunderbolt: Call tbnet_stop() upon shutdown Mika Westerberg
2026-04-27  8:16 ` [PATCH 2/2] net: thunderbolt: Fix lockdep issue during tunnel tear down Mika Westerberg
2026-04-29  1:12   ` Jakub Kicinski
2026-04-29  1:12   ` Jakub Kicinski
2026-04-29  4:47     ` Mika Westerberg
2026-04-29  1:12 ` [PATCH 1/2] net: thunderbolt: Call tbnet_stop() upon shutdown Jakub Kicinski
2026-04-29  5:30   ` Mika Westerberg [this message]
2026-04-29 13:31     ` Andrew Lunn
2026-04-29 16:57       ` Mika Westerberg

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=20260429053046.GZ557136@black.igk.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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