[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z-W7nfFdv8u-SZTY@mini-arch>
Date: Thu, 27 Mar 2025 13:57:01 -0700
From: Stanislav Fomichev <stfomichev@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Stanislav Fomichev <sdf@...ichev.me>, netdev@...r.kernel.org,
davem@...emloft.net, edumazet@...gle.com, pabeni@...hat.com
Subject: Re: [PATCH net v2 08/11] docs: net: document netdev notifier
expectations
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).
Powered by blists - more mailing lists