mbox series

[net-next,0/4] ethtool: runtime-resume netdev parent before ethtool ops

Message ID 106547ef-7a61-2064-33f5-3cc8d12adb34@gmail.com (mailing list archive)
Headers show
Series ethtool: runtime-resume netdev parent before ethtool ops | expand

Message

Heiner Kallweit Aug. 1, 2021, 10:35 a.m. UTC
If a network device is runtime-suspended then:
- network device may be flagged as detached and all ethtool ops (even if
  not accessing the device) will fail because netif_device_present()
  returns false
- ethtool ops may fail because device is not accessible (e.g. because being
  in D3 in case of a PCI device)

It may not be desirable that userspace can't use even simple ethtool ops
that not access the device if interface or link is down. To be more friendly
to userspace let's ensure that device is runtime-resumed when executing
ethtool ops in kernel.

This patch series covers the typical case that the netdev parent is power-
managed, e.g. a PCI device. Not sure whether cases exist where the netdev
itself is power-managed. If yes then we may need an extension for this.
But the series as-is at least shouldn't cause problems in that case.

Heiner Kallweit (4):
  ethtool: runtime-resume netdev parent before ethtool ioctl ops
  ethtool: move implementation of ethnl_ops_begin/complete to netlink.c
  ethtool: move netif_device_present check from
    ethnl_parse_header_dev_get to ethnl_ops_begin
  ethtool: runtime-resume netdev parent in ethnl_ops_begin

 net/ethtool/ioctl.c   | 18 ++++++++++++++---
 net/ethtool/netlink.c | 45 +++++++++++++++++++++++++++++++++++++------
 net/ethtool/netlink.h | 15 ++-------------
 3 files changed, 56 insertions(+), 22 deletions(-)

Comments

Heiner Kallweit Aug. 1, 2021, 4:25 p.m. UTC | #1
On 01.08.2021 12:35, Heiner Kallweit wrote:
> If a network device is runtime-suspended then:
> - network device may be flagged as detached and all ethtool ops (even if
>   not accessing the device) will fail because netif_device_present()
>   returns false
> - ethtool ops may fail because device is not accessible (e.g. because being
>   in D3 in case of a PCI device)
> 
> It may not be desirable that userspace can't use even simple ethtool ops
> that not access the device if interface or link is down. To be more friendly
> to userspace let's ensure that device is runtime-resumed when executing
> ethtool ops in kernel.
> 
> This patch series covers the typical case that the netdev parent is power-
> managed, e.g. a PCI device. Not sure whether cases exist where the netdev
> itself is power-managed. If yes then we may need an extension for this.
> But the series as-is at least shouldn't cause problems in that case.
> 
> Heiner Kallweit (4):
>   ethtool: runtime-resume netdev parent before ethtool ioctl ops
>   ethtool: move implementation of ethnl_ops_begin/complete to netlink.c
>   ethtool: move netif_device_present check from
>     ethnl_parse_header_dev_get to ethnl_ops_begin
>   ethtool: runtime-resume netdev parent in ethnl_ops_begin
> 
>  net/ethtool/ioctl.c   | 18 ++++++++++++++---
>  net/ethtool/netlink.c | 45 +++++++++++++++++++++++++++++++++++++------
>  net/ethtool/netlink.h | 15 ++-------------
>  3 files changed, 56 insertions(+), 22 deletions(-)
> 

Patchwork is showing the following warning for all patches in the series.

netdev/cc_maintainers	warning	7 maintainers not CCed: ecree@solarflare.com andrew@lunn.ch magnus.karlsson@intel.com danieller@nvidia.com arnd@arndb.de irusskikh@marvell.com alexanderduyck@fb.com

This seems to be a false positive, e.g. address ecree@solarflare.com
doesn't exist at all in MAINTAINERS file.
Jakub Kicinski Aug. 2, 2021, 2:15 p.m. UTC | #2
On Sun, 1 Aug 2021 18:25:52 +0200 Heiner Kallweit wrote:
> Patchwork is showing the following warning for all patches in the series.
> 
> netdev/cc_maintainers	warning	7 maintainers not CCed: ecree@solarflare.com andrew@lunn.ch magnus.karlsson@intel.com danieller@nvidia.com arnd@arndb.de irusskikh@marvell.com alexanderduyck@fb.com
> 
> This seems to be a false positive, e.g. address ecree@solarflare.com
> doesn't exist at all in MAINTAINERS file.

It gets the list from the get_maintainers script. It's one of the less
reliable tests, but I feel like efforts should be made primarily
towards improving get_maintainers rather than improving the test itself.
Heiner Kallweit Aug. 2, 2021, 4:42 p.m. UTC | #3
On 02.08.2021 16:15, Jakub Kicinski wrote:
> On Sun, 1 Aug 2021 18:25:52 +0200 Heiner Kallweit wrote:
>> Patchwork is showing the following warning for all patches in the series.
>>
>> netdev/cc_maintainers	warning	7 maintainers not CCed: ecree@solarflare.com andrew@lunn.ch magnus.karlsson@intel.com danieller@nvidia.com arnd@arndb.de irusskikh@marvell.com alexanderduyck@fb.com
>>
>> This seems to be a false positive, e.g. address ecree@solarflare.com
>> doesn't exist at all in MAINTAINERS file.
> 
> It gets the list from the get_maintainers script. It's one of the less
> reliable tests, but I feel like efforts should be made primarily
> towards improving get_maintainers rather than improving the test itself.
> 
When running get_maintainers.pl for any of the patches in the series
I don't get these addresses. I run get_maintainers w/o options, maybe
you set some special option? That's what I get when running get_maintainers:

"David S. Miller" <davem@davemloft.net> (maintainer:NETWORKING [GENERAL])
Jakub Kicinski <kuba@kernel.org> (maintainer:NETWORKING [GENERAL])
Stephen Rothwell <sfr@canb.auug.org.au> (commit_signer:1/2=50%,authored:1/2=50%,added_lines:3144/3159=100%)
Heiner Kallweit <hkallweit1@gmail.com> (commit_signer:1/2=50%,authored:1/2=50%,removed_lines:3/3=100%)
netdev@vger.kernel.org (open list:NETWORKING [GENERAL])
linux-kernel@vger.kernel.org (open list)
Jakub Kicinski Aug. 2, 2021, 4:54 p.m. UTC | #4
On Mon, 2 Aug 2021 18:42:28 +0200 Heiner Kallweit wrote:
> On 02.08.2021 16:15, Jakub Kicinski wrote:
> > On Sun, 1 Aug 2021 18:25:52 +0200 Heiner Kallweit wrote:  
> >> Patchwork is showing the following warning for all patches in the series.
> >>
> >> netdev/cc_maintainers	warning	7 maintainers not CCed: ecree@solarflare.com andrew@lunn.ch magnus.karlsson@intel.com danieller@nvidia.com arnd@arndb.de irusskikh@marvell.com alexanderduyck@fb.com
> >>
> >> This seems to be a false positive, e.g. address ecree@solarflare.com
> >> doesn't exist at all in MAINTAINERS file.  
> > 
> > It gets the list from the get_maintainers script. It's one of the less
> > reliable tests, but I feel like efforts should be made primarily
> > towards improving get_maintainers rather than improving the test itself.
> >   
> When running get_maintainers.pl for any of the patches in the series
> I don't get these addresses. I run get_maintainers w/o options, maybe
> you set some special option? That's what I get when running get_maintainers:
> 
> "David S. Miller" <davem@davemloft.net> (maintainer:NETWORKING [GENERAL])
> Jakub Kicinski <kuba@kernel.org> (maintainer:NETWORKING [GENERAL])
> Stephen Rothwell <sfr@canb.auug.org.au> (commit_signer:1/2=50%,authored:1/2=50%,added_lines:3144/3159=100%)
> Heiner Kallweit <hkallweit1@gmail.com> (commit_signer:1/2=50%,authored:1/2=50%,removed_lines:3/3=100%)
> netdev@vger.kernel.org (open list:NETWORKING [GENERAL])
> linux-kernel@vger.kernel.org (open list)

