netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislav Fomichev <stfomichev@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Stanislav Fomichev <sdf@fomichev.me>,
	netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com
Subject: Re: [PATCH net v2 08/11] docs: net: document netdev notifier expectations
Date: Thu, 27 Mar 2025 13:57:01 -0700	[thread overview]
Message-ID: <Z-W7nfFdv8u-SZTY@mini-arch> (raw)
In-Reply-To: <20250327123403.6147088d@kernel.org>

On 03/27, Jakub Kicinski wrote:
> On Thu, 27 Mar 2025 12:16:13 -0700 Jakub Kicinski wrote:
> > > +* ``NETDEV_REGISTER``
> > > +* ``NETDEV_UP``
> > > +* ``NETDEV_UNREGISTER``  
> > 
> > Can I ask the obvious question - anything specific that's hard in also
> > taking it in DOWN or just no time to investigate? Symmetry would be
> > great.

The latter: I added locks for DOWN, hit a dev_close somewhere, and
decided no to go down the rabbit hole.

> Looking at patch 4 maybe we should do the opposite. This was my
> original commit msg for locking UNREGISTER:
> 
>     net: make NETDEV_UNREGISTER and instance lock more consistent
>     
>     The NETDEV_UNREGISTER notifier gets called under the ops lock
>     when device changes namespace but not during real unregistration.
>     Take it consistently, XSK tries to poke at netdev queue state
>     from this notifier.
> 
> So if the only caller currently under the lock is netns change, and 
> we already split that to release the lock - maybe we can make
> UNREGISTER always unlocked instead?

That sounds very sensible, let me try it out and run the tests.
I'll have to drop the lock twice, once for NETDEV_UNREGISTER
and another time for move_netdevice_notifiers_dev_net, but since
the device is unlisted, nothing should touch it (in theory)?

netif_change_net_namespace is already the first thing that happens
in do_setlink, so I won't be converting it to dev_xxx (lmk if I
miss something here).

If it goes well, I'll also hack your xsk patch to grab the ops lock
in xsk_notifier:NETDEV_UNREGISTER, I think that's the only thing
that needs changes. The ugly bonding and teaming unlock/locks
will go away (which is a very nice side effect).

  reply	other threads:[~2025-03-27 20:57 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-27 13:56 [PATCH net v2 00/11] net: hold instance lock during NETDEV_UP/REGISTER/UNREGISTER Stanislav Fomichev
2025-03-27 13:56 ` [PATCH net v2 01/11] net: switch to netif_disable_lro in inetdev_init Stanislav Fomichev
2025-03-27 18:40   ` Jakub Kicinski
2025-03-27 18:59   ` Jakub Kicinski
2025-03-27 21:09     ` Stanislav Fomichev
2025-03-27 21:36       ` Jakub Kicinski
2025-03-28 15:01         ` Stanislav Fomichev
2025-03-27 13:56 ` [PATCH net v2 02/11] net: hold instance lock during NETDEV_REGISTER/UP/UNREGISTER Stanislav Fomichev
2025-03-27 18:58   ` Jakub Kicinski
2025-03-27 13:56 ` [PATCH net v2 03/11] net: use netif_disable_lro in ipv6_add_dev Stanislav Fomichev
2025-03-27 19:02   ` Jakub Kicinski
2025-03-27 21:06     ` Stanislav Fomichev
2025-03-27 21:37       ` Jakub Kicinski
2025-03-28 15:01         ` Stanislav Fomichev
2025-03-27 13:56 ` [PATCH net v2 04/11] net: release instance lock during NETDEV_UNREGISTER for bond/team Stanislav Fomichev
2025-03-27 13:56 ` [PATCH net v2 05/11] net/mlx5e: use netdev_lockdep_set_classes Stanislav Fomichev
2025-03-27 19:08   ` Jakub Kicinski
2025-03-27 21:05     ` Stanislav Fomichev
2025-03-31  8:01       ` Cosmin Ratiu
2025-03-27 13:56 ` [PATCH net v2 06/11] netdevsim: add dummy device notifiers Stanislav Fomichev
2025-03-27 19:12   ` Jakub Kicinski
2025-03-27 21:04     ` Stanislav Fomichev
2025-03-27 21:46       ` Jakub Kicinski
2025-03-28  6:03         ` Kuniyuki Iwashima
2025-03-28 15:07           ` Stanislav Fomichev
2025-03-28 15:04         ` Stanislav Fomichev
2025-03-27 13:56 ` [PATCH net v2 07/11] net: dummy: request ops lock Stanislav Fomichev
2025-03-27 13:56 ` [PATCH net v2 08/11] docs: net: document netdev notifier expectations Stanislav Fomichev
2025-03-27 19:16   ` Jakub Kicinski
2025-03-27 19:34     ` Jakub Kicinski
2025-03-27 20:57       ` Stanislav Fomichev [this message]
2025-03-27 21:50         ` Jakub Kicinski
2025-03-28 15:03           ` Stanislav Fomichev
2025-03-27 13:56 ` [PATCH net v2 09/11] net: designate XSK pool pointers in queues as "ops protected" Stanislav Fomichev
2025-03-27 13:56 ` [PATCH net v2 10/11] netdev: add "ops compat locking" helpers Stanislav Fomichev
2025-03-27 13:56 ` [PATCH net v2 11/11] netdev: don't hold rtnl_lock over nl queue info get when possible Stanislav Fomichev
2025-03-28  8:07 ` [PATCH net v2 00/11] net: hold instance lock during NETDEV_UP/REGISTER/UNREGISTER Taehee Yoo
2025-03-28 15:43   ` 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=Z-W7nfFdv8u-SZTY@mini-arch \
    --to=stfomichev@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).