Skip to content

Commit 3d189d8

Browse files
authored
Merge pull request #831 from kernelkit/boot-wait-slow-devs
Wait for slow devices before continuing boot
2 parents 131d9e9 + 06721a1 commit 3d189d8

File tree

5 files changed

+64
-18
lines changed

5 files changed

+64
-18
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Use <pid/syslogd> as barrier for other system tasks and service that
2+
# rely on modules, firmware, and device nodes to be ready.
3+
service if:udevd nowarn env:-/etc/default/sysklogd <run/udevadm:post/success> \
4+
[S0123456789] syslogd -F $SYSLOGD_ARGS -- System log daemon
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Extend finit's default udevadm settle synchronization for situations
2+
# where device are very slow to probe (see #685)
3+
run nowarn if:udevd cgroup.init <service/udevd/ready> log \
4+
[S] /usr/libexec/infix/hw-wait -- Probing hardware
5+
6+
# Now that everything should be probed, do a final pass over the
7+
# uevent queue before starting syslogd and everything else
8+
run nowarn if:udevd cgroup.init :post <service/udevd/ready> log \
9+
[S] udevadm settle -t 30 --
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/sh
2+
# (Ab)use the kernel's device link subsystem to detect consumer side
3+
# devices that may be very slow to probe (looking at you, mv88e6xxx!).
4+
5+
ident=$(basename "$0")
6+
7+
report()
8+
{
9+
if [ -r "/tmp/$ident" ]; then
10+
logger -k -p "user.$1" -t "$ident" "Waited for slow devices:"
11+
sort "/tmp/$ident" | uniq -c | logger -k -p "user.$1" -t "$ident"
12+
fi
13+
14+
rm -f "/tmp/$ident"
15+
}
16+
17+
for _ in $(seq 50); do
18+
again=
19+
20+
for dl in /sys/class/devlink/*; do
21+
[ -r "$dl/status" ] || continue
22+
23+
status=$(cat "$dl/status")
24+
if [ "$status" = "consumer probing" ]; then
25+
basename "$(readlink "$dl/consumer")" >>"/tmp/$ident"
26+
again=yes
27+
fi
28+
29+
done
30+
31+
if [ -z "$again" ]; then
32+
report notice
33+
exit 0
34+
fi
35+
36+
sleep .2
37+
done
38+
39+
logger -k -p user.error -t "$ident" "Timeout waiting for devices to come online"
40+
report error
41+
exit 1

board/common/rootfs/usr/libexec/infix/init.d/20-nameif

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,6 @@ for file in /sys/firmware/qemu_fw_cfg/by_name/opt/mactab/raw /etc/mactab; do
1414
fi
1515
done
1616

17-
# Sometimes the sysfs is not populated when the switch driver is loaded, with the result
18-
# that the DSA interface was not found (no /dsa/tagging entry in sysfs. See issue #685.
19-
#
20-
# This mitigates that problem by waiting for sysfs to come up if a DSA switch is found
21-
if [ -n "$(devlink -j dev info | jq -r '.info.[].driver' | grep -q mv88e6085)" ]; then
22-
timeout=50
23-
while [ -z "$(ls /sys/class/net/*/dsa/tagging)" ]; do
24-
timeout=$((timeout-1))
25-
if [ $timeout -eq 0 ]; then
26-
logger -k -p user.emerg -t "$ident" "Failed to find DSA interface"
27-
exit 1
28-
fi
29-
sleep 0.1
30-
done
31-
32-
logger -k -p user.notice -t "$ident" "Found DSA interface in $timeout seconds"
33-
fi
34-
3517
# Find CPU interfaces used for connecting to a switch managed by DSA
3618
for netif in /sys/class/net/*; do
3719
iface=$(basename "$netif")

doc/ChangeLog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ Change Log
44
All notable changes to the project are documented in this file.
55

66

7+
[v24.11.1][UNRELEASED]
8+
-------------------------
9+
10+
### Fixes
11+
12+
- Fix #685: DSA conduit interface not always detected. Previous
13+
attempt at a fix (v24.10.2) mitigated the issue, but did not
14+
completely solve it.
15+
16+
717
[v24.11.0][] - 2024-11-20
818
-------------------------
919

0 commit comments

Comments
 (0)