Mm. Maybe your system doesn't have some perl module? Not sure what it
may be. With tip of net-next/master:

$ ./scripts/get_maintainer.pl /tmp/te/0002-ethtool-move-implementation-of-ethnl_ops_begin-compl.patch
"David S. Miller" <davem@davemloft.net> (maintainer:NETWORKING [GENERAL],commit_signer:12/16=75%,commit_signer:15/18=83%)
Jakub Kicinski <kuba@kernel.org> (maintainer:NETWORKING [GENERAL],commit_signer:11/16=69%,authored:9/16=56%,added_lines:127/198=64%,removed_lines:41/57=72%,commit_signer:14/18=78%,authored:11/18=61%,added_lines:74/84=88%,removed_lines:35/52=67%)
Heiner Kallweit <hkallweit1@gmail.com> (commit_signer:3/16=19%,authored:3/16=19%,added_lines:46/198=23%,removed_lines:13/57=23%,authored:1/18=6%,removed_lines:13/52=25%)
Fernando Fernandez Mancera <ffmancera@riseup.net> (commit_signer:1/16=6%,authored:1/16=6%)
Vladyslav Tarasiuk <vladyslavt@nvidia.com> (commit_signer:1/16=6%,added_lines:11/198=6%,commit_signer:1/18=6%)
Yangbo Lu <yangbo.lu@nxp.com> (authored:1/16=6%,added_lines:10/198=5%,authored:1/18=6%)
Johannes Berg <johannes.berg@intel.com> (authored:1/16=6%)
Zheng Yongjun <zhengyongjun3@huawei.com> (commit_signer:1/18=6%)
Andrew Lunn <andrew@lunn.ch> (commit_signer:1/18=6%)
Danielle Ratson <danieller@nvidia.com> (authored:1/18=6%)
Ido Schimmel <idosch@nvidia.com> (authored:1/18=6%)
netdev@vger.kernel.org (open list:NETWORKING [GENERAL])
linux-kernel@vger.kernel.org (open list)
Heiner Kallweit Aug. 2, 2021, 7 p.m. UTC | #5
On 02.08.2021 18:54, Jakub Kicinski wrote:
> On Mon, 2 Aug 2021 18:42:28 +0200 Heiner Kallweit wrote:
>> On 02.08.2021 16:15, Jakub Kicinski wrote:
>>> On Sun, 1 Aug 2021 18:25:52 +0200 Heiner Kallweit wrote:  
>>>> Patchwork is showing the following warning for all patches in the series.
>>>>
>>>> netdev/cc_maintainers	warning	7 maintainers not CCed: ecree@solarflare.com andrew@lunn.ch magnus.karlsson@intel.com danieller@nvidia.com arnd@arndb.de irusskikh@marvell.com alexanderduyck@fb.com
>>>>
>>>> This seems to be a false positive, e.g. address ecree@solarflare.com
>>>> doesn't exist at all in MAINTAINERS file.  
>>>
>>> It gets the list from the get_maintainers script. It's one of the less
>>> reliable tests, but I feel like efforts should be made primarily
>>> towards improving get_maintainers rather than improving the test itself.
>>>   
>> When running get_maintainers.pl for any of the patches in the series
>> I don't get these addresses. I run get_maintainers w/o options, maybe
>> you set some special option? That's what I get when running get_maintainers:
>>
>> "David S. Miller" <davem@davemloft.net> (maintainer:NETWORKING [GENERAL])
>> Jakub Kicinski <kuba@kernel.org> (maintainer:NETWORKING [GENERAL])
>> Stephen Rothwell <sfr@canb.auug.org.au> (commit_signer:1/2=50%,authored:1/2=50%,added_lines:3144/3159=100%)
>> Heiner Kallweit <hkallweit1@gmail.com> (commit_signer:1/2=50%,authored:1/2=50%,removed_lines:3/3=100%)
>> netdev@vger.kernel.org (open list:NETWORKING [GENERAL])
>> linux-kernel@vger.kernel.org (open list)
> 
> Mm. Maybe your system doesn't have some perl module? Not sure what it
> may be. With tip of net-next/master:
> 
> $ ./scripts/get_maintainer.pl /tmp/te/0002-ethtool-move-implementation-of-ethnl_ops_begin-compl.patch
> "David S. Miller" <davem@davemloft.net> (maintainer:NETWORKING [GENERAL],commit_signer:12/16=75%,commit_signer:15/18=83%)
> Jakub Kicinski <kuba@kernel.org> (maintainer:NETWORKING [GENERAL],commit_signer:11/16=69%,authored:9/16=56%,added_lines:127/198=64%,removed_lines:41/57=72%,commit_signer:14/18=78%,authored:11/18=61%,added_lines:74/84=88%,removed_lines:35/52=67%)
> Heiner Kallweit <hkallweit1@gmail.com> (commit_signer:3/16=19%,authored:3/16=19%,added_lines:46/198=23%,removed_lines:13/57=23%,authored:1/18=6%,removed_lines:13/52=25%)
> Fernando Fernandez Mancera <ffmancera@riseup.net> (commit_signer:1/16=6%,authored:1/16=6%)
> Vladyslav Tarasiuk <vladyslavt@nvidia.com> (commit_signer:1/16=6%,added_lines:11/198=6%,commit_signer:1/18=6%)
> Yangbo Lu <yangbo.lu@nxp.com> (authored:1/16=6%,added_lines:10/198=5%,authored:1/18=6%)
> Johannes Berg <johannes.berg@intel.com> (authored:1/16=6%)
> Zheng Yongjun <zhengyongjun3@huawei.com> (commit_signer:1/18=6%)
> Andrew Lunn <andrew@lunn.ch> (commit_signer:1/18=6%)
> Danielle Ratson <danieller@nvidia.com> (authored:1/18=6%)
> Ido Schimmel <idosch@nvidia.com> (authored:1/18=6%)
> netdev@vger.kernel.org (open list:NETWORKING [GENERAL])
> linux-kernel@vger.kernel.org (open list)
> 

