🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Jakub Kicinski Tue, 27 Oct 2026 23:27
Re: [PATCH wireless v2] wifi: wext: Limit notifier event flushes to the device's netns
#8070
Author: Jakub Kicinski
Date: Tue, 27 Oct 2026 23:27
34 lines
9474 bytes
On Fri, 23 Oct 2026 11:10:44 +0300 Cosmin Ratiu wrote:
> With mlx5 netdev instance locking enabled, registering an IPoIB netdev
> calls the WEXT notifier while holding the instance mutex. Its call to
> wireless_nlevent_flush() takes net_rwsem to walk every namespace,
> completing the following lockdep dependency cycle:
> 
>   netdev instance mutex -> net_rwsem (read) -> GID table mutex
>     -> event_handler_rwsem (read) -> netdev instance mutex  
> 
> RoCE GID enumeration takes the GID table mutex under net_rwsem. GID
> updates dispatch events under the table mutex, taking event_handler_rwsem.
> The IPoIB event handler takes the netdev instance mutex in
> ipoib_queue_work() to traverse child interfaces.
> 
> The all-namespace walk originated in the single global worker servicing
> per-namespace WEXT queues. The ordering fixes later reused that routine
> in netdevice notifiers to prevent delayed WEXT RTM_NEWLINK messages from
> following RTM_DELLINK or reporting stale interface flags. A notifier only
> needs to drain the affected device's namespace; there is no reason for it
> to walk and flush all namespaces.
> 
> Pass dev_net(dev) from both notifier callers and make the flush helper
> operate on that namespace. Keep the all-namespace walk and net_rwsem in
> the existing worker. This removes the instance-mutex -> net_rwsem
> dependency while retaining synchronous flushing from the notifiers.
> 
> It may seem strange that the fix for a lock cycle across multiple
> subsystems lies in a completely unrelated part of the code, but this
> seemed the most justified lock cycle edge to break.

If Johannes thinks this scoping is good for other reasons - SGTM.
But my knee jerk fix would be to skip all the wifi processing
for ops-locked devices since no wifi device is ops locked.
Re: [PATCH wireless v2] wifi: wext: Limit notifier event flushes to the device's netns
#8478
Author: Johannes Berg
Date: Thu, 29 Oct 2026 07:01
56 lines
11115 bytes
On Tue, 2026-10-27 at 16:27 -0700, Jakub Kicinski wrote:
> On Fri, 23 Oct 2026 11:10:44 +0300 Cosmin Ratiu wrote:
> > With mlx5 netdev instance locking enabled, registering an IPoIB netdev
> > calls the WEXT notifier while holding the instance mutex. Its call to
> > wireless_nlevent_flush() takes net_rwsem to walk every namespace,
> > completing the following lockdep dependency cycle:
> > 
> >   netdev instance mutex -> net_rwsem (read) -> GID table mutex
> >     -> event_handler_rwsem (read) -> netdev instance mutex  
> > 
> > RoCE GID enumeration takes the GID table mutex under net_rwsem. GID
> > updates dispatch events under the table mutex, taking event_handler_rwsem.
> > The IPoIB event handler takes the netdev instance mutex in
> > ipoib_queue_work() to traverse child interfaces.
> > 
> > The all-namespace walk originated in the single global worker servicing
> > per-namespace WEXT queues. The ordering fixes later reused that routine
> > in netdevice notifiers to prevent delayed WEXT RTM_NEWLINK messages from
> > following RTM_DELLINK or reporting stale interface flags. A notifier only
> > needs to drain the affected device's namespace; there is no reason for it
> > to walk and flush all namespaces.
> > 
> > Pass dev_net(dev) from both notifier callers and make the flush helper
> > operate on that namespace. Keep the all-namespace walk and net_rwsem in
> > the existing worker. This removes the instance-mutex -> net_rwsem
> > dependency while retaining synchronous flushing from the notifiers.
> > 
> > It may seem strange that the fix for a lock cycle across multiple
> > subsystems lies in a completely unrelated part of the code, but this
> > seemed the most justified lock cycle edge to break.
> 
> If Johannes thinks this scoping is good for other reasons - SGTM.

It seems reasonable, in truth roughly nobody [1] ever really runs WiFi
in network namespaces.

[1] except security LLM-babysitters trying to prove certain bugs are bad

> But my knee jerk fix would be to skip all the wifi processing
> for ops-locked devices since no wifi device is ops locked.

In wext_netdev_notifier_call()? I suppose these days we could also just
skip that for non-wifi devices, somehow.

But it's much easier for me now to just take this patch (in fact I
already did), rather than try to break it in other ways and have Cosmin
go back to test it. Maybe we'll just do both, the latter as an
optimisation, we can likely do better than "ops-locked" as a
discriminant too.

johannes
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads