All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch RFC 0/6] network fixes for link waiting
@ 2012-11-08  3:40 dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2012-11-08  3:40 ` [patch RFC 1/6] Move wait for if functions to net lib dyoung-H+wXaHxf7aLQT0dZR+AlfA
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2012-11-08  3:40 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA

Here is a patch set for some network cleanup and fixes:
01-network-move-wait-for-if-function-to-net-lib.patch
02-network-add-function-linkup.patch
03-network-use-linkup-function.patch
04-network-wait-for-link-ready-before-use.patch
05-network-get-ifaces-for-udev-rule-use.patch
06-network-wait-interface-up-at-early-stage.patch

Tested kdump with a nic which delay abouth 60s while initializing.

Please help to review especially for the patch 3/6 which replace some ip link
up with a function linkup.

--
Thanks a lot
Dave

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [patch RFC 1/6] Move wait for if functions to net lib
  2012-11-08  3:40 [patch RFC 0/6] network fixes for link waiting dyoung-H+wXaHxf7aLQT0dZR+AlfA
@ 2012-11-08  3:40 ` dyoung-H+wXaHxf7aLQT0dZR+AlfA
       [not found]   ` <20121108034317.171739916-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2012-11-08  3:40 ` [patch RFC 2/6] Add function linkup dyoung-H+wXaHxf7aLQT0dZR+AlfA
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2012-11-08  3:40 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA
  Cc: Dave Young

[-- Attachment #1: network-move-wait-for-if-function-to-net-lib.patch --]
[-- Type: text/plain, Size: 2585 bytes --]

net-lib.sh are created for net related functions, move the wait_for_if* to
net-lib.sh naturally.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/40network/dhclient-script.sh |    1 +
 modules.d/40network/net-lib.sh         |   23 +++++++++++++++++++++++
 modules.d/95fcoe/fcoe-up.sh            |    1 +
 modules.d/99base/dracut-lib.sh         |   23 -----------------------
 4 files changed, 25 insertions(+), 23 deletions(-)

--- dracut.orig/modules.d/99base/dracut-lib.sh
+++ dracut/modules.d/99base/dracut-lib.sh
@@ -481,29 +481,6 @@ else
     }
 fi
 
