[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z+qAYXmGY08pQKKb@gmail.com>
Date: Mon, 31 Mar 2025 04:45:37 -0700
From: Breno Leitao <leitao@...ian.org>
To: Stanislav Fomichev <sdf@...ichev.me>, kuniyu@...zon.com
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, linux-kernel@...r.kernel.org,
michael.chan@...adcom.com, pavan.chebbi@...adcom.com,
andrew+netdev@...n.ch, Taehee Yoo <ap420073@...il.com>
Subject: Re: [PATCH net] bnxt_en: bring back rtnl lock in bnxt_shutdown
Hello Stanislav,
On Fri, Mar 28, 2025 at 10:42:16AM -0700, Stanislav Fomichev wrote:
> Taehee reports missing rtnl from bnxt_shutdown path:
>
> inetdev_event (./include/linux/inetdevice.h:256 net/ipv4/devinet.c:1585)
> notifier_call_chain (kernel/notifier.c:85)
> __dev_close_many (net/core/dev.c:1732 (discriminator 3))
> kernel/locking/mutex.c:713 kernel/locking/mutex.c:732)
> dev_close_many (net/core/dev.c:1786)
> netif_close (./include/linux/list.h:124 ./include/linux/list.h:215
> bnxt_shutdown (drivers/net/ethernet/broadcom/bnxt/bnxt.c:16707) bnxt_en
> pci_device_shutdown (drivers/pci/pci-driver.c:511)
> device_shutdown (drivers/base/core.c:4820)
> kernel_restart (kernel/reboot.c:271 kernel/reboot.c:285)
I've got this issue as well.
>
> Bring back the rtnl lock.
>
> Link: https://lore.kernel.org/netdev/CAMArcTV4P8PFsc6O2tSgzRno050DzafgqkLA2b7t=Fv_SY=brw@mail.gmail.com/
> Fixes: 004b5008016a ("eth: bnxt: remove most dependencies on RTNL")
> Reported-by: Taehee Yoo <ap420073@...il.com>
> Signed-off-by: Stanislav Fomichev <sdf@...ichev.me>
Tested-by: Breno Leitao <leitao@...ian.org>
> ---
> drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 934ba9425857..1a70605fad38 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -16698,6 +16698,7 @@ static void bnxt_shutdown(struct pci_dev *pdev)
> if (!dev)
> return;
>
> + rtnl_lock();
> netdev_lock(dev);
can't we leverage the `struct net_device->lock` for the shutdown.
Basically we have the lock the single device we are turning it down.
I am wondering if we really need the big RTNL lock. This is my
understanding of what is happening:
pci_device_shutdown() is called for a single device
- netdev_lock(dev)
- netif_close(dev);
- dev_close_many(&single, true);
- __dev_close_many()
- ASSERT_RTNL();
Basically we ware only closing one device, and the net_device->lock
is already held. Shouldn't it be enough?
Can we do something like this (from my naive point of view):
static void __dev_close_many(struct list_head *head)
{
struct net_device *dev;
- ASSERT_RTNL();
might_sleep();
list_for_each_entry(dev, head, close_list) {
+ ASSERT_RTNL_NET(dev);
...
}
Thanks
--breno
Powered by blists - more mailing lists