From: Joe Damato <jdamato@fastly.com>
To: Stanislav Fomichev <sdf@fomichev.me>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com,
Saeed Mahameed <saeed@kernel.org>
Subject: Re: [RFC net-next 1/4] net: Hold netdev instance lock during ndo_open/ndo_stop
Date: Wed, 5 Feb 2025 11:32:10 -0800 [thread overview]
Message-ID: <Z6O8ujq-gYVG4sjw@LQ3V64L9R2> (raw)
In-Reply-To: <20250204230057.1270362-2-sdf@fomichev.me>
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@kernel.org>
> Signed-off-by: Stanislav Fomichev <sdf@fomichev.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?
next prev parent reply other threads:[~2025-02-05 19:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-04 23:00 [RFC net-next 0/4] net: Hold netdev instance lock during ndo operations Stanislav Fomichev
2025-02-04 23:00 ` [RFC net-next 1/4] net: Hold netdev instance lock during ndo_open/ndo_stop Stanislav Fomichev
2025-02-05 19:32 ` Joe Damato [this message]
2025-02-05 21:31 ` Stanislav Fomichev
2025-02-05 22:32 ` Joe Damato
2025-02-04 23:00 ` [RFC net-next 2/4] net: Hold netdev instance lock during ndo_setup_tc Stanislav Fomichev
2025-02-04 23:00 ` [RFC net-next 3/4] net: Hold netdev instance lock for more NDOs Stanislav Fomichev
2025-02-04 23:00 ` [RFC net-next 4/4] net: Hold netdev instance lock during queue operations Stanislav Fomichev
2025-02-14 2:10 ` [RFC net-next 0/4] net: Hold netdev instance lock during ndo operations Saeed Mahameed
2025-02-14 2:55 ` Stanislav Fomichev
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=Z6O8ujq-gYVG4sjw@LQ3V64L9R2 \
--to=jdamato@fastly.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeed@kernel.org \
--cc=sdf@fomichev.me \
/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