Subject: Re: [PATCH net-next v2 06/11] net: protect NAPI enablement with netdev_lock()

From: David Laight <[email-masked]>
Date: Tue, 21 Jan 2025 08:50:45 +0000

On Tue, 21 Jan 2025 11:32:24 +0300
Dan Carpenter <[email-masked]> wrote:

> On Tue, Jan 14, 2025 at 07:53:14PM -0800, Jakub Kicinski wrote:
> > Wrap napi_enable() / napi_disable() with netdev_lock().
> > Provide the "already locked" flavor of the API.
> > 
> > iavf needs the usual adjustment. A number of drivers call
> > napi_enable() under a spin lock, so they have to be modified
> > to take netdev_lock() first, then spin lock then call
> > napi_enable_locked().  
> 
> You missed some.
> 
> drivers/net/ethernet/broadcom/tg3.c:7427 tg3_napi_enable() warn: sleeping in atomic context
> drivers/net/ethernet/nvidia/forcedeth.c:5597 nv_open() warn: sleeping in atomic context
...

Looks like the whole patch is very fragile.
You really need to keep the existing function names having their existing semantics.
Add a new function, change all the code, then delete the old function.

It also looks as though drivers will end up holding netdev_lock() for long
periods just so they can do a napi_enable() much later on.

	David