Subject: Re: [PATCH net-next 3/6] net: ethtool: perform pm duties outside of rtnl lock

From: Jakub Kicinski <[email-masked]>
Date: Thu, 20 Jun 2024 17:22:35 -0700

On Thu, 20 Jun 2024 11:47:08 +0000 Eric Dumazet wrote:
> Move pm_runtime_get_sync() and pm_runtime_put() out of __dev_ethtool
> to dev_ethtool() while RTNL is not yet held.
> 
> These helpers do not depend on RTNL.

The helpers themselves don't, but can we assume no drivers have
implicit dependencies on calling netif_device_detach() under rtnl_lock,
and since the presence checks are under rtnl_lock they are currently
guaranteed not to get any callbacks past detach() + rtnl_unlock()?

I think its better to completely skip PM + presence + ->begin if driver
wants the op to be unlocked, but otherwise keep the locking as is

I also keep wondering whether we shouldn't use this as an opportunity
to introduce a "netdev instance lock". I think you mentioned we should
move away from rtnl for locking ethtool and ndos since most drivers
don't care at all about global state. Doing that is a huge project, 
but maybe this is where we start?