-wait_for_if_up() {
-    local cnt=0
-    local li
-    while [ $cnt -lt 200 ]; do
-        li=$(ip -o link show up dev $1)
-        [ -n "$li" ] && return 0
-        sleep 0.1
-        cnt=$(($cnt+1))
-    done
-    return 1
-}
-
-wait_for_route_ok() {
-    local cnt=0
-    while [ $cnt -lt 200 ]; do
-        li=$(ip route show)
-        [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
-        sleep 0.1
-        cnt=$(($cnt+1))
-    done
-    return 1
-}
-
 # root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>]
 # root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>]
 nfsroot_to_var() {
--- dracut.orig/modules.d/40network/net-lib.sh
+++ dracut/modules.d/40network/net-lib.sh
@@ -315,3 +315,26 @@ parse_ifname_opts() {
     esac
 
 }
+
+wait_for_if_up() {
+    local cnt=0
+    local li
+    while [ $cnt -lt 200 ]; do
+        li=$(ip -o link show up dev $1)
+        [ -n "$li" ] && return 0
+        sleep 0.1
+        cnt=$(($cnt+1))
+    done
+    return 1
+}
+
+wait_for_route_ok() {
+    local cnt=0
+    while [ $cnt -lt 200 ]; do
+        li=$(ip route show)
+        [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
+        sleep 0.1
+        cnt=$(($cnt+1))
+    done
+    return 1
+}
--- dracut.orig/modules.d/40network/dhclient-script.sh
+++ dracut/modules.d/40network/dhclient-script.sh
@@ -51,6 +51,7 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
 export PS4="dhclient.$interface.$$ + "
 exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
 
 # We already need a set netif here
 netif=$interface
--- dracut.orig/modules.d/95fcoe/fcoe-up.sh
+++ dracut/modules.d/95fcoe/fcoe-up.sh
@@ -16,6 +16,7 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
 export PS4="fcoe-up.$1.$$ + "
 exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
 
 netif=$1
 dcb=$2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [patch RFC 2/6] Add function linkup
  2012-11-08  3:40 [patch RFC 0/6] network fixes for link waiting dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2012-11-08  3:40 ` [patch RFC 1/6] Move wait for if functions to net lib dyoung-H+wXaHxf7aLQT0dZR+AlfA
@ 2012-11-08  3:40 ` dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2012-11-08  3:40 ` [patch RFC 3/6] Change to use linkup function in network scripts dyoung-H+wXaHxf7aLQT0dZR+AlfA
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2012-11-08  3:40 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA
  Cc: Dave Young

[-- Attachment #1: network-add-function-linkup.patch --]
[-- Type: text/plain, Size: 578 bytes --]

set link up usually include two steps, ip link set <dev> up and
wait_for_if_up <dev>. Now do these two steps in one function linkup.
Later patch will add other code into it.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/40network/net-lib.sh |    5 +++++
 1 file changed, 5 insertions(+)

--- dracut.orig/modules.d/40network/net-lib.sh
+++ dracut/modules.d/40network/net-lib.sh
@@ -338,3 +338,8 @@ wait_for_route_ok() {
     done
     return 1
 }
+
+linkup() {
+    ip link set $1 up 2>/dev/null && wait_for_if_up $1 2>/dev/null
+}
+

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [patch RFC 3/6] Change to use linkup function in network scripts
  2012-11-08  3:40 [patch RFC 0/6] network fixes for link waiting dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2012-11-08  3:40 ` [patch RFC 1/6] Move wait for if functions to net lib dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2012-11-08  3:40 ` [patch RFC 2/6] Add function linkup dyoung-H+wXaHxf7aLQT0dZR+AlfA
@ 2012-11-08  3:40 ` dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2012-11-08  3:40 ` [patch RFC 4/6] Wait for link ready before use the interface dyoung-H+wXaHxf7aLQT0dZR+AlfA
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2012-11-08  3:40 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA
  Cc: Dave Young

[-- Attachment #1: network-use-linkup-function.patch --]
[-- Type: text/plain, Size: 2613 bytes --]

Update ifup.sh and fcoe-up.sh, use linkup function instead of directly
call ip command.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/40network/ifup.sh |   17 ++++++-----------
 modules.d/95fcoe/fcoe-up.sh |    3 +--
 2 files changed, 7 insertions(+), 13 deletions(-)

--- dracut.orig/modules.d/40network/ifup.sh
+++ dracut/modules.d/40network/ifup.sh
@@ -84,8 +84,7 @@ do_ipv6auto() {
     echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
     echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
     echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
-    ip link set $netif up
-    wait_for_if_up $netif
+    linkup $netif
 
     [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
 
@@ -96,8 +95,7 @@ do_ipv6auto() {
 do_static() {
     strstr $ip '*:*:*' && load_ipv6
 
-    ip link set $netif up
-    wait_for_if_up $netif
+    linkup $netif
     [ -n "$macaddr" ] && ip link set address $macaddr
     [ -n "$mtu" ] && ip link set mtu $mtu
     if strstr $ip '*:*:*'; then
@@ -147,13 +145,12 @@ if [ -e /tmp/bond.info ]; then
             fi
         done
 
-        ip link set $netif up
+        linkup $netif
 
         for slave in $bondslaves ; do
             ip link set $slave down
             echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
-            ip link set $slave up
-            wait_for_if_up $slave
+            linkup $slave
         done
 
         # add the bits to setup the needed post enslavement parameters
@@ -180,9 +177,8 @@ if [ -e /tmp/bridge.info ]; then
             if [ "$ethname" = "$bondname" ] ; then
                 DO_BOND_SETUP=yes ifup $bondname -m
             else
-                ip link set $ethname up
+                linkup $ethname
             fi
-            wait_for_if_up $ethname
             brctl addif $bridgename $ethname
         done
     fi
@@ -204,9 +200,8 @@ if [ "$netif" = "$vlanname" ] && [ ! -e 
     if [ "$phydevice" = "$bondname" ] ; then
         DO_BOND_SETUP=yes ifup $phydevice -m
     else
-        ip link set "$phydevice" up
+        linkup "$phydevice"
     fi
-    wait_for_if_up "$phydevice"
     ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname; echo $?)"
 fi
 
--- dracut.orig/modules.d/95fcoe/fcoe-up.sh
+++ dracut/modules.d/95fcoe/fcoe-up.sh
@@ -21,8 +21,7 @@ type ip_to_var >/dev/null 2>&1 || . /lib
 netif=$1
 dcb=$2
 
-ip link set "$netif" up
-wait_for_if_up "$netif"
+linkup "$netif"
 
 netdriver=$(readlink -f /sys/class/net/$netif/device/driver)
 netdriver=${netdriver##*/}

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [patch RFC 4/6] Wait for link ready before use the interface
  2012-11-08  3:40 [patch RFC 0/6] network fixes for link waiting dyoung-H+wXaHxf7aLQT0dZR+AlfA
                   ` (2 preceding siblings ...)
  2012-11-08  3:40 ` [patch RFC 3/6] Change to use linkup function in network scripts dyoung-H+wXaHxf7aLQT0dZR+AlfA
@ 2012-11-08  3:40 ` dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2012-11-08  3:40 ` [patch RFC 5/6] Get ifaces for udev rule use dyoung-H+wXaHxf7aLQT0dZR+AlfA
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2012-11-08  3:40 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA
  Cc: Dave Young

[-- Attachment #1: network-wait-for-link-ready-before-use.patch --]
[-- Type: text/plain, Size: 1258 bytes --]

Some network driver will take long time to initialize. We have an example
in a HP machine which take about one minute for this. The callback such as
"ip link set <dev> up" will fail, afterwards setup for network will also
fail.

Fix this by add a new function wait_for_if_link, wait the link ready before
use it.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/40network/net-lib.sh |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

--- dracut.orig/modules.d/40network/net-lib.sh
+++ dracut/modules.d/40network/net-lib.sh
@@ -316,6 +316,19 @@ parse_ifname_opts() {
 
 }
 
+# some network driver need long time to initialize, wait before it's ready.
+wait_for_if_link() {
+    local cnt=0
+    local li
+    while [ $cnt -lt 600 ]; do
+        li=$(ip -o link show dev $1 2>/dev/null)
+        [ -n "$li" ] && return 0
+        sleep 0.1
+        cnt=$(($cnt+1))
+    done
+    return 1
+}
+
 wait_for_if_up() {
     local cnt=0
     local li
@@ -340,6 +353,8 @@ wait_for_route_ok() {
 }
 
 linkup() {
-    ip link set $1 up 2>/dev/null && wait_for_if_up $1 2>/dev/null
+    wait_for_if_link $1 2>/dev/null\
+     && ip link set $1 up 2>/dev/null\
+     && wait_for_if_up $1 2>/dev/null
 }
 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [patch RFC 5/6] Get ifaces for udev rule use
  2012-11-08  3:40 [patch RFC 0/6] network fixes for link waiting dyoung-H+wXaHxf7aLQT0dZR+AlfA
                   ` (3 preceding siblings ...)
  2012-11-08  3:40 ` [patch RFC 4/6] Wait for link ready before use the interface dyoung-H+wXaHxf7aLQT0dZR+AlfA
@ 2012-11-08  3:40 ` dyoung-H+wXaHxf7aLQT0dZR+AlfA
       [not found]   ` <20121108034317.735680044-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2012-11-08  3:40 ` [patch RFC 6/6] Wait for interface up at the early stage dyoung-H+wXaHxf7aLQT0dZR+AlfA
       [not found] ` <20121108034018.789330224-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  6 siblings, 1 reply; 13+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2012-11-08  3:40 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA
  Cc: Dave Young

[-- Attachment #1: network-get-ifaces-for-udev-rule-use.patch --]
[-- Type: text/plain, Size: 653 bytes --]

In case without BOOTIF, but /tmp/ifaces are already created.
net-genrule.sh will fall to bring up all net interfaces.

Fix by reading from /tmp/ifaces before generating rules instead.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/40network/net-genrules.sh |    2 ++
 1 file changed, 2 insertions(+)

--- dracut.orig/modules.d/40network/net-genrules.sh
+++ dracut/modules.d/40network/net-genrules.sh
@@ -19,6 +19,8 @@ if [ -z "$netroot" ] && [ ! -e "/tmp/net
     return
 fi
 
+[ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces
+
 # Write udev rules
 {
     # bridge: attempt only the defined interface

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [patch RFC 6/6] Wait for interface up at the early stage
  2012-11-08  3:40 [patch RFC 0/6] network fixes for link waiting dyoung-H+wXaHxf7aLQT0dZR+AlfA
                   ` (4 preceding siblings ...)
  2012-11-08  3:40 ` [patch RFC 5/6] Get ifaces for udev rule use dyoung-H+wXaHxf7aLQT0dZR+AlfA
@ 2012-11-08  3:40 ` dyoung-H+wXaHxf7aLQT0dZR+AlfA
       [not found]   ` <20121108034317.844374819-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
       [not found] ` <20121108034018.789330224-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  6 siblings, 1 reply; 13+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2012-11-08  3:40 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA
  Cc: Dave Young

[-- Attachment #1: network-wait-interface-up-at-early-stage.patch --]
[-- Type: text/plain, Size: 1921 bytes --]

In case long delay of network driver initqueue will exit before net dev is
ready. We have no chance to setup it then.
For dhcp, when we finish the setup there will be a setup_net_<dev>.ok. Doing
same for static ip case. Also add a check to initqueue when we generate udev
rules to ensure it's early enough.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/40network/ifup.sh         |    1 +
 modules.d/40network/net-genrules.sh |    3 +++
 2 files changed, 4 insertions(+)

--- dracut.orig/modules.d/40network/net-genrules.sh
+++ dracut/modules.d/40network/net-genrules.sh
@@ -49,14 +49,17 @@ fi
     if [ -n "$BOOTIF" ] ; then
         BOOTIF=$(fix_bootif "$BOOTIF")
         printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="%s"\n' "$BOOTIF" "/sbin/initqueue --onetime $ifup"
+        echo "[ -f /tmp/setup_net_${BOOTIF}.ok ]" >$hookdir/initqueue/finished/wait-${BOOTIF}.sh
 
     # If we have to handle multiple interfaces, handle only them.
     elif [ -n "$IFACES" ] ; then
         for iface in $IFACES ; do
             printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="%s"\n' "$iface" "/sbin/initqueue --onetime $ifup"
+            echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
         done
 
     # Default: We don't know the interface to use, handle all
+    # Fixme: waiting for the interface as well.
     else
         printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/91-default-net.rules
     fi
--- dracut.orig/modules.d/40network/ifup.sh
+++ dracut/modules.d/40network/ifup.sh
@@ -109,6 +109,7 @@ do_static() {
     [ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
     [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
 
+    > /tmp/setup_net_${netif}.ok
     return 0
 }
 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch RFC 1/6] Move wait for if functions to net lib
       [not found]   ` <20121108034317.171739916-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-11-08  9:50     ` Dave Young
  0 siblings, 0 replies; 13+ messages in thread
From: Dave Young @ 2012-11-08  9:50 UTC (permalink / raw)
  To: dyoung-H+wXaHxf7aLQT0dZR+AlfA
  Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA

There's some problem with my mta and smtp server.
Looks like 0/6 and 5/6 are lost.

Will resend this series.

-- 
Thanks
Dave

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch RFC 0/6] network fixes for link waiting
       [not found] ` <20121108034018.789330224-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-11-14  8:49   ` Dave Young
       [not found]     ` <50A35B2E.9050206-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Dave Young @ 2012-11-14  8:49 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA

Even with this series we still need add rd.retry=90 to make it work.
How about increase the default rd.retry value in dracut?

On 11/08/2012 11:40 AM, dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:

> Here is a patch set for some network cleanup and fixes:
> 01-network-move-wait-for-if-function-to-net-lib.patch
> 02-network-add-function-linkup.patch
> 03-network-use-linkup-function.patch
> 04-network-wait-for-link-ready-before-use.patch
> 05-network-get-ifaces-for-udev-rule-use.patch
> 06-network-wait-interface-up-at-early-stage.patch
> 
> Tested kdump with a nic which delay abouth 60s while initializing.
> 
> Please help to review especially for the patch 3/6 which replace some ip link
> up with a function linkup.
> 
> --
> Thanks a lot
> Dave
> --
> To unsubscribe from this list: send the line "unsubscribe initramfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks
Dave

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch RFC 0/6] network fixes for link waiting
       [not found]     ` <50A35B2E.9050206-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-11-14 10:56       ` Harald Hoyer
       [not found]         ` <50A378F0.4030907-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Harald Hoyer @ 2012-11-14 10:56 UTC (permalink / raw)
  To: Dave Young; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

Am 14.11.2012 09:49, schrieb Dave Young:
> Even with this series we still need add rd.retry=90 to make it work.
> How about increase the default rd.retry value in dracut?
> 
> On 11/08/2012 11:40 AM, dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:
> 
>> Here is a patch set for some network cleanup and fixes:
>> 01-network-move-wait-for-if-function-to-net-lib.patch
>> 02-network-add-function-linkup.patch
>> 03-network-use-linkup-function.patch
>> 04-network-wait-for-link-ready-before-use.patch
>> 05-network-get-ifaces-for-udev-rule-use.patch
>> 06-network-wait-interface-up-at-early-stage.patch
>>
>> Tested kdump with a nic which delay abouth 60s while initializing.
>>
>> Please help to review especially for the patch 3/6 which replace some ip link
>> up with a function linkup.
>>
>> --
>> Thanks a lot
>> Dave
>> --
>> To unsubscribe from this list: send the line "unsubscribe initramfs" in
>> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 

wow, which HW is recognized only after 40 seconds?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch RFC 0/6] network fixes for link waiting
       [not found]         ` <50A378F0.4030907-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-11-15  1:52           ` Dave Young
  0 siblings, 0 replies; 13+ messages in thread
From: Dave Young @ 2012-11-15  1:52 UTC (permalink / raw)
  To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On 11/14/2012 06:56 PM, Harald Hoyer wrote:

> Am 14.11.2012 09:49, schrieb Dave Young:
>> Even with this series we still need add rd.retry=90 to make it work.
>> How about increase the default rd.retry value in dracut?
>>
>> On 11/08/2012 11:40 AM, dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:
>>
>>> Here is a patch set for some network cleanup and fixes:
>>> 01-network-move-wait-for-if-function-to-net-lib.patch
>>> 02-network-add-function-linkup.patch
>>> 03-network-use-linkup-function.patch
>>> 04-network-wait-for-link-ready-before-use.patch
>>> 05-network-get-ifaces-for-udev-rule-use.patch
>>> 06-network-wait-interface-up-at-early-stage.patch
>>>
>>> Tested kdump with a nic which delay abouth 60s while initializing.
>>>
>>> Please help to review especially for the patch 3/6 which replace some ip link
>>> up with a function linkup.
>>>
>>> --
>>> Thanks a lot
>>> Dave
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe initramfs" in
>>> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>
>>
> 
> wow, which HW is recognized only after 40 seconds?


Hi, It's a Qlogic nic, seel below log, looks like it detected a wrong
firmware, then released it and loaded firmware from flash:

Ethernet using netxen_nic driver for exp., suppressed irrelevant info.
[    6.666842] QLogic/NetXen Network Driver v4.0.80
[    6.727424] netxen_nic 0000:04:00.0: 2MB memory map
[   38.484866] netxen_nic 0000:04:00.0: Incompatibility detected between
driver and firmware version on flash. This configuration is not
recommended. Please update the firmware on flash immediately
dracut-pre-pivot[581]: device node not found
dracut-pre-pivot[581]: cat: /sys/class/net/em1/address: No such file or
directory
dracut-pre-pivot[581]: cat: /sys/class/net/em1/address: No such file or
directory
dracut-pre-pivot[581]: ++ KDUMP_PATH=/var/crash
dracut-pre-pivot[581]: ++ CORE_COLLECTOR=
dracut-pre-pivot[581]: ++ DEFAULT_CORE_COLLECTOR='makedumpfile -c
--message-level 1 -d 31'
dracut-pre-pivot[581]: ++ DEFAULT_ACTION=dump_rootfs
dracut-pre-pivot[581]: +++ date +%d.%m.%y-%T
dracut-pre-pivot[581]: ++ DATEDIR=05.11.12-00:32:36
dracut-pre-pivot[581]: ++ DUMP_INSTRUCTION=
dracut-pre-pivot[581]: ++ SSH_KEY_LOCATION=/root/.ssh/kdump_id_rsa
dracut-pre-pivot[581]: ++ KDUMP_SCRIPT_DIR=/kdumpscripts
dracut-pre-pivot[581]: ++ DD_BLKSIZE=512
dracut-pre-pivot[581]: ++ FINAL_ACTION='reboot -f'
dracut-pre-pivot[581]: ++ DUMP_RETVAL=0
dracut-pre-pivot[581]: ++ conf_file=/etc/kdump.conf
dracut-pre-pivot[581]: ++ KDUMP_PRE=


Entering emergency mode. Exit the shell to continue.
Type "journalctl" to view system logs.

kdump:/# dracut-pre-pivot[581]: ++ KDUMP_POST=
dracut-pre-pivot[581]: ++ export
PATH=/usr/sbin:/usr/bin:/sbin:/bin:/kdumpscripts
dracut-pre-pivot[581]: ++ PATH=/usr/sbin:/usr/bin:/sbin:/bin:/kdumpscripts
dracut-pre-pivot[581]: ++ read_kdump_conf
dracut-pre-pivot[581]: ++ '[' '!' -f /etc/kdump.conf ']'
dracut-pre-pivot[581]: ++ read config_opt config_val
dracut-pre-pivot[581]: ++ case "$config_opt" in
dracut-pre-pivot[581]: ++ read config_opt config_val
dracut-pre-pivot[581]: ++ case "$config_opt" in
dracut-pre-pivot[581]: ++ KDUMP_PATH=/
dracut-pre-pivot[581]: ++ read config_opt config_val
dracut-pre-pivot[581]: ++ case "$config_opt" in
dracut-pre-pivot[581]: ++ read config_opt config_val
dracut-pre-pivot[581]: ++ case "$config_opt" in
dracut-pre-pivot[581]: ++ case $config_val in
dracut-pre-pivot[581]: ++ DEFAULT_ACTION='_emergency_shell kdump'
dracut-pre-pivot[581]: ++ read config_opt config_val
dracut-pre-pivot[581]: ++ read config_opt config_val
dracut-pre-pivot[581]: ++ case "$config_opt" in
dracut-pre-pivot[581]: ++ read config_opt config_val
dracut-pre-pivot[581]: ++ case "$config_opt" in
dracut-pre-pivot[581]: ++ read config_opt config_val
dracut-pre-pivot[581]: ++ case "$config_opt" in
dracut-pre-pivot[581]: ++ add_dump_code 'dump_fs
ibm-x3250m4-01.rhts.eng.nay.redhat.com:/mnt/testarea/nfs'
dracut-pre-pivot[581]: ++ DUMP_INSTRUCTION='dump_fs
ibm-x3250m4-01.rhts.eng.nay.redhat.com:/mnt/testarea/nfs'
dracut-pre-pivot[581]: ++ read config_opt config_val
dracut-pre-pivot[581]: ++ case "$config_opt" in
dracut-pre-pivot[581]: ++ read config_opt config_val
dracut-pre-pivot[581]: ++ '[' -z '' ']'
dracut-pre-pivot[581]: ++ CORE_COLLECTOR='makedumpfile -c
--message-level 1 -d 31'
dracut-pre-pivot[581]: ++ is_ssh_dump_target
dracut-pre-pivot[581]: ++ grep -q '^ssh.*@' /etc/kdump.conf
dracut-pre-pivot[581]: ++ is_raw_dump_target
dracut-pre-pivot[581]: ++ grep -q '^raw' /etc/kdump.conf
dracut-pre-pivot[581]: ++ '[' -z 'dump_fs
ibm-x3250m4-01.rhts.eng.nay.redhat.com:/mnt/testarea/nfs' ']'
dracut-pre-pivot[581]: ++ do_kdump_pre
dracut-pre-pivot[581]: ++ '[' -n '' ']'
dracut-pre-pivot[581]: ++ '[' 0 -ne 0 ']'
dracut-pre-pivot[581]: ++ dump_fs
ibm-x3250m4-01.rhts.eng.nay.redhat.com:/mnt/testarea/nfs
dracut-pre-pivot[581]: +++ findmnt -k -f -n -r -o TARGET
ibm-x3250m4-01.rhts.eng.nay.redhat.com:/mnt/testarea/nfs
dracut-pre-pivot[581]: ++ local _mp=
dracut-pre-pivot[581]: ++ '[' -z '' ']'
dracut-pre-pivot[581]: ++ echo 'kdump: error: Dump target
ibm-x3250m4-01.rhts.eng.nay.redhat.com:/mnt/testarea/nfs is not mounted.'
dracut-pre-pivot[581]: ++ return 1
dracut-pre-pivot[581]: ++ DUMP_RETVAL=1
dracut-pre-pivot[581]: ++ do_kdump_post 1
dracut-pre-pivot[581]: ++ '[' -n '' ']'
dracut-pre-pivot[581]: ++ '[' 0 -ne 0 ']'
dracut-pre-pivot[581]: ++ '[' 1 -ne 0 ']'
dracut-pre-pivot[581]: ++ do_default_action
dracut-pre-pivot[581]: ++ wait_for_loginit
dracut-pre-pivot[581]: ++ '[' no = yes ']'
dracut-pre-pivot[581]: ++ return
dracut-pre-pivot[581]: ++ _emergency_shell kdump
dracut-pre-pivot[581]: ++ local _name=kdump
dracut-pre-pivot[581]: ++ '[' -n 1 ']'
dracut-pre-pivot[581]: ++ echo 'PS1="kdump:${PWD}# "'
dracut-pre-pivot[581]: ++ systemctl start dracut-emergency.service
[  101.732446] netxen_nic 0000:04:00.0: loading firmware from flash
[  103.873799] netxen_nic 0000:04:00.0: Gen2 strapping detected
[  106.880731] netxen_nic 0000:04:00.0: using 64-bit dma mask
[  106.888721] netxen_nic: failed card response code:0x10
[  106.894405] netxen_nic 0000:04:00.0: Can't get template size 16843009
[  106.901481] netxen_nic 0000:04:00.0: Failed to setup minidump rcode = -5
[  106.908839] netxen_nic: NX3031 Gigabit Ethernet Board S/N
���������������������������������▒��  Chip rev 0x42
[  106.919726] netxen_nic 0000:04:00.0: firmware v4.0.527 [legacy]
[  106.926689] netxen_nic 0000:04:00.0: using msi-x interrupts
[  106.933163] netxen_nic 0000:04:00.0: eth0: GbE port initialized
[  106.939902] netxen_nic 0000:04:00.1: 2MB memory map
[  106.949661] netxen_nic 0000:04:00.1: using 64-bit dma mask
[  106.965572] systemd-udevd[629]: renamed network interface eth0 to em1
[  106.982471] netxen_nic: failed card response code:0x10
[  106.988124] netxen_nic 0000:04:00.1: Can't get template size 16843009
[  106.995196] netxen_nic 0000:04:00.1: Failed to setup minidump rcode = -5
[  107.002555] netxen_nic 0000:04:00.1: firmware v4.0.527 [legacy]
[  107.009440] netxen_nic 0000:04:00.1: using msi-x interrupts
[  107.015687] netxen_nic 0000:04:00.1: eth0: GbE port initialized
[  107.022569] netxen_nic 0000:04:00.2: 2MB memory map
[  107.030819] netxen_nic 0000:04:00.2: using 64-bit dma mask
[  107.062359] systemd-udevd[633]: renamed network interface eth0 to em2
[  107.075314] netxen_nic: failed card response code:0x10
[  107.081043] netxen_nic 0000:04:00.2: Can't get template size 16843009
[  107.088117] netxen_nic 0000:04:00.2: Failed to setup minidump rcode = -5
[  107.095476] netxen_nic 0000:04:00.2: firmware v4.0.527 [legacy]
[  107.102316] netxen_nic 0000:04:00.2: using msi-x interrupts
[  107.108574] netxen_nic 0000:04:00.2: eth0: GbE port initialized
[  107.115596] netxen_nic 0000:04:00.3: 2MB memory map
[  107.124339] netxen_nic 0000:04:00.3: using 64-bit dma mask
[  107.157705] systemd-udevd[629]: renamed network interface eth0 to em3
[  107.184131] netxen_nic: failed card response code:0x10
[  107.189786] netxen_nic 0000:04:00.3: Can't get template size 16843009
[  107.196853] netxen_nic 0000:04:00.3: Failed to setup minidump rcode = -5
[  107.204205] netxen_nic 0000:04:00.3: firmware v4.0.527 [legacy]
[  107.211062] netxen_nic 0000:04:00.3: using msi-x interrupts
[  107.217311] netxen_nic 0000:04:00.3: eth0: GbE port initialized
[  107.244557] systemd-udevd[629]: renamed network interface eth0 to em4


-- 
Thanks
Dave

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch RFC 5/6] Get ifaces for udev rule use
       [not found]   ` <20121108034317.735680044-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-11-29  8:07     ` Dave Young
  0 siblings, 0 replies; 13+ messages in thread
From: Dave Young @ 2012-11-29  8:07 UTC (permalink / raw)
  To: dyoung-H+wXaHxf7aLQT0dZR+AlfA
  Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA

On 11/08/2012 11:40 AM, dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:

> In case without BOOTIF, but /tmp/ifaces are already created.
> net-genrule.sh will fall to bring up all net interfaces.
> 
> Fix by reading from /tmp/ifaces before generating rules instead.

>

> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  modules.d/40network/net-genrules.sh |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- dracut.orig/modules.d/40network/net-genrules.sh
> +++ dracut/modules.d/40network/net-genrules.sh
> @@ -19,6 +19,8 @@ if [ -z "$netroot" ] && [ ! -e "/tmp/net
>      return
>  fi
>  
> +[ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces



later code will update and overwrite IFACES
So use net.ifaces as default  above line should be moved after
the bond.info test code chunk.

> +
>  # Write udev rules
>  {
>      # bridge: attempt only the defined interface
> 



-- 
Thanks
Dave

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch RFC 6/6] Wait for interface up at the early stage
       [not found]   ` <20121108034317.844374819-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-11-29  8:09     ` Dave Young
  0 siblings, 0 replies; 13+ messages in thread
From: Dave Young @ 2012-11-29  8:09 UTC (permalink / raw)
  To: dyoung-H+wXaHxf7aLQT0dZR+AlfA
  Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA

On 11/08/2012 11:40 AM, dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:

> In case long delay of network driver initqueue will exit before net dev is
> ready. We have no chance to setup it then.
> For dhcp, when we finish the setup there will be a setup_net_<dev>.ok. Doing
> same for static ip case. Also add a check to initqueue when we generate udev
> rules to ensure it's early enough.
> 
> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  modules.d/40network/ifup.sh         |    1 +
>  modules.d/40network/net-genrules.sh |    3 +++
>  2 files changed, 4 insertions(+)
> 
> --- dracut.orig/modules.d/40network/net-genrules.sh
> +++ dracut/modules.d/40network/net-genrules.sh
> @@ -49,14 +49,17 @@ fi
>      if [ -n "$BOOTIF" ] ; then
>          BOOTIF=$(fix_bootif "$BOOTIF")
>          printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="%s"\n' "$BOOTIF" "/sbin/initqueue --onetime $ifup"
> +        echo "[ -f /tmp/setup_net_${BOOTIF}.ok ]" >$hookdir/initqueue/finished/wait-${BOOTIF}.sh
>  
>      # If we have to handle multiple interfaces, handle only them.
>      elif [ -n "$IFACES" ] ; then
>          for iface in $IFACES ; do
>              printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="%s"\n' "$iface" "/sbin/initqueue --onetime $ifup"
> +            echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh


Above waiting is only necessary for bootdev. For example of bonding
device, it should not wait for the slaves.

Will update 5/6 and 6/6 and resend this series.

>          done
>  
>      # Default: We don't know the interface to use, handle all
> +    # Fixme: waiting for the interface as well.
>      else
>          printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/91-default-net.rules
>      fi
> --- dracut.orig/modules.d/40network/ifup.sh
> +++ dracut/modules.d/40network/ifup.sh
> @@ -109,6 +109,7 @@ do_static() {
>      [ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
>      [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
>  
> +    > /tmp/setup_net_${netif}.ok
>      return 0
>  }
>  
> 



-- 
Thanks
Dave

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-11-29  8:09 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-08  3:40 [patch RFC 0/6] network fixes for link waiting dyoung-H+wXaHxf7aLQT0dZR+AlfA
2012-11-08  3:40 ` [patch RFC 1/6] Move wait for if functions to net lib dyoung-H+wXaHxf7aLQT0dZR+AlfA
     [not found]   ` <20121108034317.171739916-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-11-08  9:50     ` Dave Young
2012-11-08  3:40 ` [patch RFC 2/6] Add function linkup dyoung-H+wXaHxf7aLQT0dZR+AlfA
2012-11-08  3:40 ` [patch RFC 3/6] Change to use linkup function in network scripts dyoung-H+wXaHxf7aLQT0dZR+AlfA
2012-11-08  3:40 ` [patch RFC 4/6] Wait for link ready before use the interface dyoung-H+wXaHxf7aLQT0dZR+AlfA
2012-11-08  3:40 ` [patch RFC 5/6] Get ifaces for udev rule use dyoung-H+wXaHxf7aLQT0dZR+AlfA
     [not found]   ` <20121108034317.735680044-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-11-29  8:07     ` Dave Young
2012-11-08  3:40 ` [patch RFC 6/6] Wait for interface up at the early stage dyoung-H+wXaHxf7aLQT0dZR+AlfA
     [not found]   ` <20121108034317.844374819-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-11-29  8:09     ` Dave Young
     [not found] ` <20121108034018.789330224-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-11-14  8:49   ` [patch RFC 0/6] network fixes for link waiting Dave Young
     [not found]     ` <50A35B2E.9050206-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-11-14 10:56       ` Harald Hoyer
     [not found]         ` <50A378F0.4030907-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-11-15  1:52           ` Dave Young

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.