net: ipconfig: remove wait for drivers
Subsystems (4)
v2 cover net: ipconfig: remove wait for drivers
Currently ip autoconfiguration has a hardcoded delay of 10ms.
Make the delay configurable via the new ip.dev_wait_ms argument, and set the default value to 0ms.
David
PATCH v2 1/2 net: make driver settling time configurable
During IP auto configuration, some drivers apparently need to wait a certain length of time to settle; as this is not true for all drivers, make this length of time configurable.
--- .../admin-guide/kernel-parameters.txt | 4 ++++ Documentation/admin-guide/nfs/nfsroot.rst | 3 +++ net/ipv4/ipconfig.c | 23 ++++++++++++++++--- 3 files changed, 27 insertions(+), 3 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +4 -0
@@ -2291,6 +2291,10 @@ ip= [IP_PNP] See Documentation/admin-guide/nfs/nfsroot.rst. + ip.dev_wait_ms= + [IP_PNP] + See Documentation/admin-guide/nfs/nfsroot.rst. + ipcmni_extend [KNL,EARLY] Extend the maximum number of unique System V IPC identifiers from 32,768 to 16,777,216.
Documentation/admin-guide/nfs/nfsroot.rst +3 -0
@@ -223,6 +223,9 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns /proc/net/ipconfig/ntp_servers to an NTP client before mounting the real root filesystem if it is on NFS). +ip.dev_wait_ms=<value> + Set the number of milliseconds to delay after opening the network device + which will be autoconfigured. Defaults to 10 milliseconds. nfsrootdebug This parameter enables debugging messages to appear in the kernel
net/ipv4/ipconfig.c +20 -3
@@ -82,8 +82,6 @@#define IPCONFIG_DYNAMIC #endif -/* Define the friendly delay before and after opening net devices */ -#define CONF_POST_OPEN 10/* After opening: 10 msecs */ /* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */ #define CONF_OPEN_RETRIES 2/* (Re)open devices twice */
@@ -101,6 +99,7 @@/* Wait for carrier timeout default in seconds */ static unsigned int carrier_timeout =120 ; +static unsigned int dev_wait_ms =10 ;/* * Public IP configuration
@@ -1516,7 +1515,8 @@ static int __init ip_auto_config(void)return err;/* Give drivers a chance to settle */ -msleep (CONF_POST_OPEN ); +if (dev_wait_ms >0 ) +msleep (dev_wait_ms);/* * If the config information is insufficient (e.g., our IP address or
@@ -1849,3 +1849,20 @@ static int __init set_carrier_timeout(char *str)return 1 ; }__setup ("carrier_timeout=" , set_carrier_timeout); + + +static int __init set_dev_wait_ms (char *str) +{ +ssize_t ret; + +if (!str) +return 0 ; + + ret =kstrtouint (str,0 , &dev_wait_ms); +if (ret) +return 0 ; + +return 1 ; +} + +__setup ("ip.dev_wait_ms=" , set_dev_wait_ms);
Signature · 1 line
2.39.2
PATCH v2 2/2 net: Change default delay on IP autoconfig to 0ms
In reply to David VenturaReduce the default settle time from 10ms to 0ms, based on previous discussions (
https://lore.kernel.org/netdev/[email protected]/t/
https://lore.kernel.org/netdev/[email protected]/
) ARP and DHCP retries are expected to handle any lost transmissions.
This patch depends on 1f0aa0c947eeb4edb60add141a5bc2309f2dc8dd ("
net: make driver settling time configurable").
--- Documentation/admin-guide/nfs/nfsroot.rst | 2 +- net/ipv4/ipconfig.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/admin-guide/nfs/nfsroot.rst +1 -1
@@ -225,7 +225,7 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns ip.dev_wait_ms=<value> Set the number of milliseconds to delay after opening the network device - which will be autoconfigured. Defaults to 10 milliseconds. + which will be autoconfigured. Defaults to 0 milliseconds. nfsrootdebug This parameter enables debugging messages to appear in the kernel
net/ipv4/ipconfig.c +1 -1
@@ -99,7 +99,7 @@/* Wait for carrier timeout default in seconds */ static unsigned int carrier_timeout =120 ; -static unsigned int dev_wait_ms =10 ; +static unsigned int dev_wait_ms =0 ;/* * Public IP configuration
Signature · 1 line
2.39.2
Re: [PATCH v2 1/2] net: make driver settling time configurable
In reply to David VenturaQuoted 62 lines · David Ventura
During IP auto configuration, some drivers apparently need to wait a certain length of time to settle; as this is not true for all drivers, make this length of time configurable.
Signed-off-by David Ventura <[email protected]>--- .../admin-guide/kernel-parameters.txt | 4 ++++ Documentation/admin-guide/nfs/nfsroot.rst | 3 +++ net/ipv4/ipconfig.c | 23 ++++++++++++++++--- 3 files changed, 27 insertions(+), 3 deletions(-)Documentation/admin-guide/kernel-parameters.txt +4
-0@@ -2291,6 +2291,10 @@ ip= [IP_PNP] See Documentation/admin-guide/nfs/nfsroot.rst. + ip.dev_wait_ms= + [IP_PNP] + See Documentation/admin-guide/nfs/nfsroot.rst. + ipcmni_extend [KNL,EARLY] Extend the maximum number of unique System V IPC identifiers from 32,768 to 16,777,216.Documentation/admin-guide/nfs/nfsroot.rst +3
-0@@ -223,6 +223,9 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns /proc/net/ipconfig/ntp_servers to an NTP client before mounting the real root filesystem if it is on NFS). +ip.dev_wait_ms=<value> + Set the number of milliseconds to delay after opening the network device + which will be autoconfigured. Defaults to 10 milliseconds. nfsrootdebug This parameter enables debugging messages to appear in the kernelnet/ipv4/ipconfig.c +1
-2@@ -82,8 +82,6 @@#define IPCONFIG_DYNAMIC #endif -/* Define the friendly delay before and after opening net devices */ -#define CONF_POST_OPEN 10/* After opening: 10 msecs */ /* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */ #define CONF_OPEN_RETRIES 2/* (Re)open devices twice */ @@ -101,6 +99,7 @@/* Wait for carrier timeout default in seconds */ static unsigned int carrier_timeout =120 ; +static unsigned int dev_wait_ms =10 ;/* * Public IP configuration
net/ipv4/ipconfig.c static int __init ip_auto_config(void) · line 1519
Quoted 6 lines
net/ipv4/ipconfig.c +2
-1@@ -1516,7 +1515,8 @@ static int __init ip_auto_config(void)return err;/* Give drivers a chance to settle */ -msleep (CONF_POST_OPEN ); +if (dev_wait_ms >0 ) +msleep (dev_wait_ms);
What's the point to wait more than CONF_POST_OPEN with the change?
Quoted 24 lines
net/ipv4/ipconfig.c +17
-0/* * If the config information is insufficient (e.g., our IP address or @@ -1849,3 +1849,20 @@ static int __init set_carrier_timeout(char *str)return 1 ; }__setup ("carrier_timeout=" , set_carrier_timeout); + + +static int __init set_dev_wait_ms (char *str) +{ +ssize_t ret; + +if (!str) +return 0 ; + + ret =kstrtouint (str,0 , &dev_wait_ms); +if (ret) +return 0 ; + +return 1 ; +} + +__setup ("ip.dev_wait_ms=" , set_dev_wait_ms);
Quoted 1 line · David Ventura
Currently ip autoconfiguration has a hardcoded delay of 10ms.
The subject line should be prefixed with net-next
Quoted 9 lines
Make the delay configurable via the new
ip.dev_wait_msargument, and set the default value to 0ms.David
Re: [PATCH v2 1/2] net: make driver settling time configurable
In reply to Denis KirjanovQuoted 66 lines · Denis Kirjanov
Quoted 64 lines · David Ventura
During IP auto configuration, some drivers apparently need to wait a certain length of time to settle; as this is not true for all drivers, make this length of time configurable.
Signed-off-by David Ventura <[email protected]>--- .../admin-guide/kernel-parameters.txt | 4 ++++ Documentation/admin-guide/nfs/nfsroot.rst | 3 +++ net/ipv4/ipconfig.c | 23 ++++++++++++++++--- 3 files changed, 27 insertions(+), 3 deletions(-)Documentation/admin-guide/kernel-parameters.txt +4
-0@@ -2291,6 +2291,10 @@ ip= [IP_PNP] See Documentation/admin-guide/nfs/nfsroot.rst. + ip.dev_wait_ms= + [IP_PNP] + See Documentation/admin-guide/nfs/nfsroot.rst. + ipcmni_extend [KNL,EARLY] Extend the maximum number of unique System V IPC identifiers from 32,768 to 16,777,216.Documentation/admin-guide/nfs/nfsroot.rst +3
-0@@ -223,6 +223,9 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns /proc/net/ipconfig/ntp_servers to an NTP client before mounting the real root filesystem if it is on NFS). +ip.dev_wait_ms=<value> + Set the number of milliseconds to delay after opening the network device + which will be autoconfigured. Defaults to 10 milliseconds. nfsrootdebug This parameter enables debugging messages to appear in the kernelnet/ipv4/ipconfig.c +1
-2@@ -82,8 +82,6 @@#define IPCONFIG_DYNAMIC #endif -/* Define the friendly delay before and after opening net devices */ -#define CONF_POST_OPEN 10/* After opening: 10 msecs */ /* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */ #define CONF_OPEN_RETRIES 2/* (Re)open devices twice */ @@ -101,6 +99,7 @@/* Wait for carrier timeout default in seconds */ static unsigned int carrier_timeout =120 ; +static unsigned int dev_wait_ms =10 ;/* * Public IP configuration @@ -1516,7 +1515,8 @@ static int __init ip_auto_config(void)return err;
Quoted 5 lines
net/ipv4/ipconfig.c static int __init ip_auto_config(void) · line 1519
Quoted 4 lines
net/ipv4/ipconfig.c +2
-1/* Give drivers a chance to settle */ -msleep (CONF_POST_OPEN ); +if (dev_wait_ms >0 ) +msleep (dev_wait_ms);What's the point to wait more than
CONF_POST_OPENwith the change?
I didn't have anything specificin mind - shall I change this
to only enable/disable the 10ms wait instead of allowing a configurable value?
Quoted 24 lines
Quoted 24 lines
net/ipv4/ipconfig.c +17
-0/* * If the config information is insufficient (e.g., our IP address or @@ -1849,3 +1849,20 @@ static int __init set_carrier_timeout(char *str)return 1 ; }__setup ("carrier_timeout=" , set_carrier_timeout); + + +static int __init set_dev_wait_ms (char *str) +{ +ssize_t ret; + +if (!str) +return 0 ; + + ret =kstrtouint (str,0 , &dev_wait_ms); +if (ret) +return 0 ; + +return 1 ; +} + +__setup ("ip.dev_wait_ms=" , set_dev_wait_ms);
Jakub Kicinski
maintainerQuoted 4 lines · On Thu, 8 Feb 2024 10:35:53 +0100 David Ventura wrote:
Currently ip autoconfiguration has a hardcoded delay of 10ms.
Make the delay configurable via the new
ip.dev_wait_msargument, and set the default value to 0ms.
Does not apply, you'll have to respin:
Applying: net: make driver settling time configurable
error: sha1 information is lacking or useless (Documentation/admin-guide/kernel-parameters.txt).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 net: make driver settling time configurable
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Jakub Kicinski
maintainerRe: [PATCH v2 1/2] net: make driver settling time configurable
In reply to David VenturaQuoted 3 lines · On Thu, 8 Feb 2024 10:52:29 +0100 David Ventura wrote:
During IP auto configuration, some drivers apparently need to wait a certain length of time to settle; as this is not true for all drivers, make this length of time configurable.
Please CC folks who gave you feedback, Andrew's is missing.
Andrew, what do you think about just removing the wait? Or decreasing it to 1ms?
It feels a little wasteful to be adding uAPI for something which as you said is likely papering over ancient bugs. We'll fix the bugs which are still around and the uAPI will stay forever :(
Re: [PATCH v2 1/2] net: make driver settling time configurable
Quoted 5 lines · Jakub Kicinski
Quoted 3 lines · On Thu, 8 Feb 2024 10:52:29 +0100 David Ventura wrote:
During IP auto configuration, some drivers apparently need to wait a certain length of time to settle; as this is not true for all drivers, make this length of time configurable.
Quoted 8 lines
Please CC folks who gave you feedback, Andrew's is missing.
Andrew, what do you think about just removing the wait? Or decreasing it to 1ms?
It feels a little wasteful to be adding uAPI for something which as you said is likely papering over ancient bugs. We'll fix the bugs which are still around and the uAPI will stay forever :(
My guess is, the broken drivers are doing setup stuff after they call netdev_register().
Reducing it to 1ms will probably continue to hide such bugs. So we could just go with that, and probably not see any regressions. Or we can decide we really do want to know about broken drivers, and just remove the delay.
Either way, we don't need a new uAPI.
David, is 1ms too long for you? If we do take the delay out, you are going to receive some of the flack from regression reports.
Andrew
Re: [PATCH v2 1/2] net: make driver settling time configurable
Quoted 6 lines · Andrew Lunn
Quoted 5 lines · Jakub Kicinski
Quoted 3 lines · On Thu, 8 Feb 2024 10:52:29 +0100 David Ventura wrote:
During IP auto configuration, some drivers apparently need to wait a certain length of time to settle; as this is not true for all drivers, make this length of time configurable.
Please CC folks who gave you feedback, Andrew's is missing.
Thanks for the feedback, still learning this workflow
Quoted 10 lines
Quoted 7 lines
Andrew, what do you think about just removing the wait? Or decreasing it to 1ms?
It feels a little wasteful to be adding uAPI for something which as you said is likely papering over ancient bugs. We'll fix the bugs which are still around and the uAPI will stay forever :(My guess is, the broken drivers are doing setup stuff after they call
netdev_register().
Quoted 6 lines
Reducing it to 1ms will probably continue to hide such bugs. So we could just go with that, and probably not see any regressions. Or we can decide we really do want to know about broken drivers, and just remove the delay.
Either way, we don't need a new uAPI.
Would it make sense to move this to a build-time configuration flag?
I do not have a gut-feeling for which behaviors should be configurable
at build vs run time.
Quoted 2 lines
David, is 1ms too long for you? If we do take the delay out, you are going to receive some of the flack from regression reports.
I've used this patch to experiment with different values, and the sleep time
behaves as described in Documentation/timers/timers-howto.rst, that is, a
call of msleep(1) usually delays boot time by 12~13 ms in my tests.
On top of this, I'm running this specific example on a no-smp systemm, where I
do not believe the msleep achieves anything (but I'm a kernel newbie so please
correct me if I'm wrong).
Quoted 3 lines
Andrew
Re: [PATCH v2 1/2] net: make driver settling time configurable
Quoted 5 lines
Would it make sense to move this to a build-time configuration flag?
I do not have a gut-feeling for which behaviors should be configurable
at build vs run time.
If it is build time, it becomes the distribution problem to pick a value.
Might be best to just bite the bullet, set it to 0, and fixup whatever breaks.
Andrew