Subject: Re: [PATCH net v3] net: ethtool: do runtime PM outside RTNL

From: Jakub Kicinski <[email-masked]>
Date: Fri, 5 Jan 2024 19:02:18 -0800

On Fri, 5 Jan 2024 17:29:16 +0100 Stanislaw Gruszka wrote:
> > Removing the rpm calls from the core is just going to lead to a
> > whack-a-mole of bugs in the drivers themselves.
> >
> > IOW I look at the RPM calls in the core as a canary for people
> > doing the wrong thing :(  
> 
> Hmm, this one I don't understand, what other bugs could pop up
> after reverting bd869245a3dcc and others that added rpm calls
> for the net core?

IDK what igc powers down, but if there's any ndo or ethtool
callback which needs to access a register that requires power 
to be resumed - it will deadlock on rtnl exactly the same.

Looking at igc_ethtool I see:

static int igc_ethtool_begin(struct net_device *netdev)
{
	struct igc_adapter *adapter = netdev_priv(netdev);

	pm_runtime_get_sync(&adapter->pdev->dev);
	return 0;
}

static void igc_ethtool_complete(struct net_device *netdev)
{
	struct igc_adapter *adapter = netdev_priv(netdev);

	pm_runtime_put(&adapter->pdev->dev);
}

so unless we think that returning -ENODEV from all ethtool calls
when cable is not plugged in is okay - removing the PM resume
from the core doesn't buy us much :(