mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-03 06:13:02 +02:00
Merge pull request #831 from kernelkit/boot-wait-slow-devs
Wait for slow devices before continuing boot
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
# Use <pid/syslogd> as barrier for other system tasks and service that
|
||||
# rely on modules, firmware, and device nodes to be ready.
|
||||
service if:udevd nowarn env:-/etc/default/sysklogd <run/udevadm:post/success> \
|
||||
[S0123456789] syslogd -F $SYSLOGD_ARGS -- System log daemon
|
||||
@@ -0,0 +1,9 @@
|
||||
# Extend finit's default udevadm settle synchronization for situations
|
||||
# where device are very slow to probe (see #685)
|
||||
run nowarn if:udevd cgroup.init <service/udevd/ready> log \
|
||||
[S] /usr/libexec/infix/hw-wait -- Probing hardware
|
||||
|
||||
# Now that everything should be probed, do a final pass over the
|
||||
# uevent queue before starting syslogd and everything else
|
||||
run nowarn if:udevd cgroup.init :post <service/udevd/ready> log \
|
||||
[S] udevadm settle -t 30 --
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# (Ab)use the kernel's device link subsystem to detect consumer side
|
||||
# devices that may be very slow to probe (looking at you, mv88e6xxx!).
|
||||
|
||||
ident=$(basename "$0")
|
||||
|
||||
report()
|
||||
{
|
||||
if [ -r "/tmp/$ident" ]; then
|
||||
logger -k -p "user.$1" -t "$ident" "Waited for slow devices:"
|
||||
sort "/tmp/$ident" | uniq -c | logger -k -p "user.$1" -t "$ident"
|
||||
fi
|
||||
|
||||
rm -f "/tmp/$ident"
|
||||
}
|
||||
|
||||
for _ in $(seq 50); do
|
||||
again=
|
||||
|
||||
for dl in /sys/class/devlink/*; do
|
||||
[ -r "$dl/status" ] || continue
|
||||
|
||||
status=$(cat "$dl/status")
|
||||
if [ "$status" = "consumer probing" ]; then
|
||||
basename "$(readlink "$dl/consumer")" >>"/tmp/$ident"
|
||||
again=yes
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if [ -z "$again" ]; then
|
||||
report notice
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sleep .2
|
||||
done
|
||||
|
||||
logger -k -p user.error -t "$ident" "Timeout waiting for devices to come online"
|
||||
report error
|
||||
exit 1
|
||||
@@ -14,24 +14,6 @@ for file in /sys/firmware/qemu_fw_cfg/by_name/opt/mactab/raw /etc/mactab; do
|
||||
fi
|
||||
done
|
||||
|
||||
# Sometimes the sysfs is not populated when the switch driver is loaded, with the result
|
||||
# that the DSA interface was not found (no /dsa/tagging entry in sysfs. See issue #685.
|
||||
#
|
||||
# This mitigates that problem by waiting for sysfs to come up if a DSA switch is found
|
||||
if [ -n "$(devlink -j dev info | jq -r '.info.[].driver' | grep -q mv88e6085)" ]; then
|
||||
timeout=50
|
||||
while [ -z "$(ls /sys/class/net/*/dsa/tagging)" ]; do
|
||||
timeout=$((timeout-1))
|
||||
if [ $timeout -eq 0 ]; then
|
||||
logger -k -p user.emerg -t "$ident" "Failed to find DSA interface"
|
||||
exit 1
|
||||
fi
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
logger -k -p user.notice -t "$ident" "Found DSA interface in $timeout seconds"
|
||||
fi
|
||||
|
||||
# Find CPU interfaces used for connecting to a switch managed by DSA
|
||||
for netif in /sys/class/net/*; do
|
||||
iface=$(basename "$netif")
|
||||
|
||||
@@ -4,6 +4,16 @@ Change Log
|
||||
All notable changes to the project are documented in this file.
|
||||
|
||||
|
||||
[v24.11.1][UNRELEASED]
|
||||
-------------------------
|
||||
|
||||
### Fixes
|
||||
|
||||
- Fix #685: DSA conduit interface not always detected. Previous
|
||||
attempt at a fix (v24.10.2) mitigated the issue, but did not
|
||||
completely solve it.
|
||||
|
||||
|
||||
[v24.11.0][] - 2024-11-20
|
||||
-------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user