Ah, maybe it's because I typically don't work with the full git repo
but just do a "git clone --depth 1".
patchwork-bot+netdevbpf@kernel.org Aug. 3, 2021, noon UTC | #6
Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Sun, 1 Aug 2021 12:35:18 +0200 you wrote:
> If a network device is runtime-suspended then:
> - network device may be flagged as detached and all ethtool ops (even if
>   not accessing the device) will fail because netif_device_present()
>   returns false
> - ethtool ops may fail because device is not accessible (e.g. because being
>   in D3 in case of a PCI device)
> 
> [...]

Here is the summary with links:
  - [net-next,1/4] ethtool: runtime-resume netdev parent before ethtool ioctl ops
    https://git.kernel.org/netdev/net-next/c/f32a21376573
  - [net-next,2/4] ethtool: move implementation of ethnl_ops_begin/complete to netlink.c
    https://git.kernel.org/netdev/net-next/c/c5ab51df03e2
  - [net-next,3/4] ethtool: move netif_device_present check from ethnl_parse_header_dev_get to ethnl_ops_begin
    https://git.kernel.org/netdev/net-next/c/41107ac22fcf
  - [net-next,4/4] ethtool: runtime-resume netdev parent in ethnl_ops_begin
    https://git.kernel.org/netdev/net-next/c/d43c65b05b84

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html