Re: [PATCH net v1] net: defer __dev_set_promiscuity() to avoid sleeping in atomic context
From: Stanislav Fomichev
Date: Fri Feb 20 2026 - 20:15:08 EST
On 02/20, I Viswanath wrote:
> On Fri, 20 Feb 2026 at 01:42, Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
> >
> > Not sure. Another alternative is to implement the long standing idea of
> > having an async / sleeping version of ndo_set_rx_mode() orchestrated
> > by the core. Because a lot of drivers need to sleep, anyway, so they
> > just schedule a work from that callback.
> >
> > Then we can say old ndo_set_rx_mode is under netif_addr_lock.
> > ndo_set_rx_mode_async is under instance lock.
>
> Hello, I have been working on this idea here :/
>
> https://lore.kernel.org/netdev/20260112181626.20117-1-viswanathiyyappan@xxxxxxxxx/
>
> I am calling it ndo_write_rx_mode but if ndo_set_rx_mode_async sounds
> better, I will go with that. As the constructs I would
> be introducing in v9 (enable/disable deferred ctx) should be useful
> for other NDOs that would want to do their work async, I am looking
> for concrete use cases to justify this. Right now, I have
> - ndo_set_rx_mode
> - ndo_change_rx_flags
> - ndo_tx_timeout (Few drivers seem to schedule this and it's under
> tx_global_lock spinlock)
Hmm, interesting, I haven't seen that. So this takes care of
non-sleeping ndo_set_rx_mode. We'd have to move ndo_change_rx_flags to
that new sleeping ndo as well (to resolve the issue that this patch tries
to address>. And then we can try to add instance locks on top of that.
> Do you mean rtnl_lock when you say instance lock?
Search for the instance locks in Documentation/networking/netdevices.rst. We
essentially need to add netdev_ops_assert_locked to __dev_set_rx_mode
and make it work.