[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z6O8ujq-gYVG4sjw@LQ3V64L9R2>
Date: Wed, 5 Feb 2025 11:32:10 -0800
From: Joe Damato <jdamato@...tly.com>
To: Stanislav Fomichev <sdf@...ichev.me>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com,
Saeed Mahameed <saeed@...nel.org>
Subject: Re: [RFC net-next 1/4] net: Hold netdev instance lock during
ndo_open/ndo_stop
On Tue, Feb 04, 2025 at 03:00:54PM -0800, Stanislav Fomichev wrote:
> For the drivers that use shaper API, switch to the mode where
> core stack holds the netdev lock. This affects two drivers:
>
> * iavf - already grabs netdev lock in ndo_open/ndo_stop, so mostly
> remove these
> * netdevsim - switch to _locked APIs to avoid deadlock
>
> Cc: Saeed Mahameed <saeed@...nel.org>
> Signed-off-by: Stanislav Fomichev <sdf@...ichev.me>
> ---
> Documentation/networking/netdevices.rst | 6 ++++--
> drivers/net/ethernet/intel/iavf/iavf_main.c | 14 ++++++-------
> drivers/net/netdevsim/netdev.c | 14 ++++++++-----
> include/linux/netdevice.h | 23 +++++++++++++++++++++
> net/core/dev.c | 12 +++++++++++
> net/core/dev.h | 6 ++++--
> 6 files changed, 58 insertions(+), 17 deletions(-)
[...]
> @@ -4474,12 +4471,12 @@ static int iavf_close(struct net_device *netdev)
> u64 aq_to_restore;
> int status;
>
> - netdev_lock(netdev);
> + netdev_assert_locked(netdev);
> +
> mutex_lock(&adapter->crit_lock);
>
> if (adapter->state <= __IAVF_DOWN_PENDING) {
> mutex_unlock(&adapter->crit_lock);
> - netdev_unlock(netdev);
> return 0;
> }
>
> @@ -4532,6 +4529,7 @@ static int iavf_close(struct net_device *netdev)
> if (!status)
> netdev_warn(netdev, "Device resources not yet released\n");
>
> + netdev_lock(netdev);
I'm probably just misreading the rest of the patch, but I was just
wondering: is this netdev_lock call here intentional? I am asking
because I thought the lock was taken in ndo_stop before this is
called?
Powered by blists - more mailing lists