Compare commits

..
Author SHA1 Message Date
BFE EngineeringandClaude Haiku 5.5 ccf9359e31 Revert CPLL 900 MHz pin: render check missed [skip ci]
Decision pass 3 (2026-11-06) says that any miss in the .52 30-minute UI
check reverts the CPLL change to 1000 MHz and returns the item to the
orchestrator. The check ran on 2026-11-11 with flare-edge 201f74f9c
(candidate, pins feb66fd) against 4923dc4cc (baseline, pre-change pin).
The two flare-edge commits differ only in the vendor/warden-sdk pin.
Recomputed from the four 30-minute CSVs (two runs per image):

- render_ms mean: 12.33 and 12.48 ms (candidate) against 12.70 and
  12.79 ms (baseline): better.
- render_max top-10 mean: 56.44 and 56.32 ms against 50.11 and 55.20 ms:
  worse in both runs.
- frames above 50 ms: 7 and 8 against 4 and 6: worse.
- worst frame: 69.47 and 78.00 ms against 59.85 and 76.32 ms: worse.
- dmesg: 34 lines before and 34 after each run, so no new DDR, AXI,
  VOP or RGA lines.

The tail metrics miss the decision's "no worse" rule. This commit
restores the upstream cru assigned-clocks in
patches/20-arch-dts-bindings.patch (PLL_CPLL 1000 MHz, no 50, 100 or
30 MHz pins) and removes the static clock-plan check added by feb66fd.
The bench helpers from 97903d5 stay. Panels .52 to .56 already run the
pre-change clock (dclk_vop 31250000 Hz, read 2026-11-13), so no bench
revert is needed.

Re-apply feb66fd to test the 900 MHz plan again if the orchestrator
accepts the tail tradeoff.

Refs bfe-core1106-sdk#43
Refs flare-edge#3204 (GIC 121 leg still open)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qGNpGNtFT7nhShpH56
2026-11-13 20:09:56 -06:00
BFE EngineeringandClaude Haiku 5.5 97903d55f4 VOP pixel clock: bench helpers for the 30 MHz proof [skip ci]
Panel-side helpers for the bfe-core1106-sdk#43 bench proof on panels
.52 to .56 (2026-11-11): the clock and eth0 check (vopcheck.sh), the
30-minute UI stats workload (uirun.sh), the GIC 121 frame-start count
(gic121.sh) and the run summary (summarize.py). The helpers read
clk_summary and the DRM mode; they add no build or kernel change.

Refs bfe-core1106-sdk#43. Image built from flare-edge 201f74f9c, which
pins this branch at feb66fd.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPu4qHGnopkHjchmwz
2026-11-11 11:52:46 -06:00
BFE EngineeringandClaude Haiku 5.5 feb66fd863 Linux VOP pixel clock: CPLL 900 MHz pins the 30 MHz mode [skip ci]
dclk_vop_src is a composite with a 5-bit divider, so from the 1000 MHz
Linux CPLL the nearest reachable rate to 30 MHz is 31.25 MHz. The panel
then refreshed at 50.9 Hz, not the 48.87 Hz of the mode. U-Boot retunes
CPLL to 960 MHz, which gives an exact 30 MHz but breaks the 50 MHz GMAC
RMII reference (no exact divider at 960).

At CPLL 900 MHz, /30 gives exactly 30 MHz, /18 exactly 50 MHz (GMAC)
and /9 exactly 100 MHz (APB, PWM, watchdog). The cru node sets PLL_CPLL
to 900 MHz and pins CLK_50M_SRC, CLK_100M_SRC and DCLK_VOP_SRC right
after it. aclk_ddr_root falls from 500 to 450 MHz and clk_250m_src from
250 to 225 MHz; no driver change.

tests/vop-dclk/check-vop-dclk.py reads the clock plan from the patch
series (list order, PLL table, IDs, exact dividers, hunk line counts);
run-check-vop-dclk-tests.sh breaks one thing per case.

Fixes #43
Refs flare-edge#3204

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPu4qHGnopkHjchmwz
2026-11-10 00:36:43 -06:00
20 changed files with 157 additions and 802 deletions
+1 -3
View File
@@ -237,9 +237,7 @@ jobs:
- name: QEMU busybox fetch regression tests
# Retry on a bad sha256, the cached copy, and a server that answers
# and then stalls (#1588), against local listeners: no network.
run: |
bash qemu/tests/busybox-fetch.sh
bash qemu/tests/busybox-source-mirror.sh
run: bash qemu/tests/busybox-fetch.sh
- name: unpack-buildroot regression tests
# Fresh unpack, leave-existing-tree-alone, and every refusal path
# (unpatched selectors, bad tarball, half-present tree, failed
+7 -27
View File
@@ -34,10 +34,6 @@
# `make modules` (the zImage target alone generates no
# Module.symvers, so per-dir M= builds cannot link) and
# collects the listed dirs' modules into $WORK/modules-out.
# Every collected module must carry this kernel's vermagic
# (include/config/kernel.release), or the build fails. The
# test-only drivers/warden-test directory (bench fault F5) also
# enables CONFIG_WARDEN_TEST_HANG; no other caller lists it.
#
# Requires: `python` (not python3) on PATH: the SDK quirk; the CI runner provides
# a project-local venv. Builds are SERIAL on the shared SDK box: never run two.
@@ -47,8 +43,6 @@ KVER=6.18.46
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # build/
# shellcheck source=build/lib-required-symbols.sh
. "$HERE/lib-required-symbols.sh"
# shellcheck source=build/lib-module-gate.sh
. "$HERE/lib-module-gate.sh"
REQ_SYMBOLS="$HERE/required-symbols.txt"
PROBE_SYMBOLS="$HERE/probe-symbols.txt"
REPO="$(cd "$HERE/.." && pwd)"
@@ -139,16 +133,6 @@ if [ -n "${WARDEN_KCONFIG_FRAGMENT:-}" ]; then
log "merging kconfig fragment $(basename "$FRAG")"
( cd "$SRC" && ARCH=arm ./scripts/kconfig/merge_config.sh -m .config "$FRAG" )
fi
# Test-only modules. A directory listed in WARDEN_MODULES_COLLECT whose Kconfig
# symbol defaults to n is enabled here, before olddefconfig, so the configuration
# (and KCONFIG_SHA256) follows the request. A release or debug build never lists
# one, so its configuration does not change through this block.
for d in ${WARDEN_MODULES_COLLECT:-}; do
sym="$(test_symbol_of "$d")"
if [ -n "$sym" ]; then
( cd "$SRC" && ./scripts/config --file .config --module "$sym" )
fi
done
# CROSS_COMPILE defaults to the Luckfox SDK uclibc prefix (set SDK_TC to its bin/),
# but the kernel is freestanding, so a caller may override with a generic arm cross
# toolchain instead: e.g. CROSS_COMPILE=arm-linux-gnueabihf- (in Debian's
@@ -159,11 +143,6 @@ if [ -n "${SDK_TC:-}" ]; then export PATH="$SDK_TC:$PATH"; fi
command -v "${CROSS_COMPILE}gcc" >/dev/null \
|| { echo "cross toolchain ${CROSS_COMPILE}gcc not on PATH (set SDK_TC, or CROSS_COMPILE to one that is)" >&2; exit 1; }
make -C "$SRC" ARCH=arm CROSS_COMPILE="$CROSS_COMPILE" olddefconfig >/dev/null
# A requested test module whose symbol did not survive olddefconfig (an unmet
# dependency drops it without a word) fails here, not as a missing .ko later.
for d in ${WARDEN_MODULES_COLLECT:-}; do
require_test_config "$SRC/.config" "$d" || exit 1
done
# Took-effect assertion for every symbol the platform needs. olddefconfig drops
# a defconfig line whose dependencies are unmet, or whose symbol does not exist,
@@ -244,13 +223,14 @@ if [ -n "${WARDEN_MODULES_COLLECT:-}" ]; then
rm -rf "$MODOUT"; mkdir -p "$MODOUT"
log "building modules (full set: needed for Module.symvers)"
make -C "$SRC" ARCH=arm CROSS_COMPILE="$CROSS_COMPILE" CC="$KCC" -j"$JOBS" modules
# The kernel's own release string; every collected module must carry it
# (lib-module-gate.sh refuses a module that does not, before it is copied).
KREL="$(tr -d '[:space:]' < "$SRC/include/config/kernel.release")"
[ -n "$KREL" ] || { echo "FATAL: include/config/kernel.release is empty" >&2; exit 1; }
for d in $WARDEN_MODULES_COLLECT; do
collect_modules "$SRC" "$d" "$KREL" "$MODOUT" || exit 1
log "collected $COLLECTED module(s) from $d (vermagic $KREL)"
[ -d "$SRC/$d" ] || { echo "FATAL: WARDEN_MODULES_COLLECT dir '$d' not in tree" >&2; exit 1; }
n=0
while IFS= read -r ko; do
cp "$ko" "$MODOUT/"; n=$((n + 1))
done < <(find "$SRC/$d" -name '*.ko')
[ "$n" -gt 0 ] || { echo "FATAL: no .ko produced under '$d'" >&2; exit 1; }
log "collected $n module(s) from $d"
done
ls -la "$MODOUT"
fi
-71
View File
@@ -1,71 +0,0 @@
# shellcheck shell=bash
# Gate for the kernel modules a build collects (WARDEN_MODULES_COLLECT in
# build-kernel.sh). Sourced, not run: reading it changes nothing.
#
# Every collected module must carry this kernel's vermagic, so a module built
# against another tree, or a hand-copied .ko, cannot reach an image. A
# directory that needs a test-only Kconfig symbol must find it =m after
# olddefconfig. tests/test-hang/run-module-gate-tests.sh runs these functions
# against fixtures, including the refusal paths.
# The test-only Kconfig symbol a collected directory needs (empty for the rest).
# Release and debug builds list no test directory, so they get no symbol.
test_symbol_of() {
case "$1" in
drivers/warden-test) echo WARDEN_TEST_HANG ;;
*) : ;;
esac
}
# module_vermagic_check <kernel release> <module file>: 0 when the module's
# vermagic is "<release> " (the release, then a space), else 1 with a FATAL line.
module_vermagic_check() {
local krel=$1 ko=$2 vm
if [ -z "$krel" ]; then
echo "FATAL: kernel release is empty" >&2
return 1
fi
# vermagic is a NUL-separated .modinfo string; one printable run per line.
vm="$(tr -c '[:print:]' '\n' < "$ko" | grep -m1 '^vermagic=' || true)"
case "$vm" in
"vermagic=$krel "*) return 0 ;;
'') echo "FATAL: $(basename "$ko") has no vermagic" >&2 ;;
*) echo "FATAL: $(basename "$ko") vermagic '${vm#vermagic=}' is not this kernel's '$krel'" >&2 ;;
esac
return 1
}
# collect_modules <source tree> <dir> <kernel release> <out dir>: copies every
# .ko under <source tree>/<dir> into <out dir>, each only after it passed
# module_vermagic_check. Sets COLLECTED to the count. Returns 1 at the first
# module that fails, when the directory is missing, or when it yields none.
collect_modules() {
local src=$1 d=$2 krel=$3 out=$4 ko
COLLECTED=0
if [ ! -d "$src/$d" ]; then
echo "FATAL: WARDEN_MODULES_COLLECT dir '$d' not in tree" >&2
return 1
fi
while IFS= read -r ko; do
module_vermagic_check "$krel" "$ko" || return 1
cp "$ko" "$out/" || return 1
COLLECTED=$((COLLECTED + 1))
done < <(find "$src/$d" -name '*.ko')
if [ "$COLLECTED" -eq 0 ]; then
echo "FATAL: no .ko produced under '$d'" >&2
return 1
fi
}
# require_test_config <kernel .config> <dir>: a directory with a test symbol
# must find it =m in the configuration after olddefconfig (an unmet dependency
# drops the symbol without a word). Returns 1 with a FATAL line otherwise.
require_test_config() {
local cfg=$1 d=$2 sym
sym="$(test_symbol_of "$d")"
[ -n "$sym" ] || return 0
if ! grep -qx "CONFIG_${sym}=m" "$cfg" 2>/dev/null; then
echo "FATAL: $d needs CONFIG_${sym}=m, which did not survive olddefconfig" >&2
return 1
fi
}
+4 -5
View File
@@ -109,8 +109,7 @@ applying the patches, then stages `buildroot/files/` and applies
a copy of the base tree and runs the android-tools rule of the Makefile under
make. It checks the adbd TCP listener removal (flare-edge#3129), the rule's
fail-closed behaviour (bfe-core1106-sdk#45) and the adbd rebuild gate as the
Makefile evaluates it, including a changed source tarball (bfe-core1106-sdk#44,
#46, #49). `BASE_DIR` is the luckfox base
Makefile evaluates it (bfe-core1106-sdk#44, #46). `BASE_DIR` is the luckfox base
commit 824b817f8, `sysdrv/tools/board/android-tools` only:
git -C <luckfox-sdk> archive 824b817f8 sysdrv/tools/board/android-tools | tar -C BASE_DIR -xf -
@@ -120,7 +119,7 @@ commit 824b817f8, `sysdrv/tools/board/android-tools` only:
The toolchain is a stub: the compiler stub only creates its output file, so
nothing is compiled. Run the test with `none` as the patch file to see the base
fail. `adbd-no-tcp-cases.sh` runs the real patch (must pass), the unpatched base
and four mutants of the patch (each must fail for the reason it names).
and three mutants of the patch (each must fail for the reason it names).
## Completeness check
@@ -327,8 +326,8 @@ calls from the device half of `adb_main()` and runs last in
It also changes the Makefile gate. adbd was rebuilt only when `out/usr/bin/adbd`
was missing, so a patch-set change never reached an SDK tree that already held
the binary (bfe-core1106-sdk#44). `adbd-current.sh` now compares a stamp in
`out/.adbd-inputs` with a hash of the Makefile, the gate script, the patch set
and the two adbd source tarballs, and the build writes that stamp.
`out/.adbd-inputs` with a hash of the Makefile, the gate script and the patch
set, and the build writes that stamp.
The rule now stops at the first failed step (a debian series entry, an
`android-tools.patch.sh` step run with `-e`, the build, or the copy into
@@ -15,8 +15,8 @@ It also closes a build gap (bfe-core1106-sdk#44). The Makefile rebuilt adbd
only when out/usr/bin/adbd was missing, so a patch-set change never reached an
image built on an SDK tree that already held the binary. The Makefile now
gates adbd on adbd-current.sh: the build writes a stamp holding a hash of the
Makefile, the gate script, the patch set and the two adbd source tarballs, and
a missing or stale stamp rebuilds adbd (bfe-core1106-sdk#49).
Makefile, the gate script and the patch set, and a missing or stale stamp
rebuilds adbd.
The rule stops at the first failed step: a debian series entry, an
android-tools.patch.sh step (run with -e), the build, or the copy into
@@ -25,12 +25,12 @@ the patch set gets one (bfe-core1106-sdk#45).
Regression tests: luckfox-sdk-patches/tests/test-adbd-no-tcp.sh runs the rule
under make with stub toolchains. It checks the listeners, the fail-closed
cases, the stamp, a source tarball change and the gate that the Makefile
evaluates (bfe-core1106-sdk#46, #49). tests/adbd-no-tcp-cases.sh runs the real
patch, the unpatched base and mutants that must fail.
cases, the stamp and the gate that the Makefile evaluates (bfe-core1106-sdk#46).
tests/adbd-no-tcp-cases.sh runs the real patch, the unpatched base and mutants
that must fail.
diff --git a/sysdrv/tools/board/android-tools/Makefile b/sysdrv/tools/board/android-tools/Makefile
index bb72255..7ec24f7 100644
index bb72255..889e983 100644
--- a/sysdrv/tools/board/android-tools/Makefile
+++ b/sysdrv/tools/board/android-tools/Makefile
@@ -23,6 +23,15 @@ PKG_TARBALL_DEBIAN := android-tools_4.2.2+git20130218-3ubuntu41.debian.tar.gz
@@ -38,13 +38,13 @@ index bb72255..7ec24f7 100644
PKG_INSTALL_BIN_DIR := $(CURRENT_DIR)/$(PKG_BIN)/usr/bin
+# flare-edge#3129: adbd is rebuilt whenever its inputs change. The stamp holds
+# the hash of this Makefile, adbd-current.sh, the android-tools patch set and
+# the two adbd source tarballs. An adbd without a matching stamp (left in out/
+# by a build from other inputs) is built again from the regenerated source.
+# The series, patch, build and copy steps stop the rule on failure; the stamp is
+# written last, so no binary that was not built from these inputs gets one (bfe-core1106-sdk#45).
+# the hash of this Makefile, adbd-current.sh and the android-tools patch set.
+# An adbd without a matching stamp (left in out/ by a build from other patches)
+# is built again from the regenerated source. Every step below stops the rule
+# when it fails, and the stamp is written last, so no binary that was not built
+# from the patch set gets one (bfe-core1106-sdk#45).
+ADBD_STAMP := $(CURRENT_DIR)/$(PKG_BIN)/.adbd-inputs
+ADBD_INPUTS := $(shell cat $(CURRENT_DIR)/Makefile $(CURRENT_DIR)/adbd-current.sh $(CURRENT_DIR)/$(PKG_PATCHES_ANDROID_TOOLS)/* $(CURRENT_DIR)/$(PKG_TARBALL_ANDROID_TOOLS) $(CURRENT_DIR)/$(PKG_TARBALL_DEBIAN) | sha256sum | cut -d' ' -f1)
+ADBD_INPUTS := $(shell cat $(CURRENT_DIR)/Makefile $(CURRENT_DIR)/adbd-current.sh $(CURRENT_DIR)/$(PKG_PATCHES_ANDROID_TOOLS)/* | sha256sum | cut -d' ' -f1)
+
PKG_DEP_OPENSSL := $(CURRENT_DIR)/../toolkits/openssl
PKG_DEP_ZLIB := $(CURRENT_DIR)/../toolkits/zlib
+1 -13
View File
@@ -2,7 +2,7 @@
# adbd-no-tcp-cases.sh BASE_DIR PATCH_FILE
#
# Runs test-adbd-no-tcp.sh on the real patch (must PASS), on the unpatched base
# (must FAIL), and on four mutants of the patch. Each mutant must FAIL, and its
# (must FAIL), and on three mutants of the patch. Each mutant must FAIL, and its
# FAIL line must name the reason given here:
# gate-makefile-only ADBD_INPUTS hashes only the Makefile; the patch set and
# the gate script are dropped (bfe-core1106-sdk#46)
@@ -10,8 +10,6 @@
# so a failed 0017 hunk still stamps adbd (bfe-core1106-sdk#45)
# copy-unchecked only the copy into out/usr/bin is unchecked, so a failed
# copy still writes the stamp (bfe-core1106-sdk#45)
# gate-no-tarballs ADBD_INPUTS drops the two source tarballs, so a changed
# tarball keeps a stale adbd (bfe-core1106-sdk#49)
# Usage and layout: see test-adbd-no-tcp.sh.
# Exit 0 when every case behaves as expected, 1 otherwise, 2 on usage.
set -u
@@ -76,10 +74,6 @@ cat > "$WORK/copy-unchecked.sed" <<'SEDEOF'
}
SEDEOF
cat > "$WORK/gate-no-tarballs.sed" <<'SEDEOF'
s#^+ADBD_INPUTS := .*$#+ADBD_INPUTS := $(shell cat $(CURRENT_DIR)/Makefile $(CURRENT_DIR)/adbd-current.sh $(CURRENT_DIR)/$(PKG_PATCHES_ANDROID_TOOLS)/* | sha256sum | cut -d' ' -f1)#
SEDEOF
expect 0 "real patch" "$PATCH"
expect 1 "unpatched base" none
if mutant gate-makefile-only; then
@@ -98,12 +92,6 @@ else
bad "mutant copy-unchecked does not change the patch"
fi
if mutant gate-no-tarballs; then
expect 1 "mutant gate-no-tarballs" "$WORK/gate-no-tarballs.patch" "ADBD_INPUTS is"
else
bad "mutant gate-no-tarballs does not change the patch"
fi
if [ "$fail" = 0 ]; then
echo "RESULT PASS"
exit 0
+6 -27
View File
@@ -5,8 +5,7 @@
# 127.0.0.1:5037), bfe-core1106-sdk#44 (a change to the adbd patch set never
# reached the image), bfe-core1106-sdk#45 (a failed patch or copy step still
# stamped adbd current) and bfe-core1106-sdk#46 (the gate was tested by a copy
# of its formula instead of by the Makefile) and bfe-core1106-sdk#49 (a changed
# source tarball did not rebuild adbd).
# of its formula instead of by the Makefile).
#
# BASE_DIR holds sysdrv/tools/board/android-tools at the luckfox base commit
# 824b817f8, as in the vendor checkout:
@@ -155,16 +154,16 @@ else
fi
# 4. The gate, as the Makefile evaluates it: ADBD_INPUTS must be the sha256 of
# the Makefile, adbd-current.sh, the patch set and the two adbd source
# tarballs, the five inputs that the stamp must match.
# the Makefile, adbd-current.sh and the patch set, the three inputs that the
# stamp must match.
# shellcheck disable=SC2016 # the make text must reach make unexpanded
printf '%s\n' '$(info ADBD_INPUTS=$(ADBD_INPUTS))' > "$WORK/probe.mk" || exit 2
probe=$(cd "$GOOD" && make -s -f Makefile -f "$WORK/probe.mk" SYSDRV_PARAM=/dev/null no-such-target 2>/dev/null | sed -n 's/^ADBD_INPUTS=//p')
want=$(cd "$AT" && cat Makefile adbd-current.sh android-tools-patches/* android-tools_4.2.2+git20130218.orig.tar.xz android-tools_4.2.2+git20130218-3ubuntu41.debian.tar.gz 2>/dev/null | sha256sum | cut -d' ' -f1)
want=$(cd "$AT" && cat Makefile adbd-current.sh android-tools-patches/* 2>/dev/null | sha256sum | cut -d' ' -f1)
if [ -n "$probe" ] && [ "$probe" = "$want" ]; then
pass "ADBD_INPUTS is the sha256 of Makefile, adbd-current.sh, the patch set and the source tarballs"
pass "ADBD_INPUTS is the sha256 of Makefile, adbd-current.sh and the patch set"
else
bad "ADBD_INPUTS is '$probe', want '$want' (sha256 of Makefile, adbd-current.sh, the patch set and the source tarballs)"
bad "ADBD_INPUTS is '$probe', want '$want' (sha256 of Makefile, adbd-current.sh and the patch set)"
fi
# 5. The rule itself: a matching stamp with adbd present skips the build, and a
@@ -195,26 +194,6 @@ else
bad "rule did not rebuild adbd without a stamp (rc $RC, compiler runs $CC_RUNS)"
fi
# 5b. The source tarballs are inputs too: a changed tarball must rebuild adbd
# when the Makefile, the gate script and the patch set are unchanged.
D=$(case_at tarball) || exit 2
run_make "$D" "$WORK/tarball-built.log"
first_built=0
if [ "$RC" = 0 ] && [ "$CC_RUNS" -gt 0 ]; then first_built=1; fi
t=$D/android-tools_4.2.2+git20130218-3ubuntu41.debian.tar.gz
tb=$WORK/tarball-edit
rm -rf "$tb" && mkdir -p "$tb" || exit 2
if [ "$first_built" = 1 ] && tar -xzf "$t" -C "$tb" && : > "$tb/debian/.tarball-changed" && tar -czf "$t.new" -C "$tb" debian && mv "$t.new" "$t"; then
run_make "$D" "$WORK/tarball.log"
if [ "$RC" = 0 ] && [ "$CC_RUNS" -gt 0 ]; then
pass "rule rebuilds adbd when a source tarball changes"
else
bad "rule did not rebuild adbd after a source tarball change (rc $RC, compiler runs $CC_RUNS)"
fi
else
bad "could not build the tarball case (first build or tarball edit failed)"
fi
# 6. Fail closed. An injected failure must stop the rule with a non-zero status
# and leave no stamp. The failures before the compile step must also stop the
# rule before the compiler runs.
-122
View File
@@ -1,122 +0,0 @@
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 4915a63..979a6e7 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -251,4 +251,6 @@ source "drivers/hte/Kconfig"
source "drivers/cdx/Kconfig"
+source "drivers/warden-test/Kconfig"
+
endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index 8e1ffa4..e120fc2 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -197,3 +197,6 @@ obj-$(CONFIG_DPLL) += dpll/
obj-$(CONFIG_DIBS) += dibs/
obj-$(CONFIG_S390) += s390/
+
+# Test-only modules (bench fault F5): built only when the test flavour enables them.
+obj-$(CONFIG_WARDEN_TEST_HANG) += warden-test/
diff --git a/drivers/warden-test/Kconfig b/drivers/warden-test/Kconfig
new file mode 100644
index 0000000..3c6b7d8
--- /dev/null
+++ b/drivers/warden-test/Kconfig
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Test-only modules for the WardenOS bench. The SDK builds a symbol here only
+# when the caller lists its directory in WARDEN_MODULES_COLLECT (build/build-kernel.sh),
+# which only the test flavour does. Release and debug kernels never enable them.
+
+config WARDEN_TEST_HANG
+ tristate "Warden test: kernel hang on a debugfs write (bench fault F5)"
+ depends on DEBUG_FS
+ help
+ Test-only. Creates /sys/kernel/debug/warden_hang/trigger. A write to it
+ turns interrupts off and never returns, so warden-io stops beating and
+ the board is reset by its watchdog (d07 fault F5). Never enable this in
+ a release or debug kernel.
+
+ If unsure, say N.
diff --git a/drivers/warden-test/Makefile b/drivers/warden-test/Makefile
new file mode 100644
index 0000000..c586de7
--- /dev/null
+++ b/drivers/warden-test/Makefile
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
+# Test-only modules. Built only when their Kconfig symbol is =m, which build/build-kernel.sh
+# sets for the test flavour (WARDEN_MODULES_COLLECT lists this directory).
+obj-$(CONFIG_WARDEN_TEST_HANG) += warden_hang.o
diff --git a/drivers/warden-test/warden_hang.c b/drivers/warden-test/warden_hang.c
new file mode 100644
index 0000000..3307532
--- /dev/null
+++ b/drivers/warden-test/warden_hang.c
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Warden test-only kernel hang (bench fault F5, d07 "Fault Matrix").
+ *
+ * A write to /sys/kernel/debug/warden_hang/trigger turns interrupts off on the
+ * only core and never returns. Nothing runs after that: warden-io stops
+ * beating, the HPMCU trips the relays once their deadline passes, and the
+ * watchdog resets the board about 90 s after the hang.
+ *
+ * Test flavour only. build/build-kernel.sh enables CONFIG_WARDEN_TEST_HANG
+ * when WARDEN_MODULES_COLLECT lists drivers/warden-test, and the module is
+ * then collected into oem.img with the kernel's vermagic. Nothing loads it on
+ * its own: the bench runner inserts it for the F5 case.
+ */
+#include <linux/debugfs.h>
+#include <linux/fs.h>
+#include <linux/init.h>
+#include <linux/irqflags.h>
+#include <linux/module.h>
+#include <linux/printk.h>
+#include <linux/processor.h>
+
+static struct dentry *hang_dir;
+
+static void __noreturn warden_hang_spin(void)
+{
+ local_irq_disable();
+ for (;;)
+ cpu_relax();
+}
+
+static ssize_t trigger_write(struct file *file, const char __user *buf,
+ size_t count, loff_t *ppos)
+{
+ /* Logged before interrupts go off; the spin below never returns. */
+ pr_emerg("warden_hang: F5 kernel hang requested, interrupts off\n");
+ warden_hang_spin();
+}
+
+static const struct file_operations trigger_fops = {
+ .owner = THIS_MODULE,
+ .write = trigger_write,
+ .llseek = noop_llseek,
+};
+
+static int __init warden_hang_init(void)
+{
+ hang_dir = debugfs_create_dir("warden_hang", NULL);
+ debugfs_create_file("trigger", 0200, hang_dir, NULL, &trigger_fops);
+ return 0;
+}
+
+static void __exit warden_hang_exit(void)
+{
+ debugfs_remove_recursive(hang_dir);
+}
+
+module_init(warden_hang_init);
+module_exit(warden_hang_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Warden test-only kernel hang (bench fault F5)");
-1
View File
@@ -31,7 +31,6 @@ with `../build/warden_defconfig` -> `zImage` + `rv1106-warden.dtb`).
| `80-misc-thermal-rtc-adc.patch` | tsadc, rtc-rockchip, saradc, trng, otp, gmac, goodix touch |
| `82-arch-timer-vdso-phys-counter.patch` | arch timer: keep the arm32 vDSO clock off the virtual counter while the kernel times on the physical one (CNTVOFF left non-zero by the boot firmware, #35); checked by `tests/arch-timer/check-vdso-counter.py` |
| `90-kconfig-no-python-symbol.patch` | drops `DRM_MSM_VALIDATE_XML` so the expanded `.config` (and `KCONFIG_SHA256`) does not depend on the host python (#19) |
| `95-test-hang-module.patch` | test-only kernel hang module for bench fault F5 in `drivers/warden-test/` (`CONFIG_WARDEN_TEST_HANG`, default n); enabled only when `WARDEN_MODULES_COLLECT` lists `drivers/warden-test`, never in a release or debug build |
## License
+1 -2
View File
@@ -121,8 +121,7 @@ bb_main() {
rm -f "$bin.inputs"
tar="${BB_SRC_TARBALL:-$out/busybox-${BB_SRC_VER}.tar.bz2}"
qemu_fetch_verified "$BB_SRC_URL" "$BB_SRC_SHA256" "$tar" "busybox ${BB_SRC_VER} source" \
"$BB_SRC_MIRROR_URL"
qemu_fetch_verified "$BB_SRC_URL" "$BB_SRC_SHA256" "$tar" "busybox ${BB_SRC_VER} source"
scratch="$(mktemp -d "${TMPDIR:-/tmp}/warden-busybox.XXXXXX")"
# Expanded now on purpose: the trap must remove this run's directory.
+1 -8
View File
@@ -11,9 +11,6 @@ BB_SRC_VER=1.37.0
# Read by build-busybox.sh, which sources this file.
# shellcheck disable=SC2034
BB_SRC_URL="https://busybox.net/downloads/busybox-${BB_SRC_VER}.tar.bz2"
# Buildroot mirrors this exact pinned release; verification is unchanged.
# shellcheck disable=SC2034
BB_SRC_MIRROR_URL="https://sources.buildroot.net/busybox/busybox-${BB_SRC_VER}.tar.bz2"
BB_SRC_SHA256=3311dff32e746499f4df0d5df04d7eb396382d7e108bb9250e7b519b837043a4
qemu_log() { printf '\033[36m== %s\033[0m\n' "$*"; }
@@ -21,10 +18,9 @@ qemu_log() { printf '\033[36m== %s\033[0m\n' "$*"; }
# Download URL to DEST and verify it against the sha256 WANT. A DEST that
# already matches is kept. FAILS CLOSED: three bounded attempts, then exit 1;
# a mismatching download never lands at DEST.
# Usage: qemu_fetch_verified URL WANT DEST LABEL [MIRROR_URL]
# Usage: qemu_fetch_verified URL WANT DEST LABEL
qemu_fetch_verified() {
local url="$1" want="$2" dest="$3" label="$4" got
local mirror="${5:-}"
if [ -f "$dest" ]; then
got="$(sha256sum "$dest" | awk '{print $1}')"
if [ "$want" = "$got" ]; then
@@ -44,9 +40,6 @@ qemu_fetch_verified() {
local attempt tmp="${dest}.download.$$"
rm -f "$tmp"
for attempt in 1 2 3; do
if [ "$attempt" -gt 1 ] && [ -n "$mirror" ]; then
url="$mirror"
fi
qemu_log "downloading $url (attempt $attempt/3)"
if curl --retry 1 --retry-delay "$delay" --retry-connrefused \
--connect-timeout "$stall" --speed-limit 1024 --speed-time "$stall" \
-92
View File
@@ -1,92 +0,0 @@
#!/usr/bin/env bash
# The sourced downloader runs before the later production-call test stub.
# shellcheck disable=SC2218
set -euo pipefail
TEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
QEMU_DIR="$(cd "$TEST_DIR/.." && pwd)"
SCRATCH="$(mktemp -d "${TMPDIR:-/tmp}/busybox-source-mirror.XXXXXX")"
trap 'rm -rf "$SCRATCH"' EXIT
mkdir -p "$SCRATCH/bin"
printf 'pinned source fixture' > "$SCRATCH/good"
WANT="$(sha256sum "$SCRATCH/good" | awk '{print $1}')"
export MIRROR_LOG="$SCRATCH/requests" MIRROR_GOOD="$SCRATCH/good"
export MIRROR_MODE=good
cat > "$SCRATCH/bin/curl" <<'CURL'
#!/usr/bin/env bash
set -euo pipefail
url= out=
while [ "$#" -gt 0 ]; do
case "$1" in
-o) shift; out="$1" ;;
https://*) url="$1" ;;
esac
shift
done
printf '%s\n' "$url" >> "$MIRROR_LOG"
[ -n "$out" ] || exit 2
case "$url" in
https://primary.invalid/source) exit 28 ;;
https://mirror.invalid/source)
if [ "$MIRROR_MODE" = good ]; then cp "$MIRROR_GOOD" "$out";
else printf 'corrupt mirror response' > "$out"; fi ;;
*) exit 2 ;;
esac
CURL
chmod 0755 "$SCRATCH/bin/curl"
export PATH="$SCRATCH/bin:$PATH"
# shellcheck source=qemu/lib.sh disable=SC1091
source "$QEMU_DIR/lib.sh"
qemu_fetch_verified https://primary.invalid/source "$WANT" \
"$SCRATCH/fetched" source https://mirror.invalid/source
cmp "$SCRATCH/good" "$SCRATCH/fetched"
printf '%s\n' https://primary.invalid/source https://mirror.invalid/source > "$SCRATCH/expected"
cmp "$MIRROR_LOG" "$SCRATCH/expected"
echo 'PASS primary timeout uses verified mirror'
: > "$MIRROR_LOG"
qemu_fetch_verified https://primary.invalid/source "$WANT" \
"$SCRATCH/fetched" source https://mirror.invalid/source
test ! -s "$MIRROR_LOG"
echo 'PASS verified cache avoids both sources'
export MIRROR_MODE=bad
: > "$MIRROR_LOG"
if (qemu_fetch_verified https://primary.invalid/source "$WANT" \
"$SCRATCH/refused" source https://mirror.invalid/source) > "$SCRATCH/refusal" 2>&1; then
echo 'FAIL corrupt mirror was accepted' >&2
exit 1
fi
test "$(wc -l < "$MIRROR_LOG")" -eq 3
test ! -e "$SCRATCH/refused"
test -z "$(find "$SCRATCH" -maxdepth 1 -name 'refused.download.*' -print -quit)"
grep -q 'after 3 verified attempts' "$SCRATCH/refusal"
echo 'PASS corrupt mirror refused within three attempts'
# Exercise the production source call with the downloader intercepted only
# after build-busybox.sh loads its constants. Refuse before extraction.
# shellcheck source=qemu/build-busybox.sh disable=SC1091
source "$QEMU_DIR/build-busybox.sh"
mkdir -p "$SCRATCH/toolchain"
printf '#!/bin/sh\nexit 0\n' > "$SCRATCH/toolchain/fake-gcc"
chmod 0755 "$SCRATCH/toolchain/fake-gcc"
qemu_fetch_verified() {
[ "$1" = "$BB_SRC_URL" ] && [ "$2" = "$BB_SRC_SHA256" ]
[ "$5" = "$BB_SRC_MIRROR_URL" ]
printf '%s\n' 'production mirror call verified' > "$SCRATCH/wired"
return 42
}
set +e
(set -e; OUT="$SCRATCH/build" CROSS_COMPILE="$SCRATCH/toolchain/fake-" JOBS=1 bb_main) \
> "$SCRATCH/wiring-log" 2>&1
status=$?
set -e
if [ "$status" -ne 42 ]; then
cat "$SCRATCH/wiring-log" >&2
echo 'FAIL production source call did not stop at the verified downloader' >&2
exit 1
fi
grep -qx 'production mirror call verified' "$SCRATCH/wired"
echo 'PASS production source fetch supplies pinned mirror'
@@ -1,91 +0,0 @@
#!/usr/bin/env bash
# Tests for run-test-hang-tests.sh when a tool its configuration checks need is
# missing (the checks SKIP with a notice; they do not FAIL), and for the output
# of a failed kernel tarball fetch (the end of its log is printed, because the
# EXIT trap deletes the log).
#
# Hermetic: each case runs the script under a PATH that holds only the base
# tools plus the fakes that case needs (python, the cross compiler, flex, bison,
# curl), so the result does not depend on what this host has installed. Nothing
# is compiled and nothing is downloaded.
set -uo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TARGET="$HERE/run-test-hang-tests.sh"
BASH_BIN="$(command -v bash)"
TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT
FAIL=0
ok() { printf '[PASS] %s\n' "$1"; }
bad() { printf '[FAIL] %s\n' "$1"; FAIL=1; }
# Base tools used by the script, its offline checks (the module gate fixtures
# and the collection step use find and cp) and the fetch helper.
BASE_TOOLS=(bash dirname basename mktemp rm mkdir cat tail grep sed awk tr head wc cut sort cmp sha256sum git tar xz env mv cp find)
# mkpath <dir> <tool...>: link each named tool found on this host into <dir>.
mkpath() {
local dir="$1" t p
shift
mkdir -p "$dir"
for t in "$@"; do
p="$(command -v "$t")" && ln -sf "$p" "$dir/$t"
done
return 0
}
# stub <dir> <name> <command>: an executable that runs <command>.
stub() {
printf '#!/bin/sh\n%s\n' "$3" > "$1/$2"
chmod 0755 "$1/$2"
}
# run_target <path-dir> <out> <tarball>: run the script with exactly that PATH.
run_target() {
env -i PATH="$1" TMPDIR="$TMP" HOME="$TMP" KERNEL_TARBALL="$3" CROSS_COMPILE=fake- \
"$BASH_BIN" "$TARGET" >"$2" 2>&1
}
# Cases 1 and 2: one of flex and bison is missing. The configuration checks SKIP.
for missing in flex bison; do
dir="$TMP/no-$missing"
mkpath "$dir" "${BASE_TOOLS[@]}"
stub "$dir" python 'exit 0'
stub "$dir" fake-gcc 'exit 0'
for present in flex bison; do
[ "$present" = "$missing" ] || stub "$dir" "$present" 'exit 0'
done
run_target "$dir" "$TMP/no-$missing.out" "$TMP/absent.tar.xz"
rc=$?
if [ "$rc" -eq 0 ] \
&& grep -q '^\[SKIP\] configuration checks: flex and bison' "$TMP/no-$missing.out" \
&& ! grep -q '^\[FAIL\]' "$TMP/no-$missing.out"; then
ok "without $missing the configuration checks SKIP and the script passes"
else
bad "without $missing the configuration checks did not SKIP cleanly (rc $rc)"
cat "$TMP/no-$missing.out"
fi
done
# Case 3: every tool is present, the fetch fails. The script FAILs and prints
# the end of the fetch log before it exits.
dir="$TMP/bad-fetch"
mkpath "$dir" "${BASE_TOOLS[@]}"
stub "$dir" python 'exit 0'
stub "$dir" fake-gcc 'exit 0'
stub "$dir" flex 'exit 0'
stub "$dir" bison 'exit 0'
stub "$dir" curl 'echo "fake curl: refused in this test" >&2; exit 22'
run_target "$dir" "$TMP/bad-fetch.out" "$TMP/nodir/linux.tar.xz"
rc=$?
if [ "$rc" -eq 1 ] \
&& grep -q '^\[FAIL\] pinned kernel tarball could not be fetched' "$TMP/bad-fetch.out" \
&& grep -q '^--- last 40 lines of fetch output ---$' "$TMP/bad-fetch.out" \
&& grep -q 'fake curl: refused in this test' "$TMP/bad-fetch.out"; then
ok "a failed fetch FAILs and prints the end of its log before exit"
else
bad "a failed fetch did not print its log tail (rc $rc)"
cat "$TMP/bad-fetch.out"
fi
if [ "$FAIL" -eq 0 ]; then echo "missing-tools: all checks passed"; else echo "missing-tools: FAILED"; fi
exit "$FAIL"
-180
View File
@@ -1,180 +0,0 @@
#!/usr/bin/env bash
# Hermetic tests for the collected-module gate (build/lib-module-gate.sh): a
# module whose vermagic is not this kernel's is refused before it is copied,
# in the test-only list and in a release list (aic8800), and the test-only
# directory needs CONFIG_WARDEN_TEST_HANG=m. Fixtures only: no kernel tree, no
# compiler, no network. The refusal paths run with a module of the wrong
# vermagic, which the grep-only checks in run-test-hang-tests.sh never did.
set -uo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO="$(cd "$HERE/../.." && pwd)"
TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT
FAIL=0
ok() { printf '[PASS] %s\n' "$1"; }
bad() { printf '[FAIL] %s\n' "$1"; FAIL=1; }
# shellcheck source=build/lib-module-gate.sh
. "$REPO/build/lib-module-gate.sh"
KREL=6.18.46
GOOD="6.18.46 SMP preempt mod_unload ARMv7 p2v8"
STALE="5.10.0 SMP preempt mod_unload ARMv7"
# mkko <file> <vermagic>: a fixture module whose .modinfo holds the vermagic as
# a NUL-separated string, the way a built .ko does.
mkko() {
mkdir -p "$(dirname "$1")"
printf '\177ELF\000\000\000modinfo\000license=GPL\000vermagic=%s\000depends=\000' "$2" > "$1"
}
# expect <label> <want status> <command...>: the command's status is checked.
expect() {
local label=$1 want=$2 rc
shift 2
"$@" > "$TMP/out" 2>&1; rc=$?
if [ "$rc" -eq "$want" ]; then ok "$label"; else bad "$label (status $rc, want $want): $(tr '\n' ' ' < "$TMP/out")"; fi
}
# expect_msg <label> <want status> <text> <command...>: the status and the
# FATAL text (a fixed string) must both be there.
expect_msg() {
local label=$1 want=$2 text=$3 rc
shift 3
"$@" > "$TMP/out" 2>&1; rc=$?
if [ "$rc" -eq "$want" ] && grep -qF -- "$text" "$TMP/out"; then
ok "$label"
else
bad "$label (status $rc, want $want, text '$text'): $(tr '\n' ' ' < "$TMP/out")"
fi
}
# --- the vermagic of one module ---------------------------------------------
mkko "$TMP/v/good.ko" "$GOOD"
expect "a module of this kernel's vermagic passes" 0 module_vermagic_check "$KREL" "$TMP/v/good.ko"
mkko "$TMP/v/stale.ko" "$STALE"
expect_msg "a 5.10 module is refused, the vermagic named" 1 "is not this kernel's '6.18.46'" \
module_vermagic_check "$KREL" "$TMP/v/stale.ko"
mkko "$TMP/v/rc.ko" "6.18.46-rc1 SMP preempt mod_unload ARMv7"
expect_msg "a release that only starts with this kernel's string is refused" 1 "is not this kernel's" \
module_vermagic_check "$KREL" "$TMP/v/rc.ko"
printf '\177ELF\000\000\000modinfo\000license=GPL\000depends=\000' > "$TMP/v/none.ko"
expect_msg "a module with no vermagic is refused" 1 "has no vermagic" \
module_vermagic_check "$KREL" "$TMP/v/none.ko"
expect_msg "an empty kernel release is refused" 1 "kernel release is empty" \
module_vermagic_check "" "$TMP/v/good.ko"
# --- the collected list: copied only when every module passes ----------------
# The test-only list: a module of this kernel is collected and counted.
T1="$TMP/tree-good"
mkko "$T1/drivers/warden-test/warden_hang.ko" "$GOOD"
mkdir -p "$TMP/out-good"
if collect_modules "$T1" drivers/warden-test "$KREL" "$TMP/out-good" \
&& [ "$COLLECTED" = 1 ] && [ -f "$TMP/out-good/warden_hang.ko" ]; then
ok "the test-only list collects the module of this kernel (count 1, copied)"
else
bad "the test-only list collects the module of this kernel (count ${COLLECTED:-unset})"
fi
# The test-only list with a stale module: refused, and the stale .ko is not copied.
T2="$TMP/tree-stale-test"
mkko "$T2/drivers/warden-test/warden_hang.ko" "$STALE"
mkdir -p "$TMP/out-stale-test"
collect_modules "$T2" drivers/warden-test "$KREL" "$TMP/out-stale-test" > "$TMP/out" 2>&1; rc=$?
if [ "$rc" -eq 1 ] && grep -qF "is not this kernel's '6.18.46'" "$TMP/out" \
&& [ ! -e "$TMP/out-stale-test/warden_hang.ko" ]; then
ok "a stale module in the test-only list is refused and not copied"
else
bad "a stale module in the test-only list is refused and not copied (status $rc): $(tr '\n' ' ' < "$TMP/out")"
fi
# A release list (aic8800, as ci.yml lists it) gets the same gate: one stale
# module among good ones refuses the list and the stale module is not copied.
T3="$TMP/tree-stale-release"
D3=drivers/net/wireless/aic8800
mkko "$T3/$D3/aic8800_fdrv.ko" "$STALE"
mkko "$T3/$D3/aic8800_btlpm.ko" "$GOOD"
mkdir -p "$TMP/out-stale-release"
collect_modules "$T3" "$D3" "$KREL" "$TMP/out-stale-release" > "$TMP/out" 2>&1; rc=$?
if [ "$rc" -eq 1 ] && grep -qF "is not this kernel's" "$TMP/out" \
&& [ ! -e "$TMP/out-stale-release/aic8800_fdrv.ko" ]; then
ok "a stale module in a release list (aic8800) is refused and not copied"
else
bad "a stale module in a release list (aic8800) is refused and not copied (status $rc)"
fi
# A good release list collects every module.
T4="$TMP/tree-good-release"
mkko "$T4/$D3/aic8800_fdrv.ko" "$GOOD"
mkko "$T4/$D3/aic8800_btlpm.ko" "$GOOD"
mkdir -p "$TMP/out-good-release"
if collect_modules "$T4" "$D3" "$KREL" "$TMP/out-good-release" && [ "$COLLECTED" = 2 ]; then
ok "a good release list collects both modules (count 2)"
else
bad "a good release list collects both modules (count ${COLLECTED:-unset})"
fi
expect_msg "a listed directory missing from the tree is refused" 1 "not in tree" \
collect_modules "$TMP/tree-absent" drivers/warden-test "$KREL" "$TMP/out-good"
mkdir -p "$TMP/tree-empty/drivers/warden-test"
expect_msg "a listed directory with no module is refused" 1 "no .ko produced" \
collect_modules "$TMP/tree-empty" drivers/warden-test "$KREL" "$TMP/out-good"
# --- the test symbol: which directory needs it, and what it must be ----------
if [ "$(test_symbol_of drivers/warden-test)" = WARDEN_TEST_HANG ]; then
ok "the test-only directory maps to CONFIG_WARDEN_TEST_HANG"
else
bad "the test-only directory maps to CONFIG_WARDEN_TEST_HANG"
fi
if [ -z "$(test_symbol_of drivers/net/wireless/aic8800)" ]; then
ok "a release directory needs no test symbol"
else
bad "a release directory needs no test symbol"
fi
printf 'CONFIG_WARDEN_TEST_HANG=m\n' > "$TMP/cfg-m"
expect "=m after olddefconfig passes for the test-only directory" 0 \
require_test_config "$TMP/cfg-m" drivers/warden-test
printf 'CONFIG_WARDEN_TEST_HANG=y\n' > "$TMP/cfg-y"
expect_msg "=y is refused (it would not give a .ko)" 1 "needs CONFIG_WARDEN_TEST_HANG=m" \
require_test_config "$TMP/cfg-y" drivers/warden-test
printf '# CONFIG_WARDEN_TEST_HANG is not set\n' > "$TMP/cfg-unset"
expect_msg "an unset symbol is refused (the dependency was unmet)" 1 "did not survive olddefconfig" \
require_test_config "$TMP/cfg-unset" drivers/warden-test
: > "$TMP/cfg-none"
expect_msg "a configuration without the symbol is refused" 1 "did not survive olddefconfig" \
require_test_config "$TMP/cfg-none" drivers/warden-test
expect "a missing configuration file is refused" 1 \
require_test_config "$TMP/cfg-absent" drivers/warden-test
expect "a release list needs no symbol in any configuration" 0 \
require_test_config "$TMP/cfg-none" drivers/net/wireless/aic8800
# --- build-kernel.sh runs the gate on every collected list ------------------
BK="$REPO/build/build-kernel.sh"
if grep -q '^\. "\$HERE/lib-module-gate\.sh"$' "$BK"; then
ok "build-kernel.sh sources the module gate"
else
bad "build-kernel.sh sources the module gate"
fi
if grep -q 'collect_modules "\$SRC" "\$d" "\$KREL" "\$MODOUT" || exit 1' "$BK"; then
ok "build-kernel.sh collects every listed directory through collect_modules"
else
bad "build-kernel.sh collects every listed directory through collect_modules"
fi
if grep -q 'require_test_config "\$SRC/.config" "\$d" || exit 1' "$BK"; then
ok "build-kernel.sh asserts the test symbol after olddefconfig"
else
bad "build-kernel.sh asserts the test symbol after olddefconfig"
fi
if grep -v '^[[:space:]]*#' "$BK" | grep -q 'WARDEN_TEST_HANG\|warden-test'; then
bad "build-kernel.sh names the test directory or symbol in code (it belongs in the gate)"
else
ok "build-kernel.sh names the test directory and symbol only in comments"
fi
if [ "$FAIL" -eq 0 ]; then echo "module-gate: all checks passed"; else echo "module-gate: FAILED"; fi
exit "$FAIL"
-148
View File
@@ -1,148 +0,0 @@
#!/usr/bin/env bash
# Tests for the test-only kernel hang module (bench fault F5): patch 95,
# the WARDEN_MODULES_COLLECT wiring in build/build-kernel.sh, and the vermagic gate.
#
# What a regression here costs: a release kernel that quietly carries the hang
# trigger, or a test image whose module is missing or stale (a hand-copied .ko
# that does not match the kernel). The offline checks always run. The checks
# that expand the kernel configuration need the pinned tarball, a cross compiler,
# python, flex and bison (the kernel's configuration parser). They run only when
# KERNEL_TARBALL and CROSS_COMPILE name them and those tools are on PATH (the
# build farm does this); otherwise they are skipped with a notice that names the
# missing piece (run-missing-tools-tests.sh checks those skips).
set -uo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO="$(cd "$HERE/../.." && pwd)"
TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT
FAIL=0
ok() { printf '[PASS] %s\n' "$1"; }
bad() { printf '[FAIL] %s\n' "$1"; FAIL=1; }
skip() { printf '[SKIP] %s\n' "$1"; }
# The EXIT trap deletes $TMP, so a failing step prints the end of its log here.
show_tail() { # <label> <log>
[ -s "$2" ] || return 0
printf -- '--- last 40 lines of %s ---\n' "$1"
tail -n 40 "$2"
printf -- '--- end of %s ---\n' "$1"
}
PATCH="$REPO/patches/95-test-hang-module.patch"
BK="$REPO/build/build-kernel.sh"
# --- offline: the patch and the build wiring -------------------------------
if bash -n "$BK"; then ok "build-kernel.sh parses"; else bad "build-kernel.sh does not parse"; fi
[ -f "$PATCH" ] && ok "patch 95 present" || bad "patch 95 missing"
for f in drivers/warden-test/Kconfig drivers/warden-test/Makefile drivers/warden-test/warden_hang.c; do
grep -q "^+++ b/$f\$" "$PATCH" && ok "patch 95 adds $f" || bad "patch 95 does not add $f"
done
grep -q '^+source "drivers/warden-test/Kconfig"$' "$PATCH" \
&& ok "drivers/Kconfig sources the test Kconfig" || bad "drivers/Kconfig does not source the test Kconfig"
grep -q '^+obj-$(CONFIG_WARDEN_TEST_HANG) += warden-test/$' "$PATCH" \
&& ok "drivers/Makefile descends into warden-test only under the symbol" \
|| bad "drivers/Makefile does not descend into warden-test under CONFIG_WARDEN_TEST_HANG"
grep -q 'config WARDEN_TEST_HANG' "$PATCH" && grep -q 'depends on DEBUG_FS' "$PATCH" \
&& ok "CONFIG_WARDEN_TEST_HANG is a tristate under DEBUG_FS" \
|| bad "CONFIG_WARDEN_TEST_HANG is missing or not under DEBUG_FS"
grep -q 'default y' "$PATCH" && bad "a test symbol defaults to y in patch 95" \
|| ok "patch 95 sets no default y"
if grep -q 'WARDEN_TEST_HANG' "$REPO/build/warden_defconfig" "$REPO/build/required-symbols.txt" \
"$REPO/build/probe-symbols.txt"; then
bad "a defconfig or symbol list names CONFIG_WARDEN_TEST_HANG (release must not)"
else
ok "no defconfig or symbol list names CONFIG_WARDEN_TEST_HANG"
fi
# The test symbol and the vermagic gate live in build/lib-module-gate.sh, which
# the behavioural checks in run-module-gate-tests.sh drive with fixtures (below).
if grep -q '^\. "\$HERE/lib-module-gate\.sh"$' "$BK" \
&& grep -q 'collect_modules "\$SRC" "\$d" "\$KREL" "\$MODOUT" || exit 1' "$BK"; then
ok "build-kernel.sh collects every listed module through the vermagic gate"
else
bad "build-kernel.sh does not collect through the vermagic gate"
fi
# The behavioural gate tests: refusals with a module of the wrong vermagic, and the
# test symbol that must be =m (run-module-gate-tests.sh, no kernel tree needed).
if bash "$HERE/run-module-gate-tests.sh" > "$TMP/gate.log" 2>&1; then
ok "module gate: wrong-vermagic refusals and acceptance fixtures pass"
else
bad "module gate: fixtures fail (run-module-gate-tests.sh)"
show_tail "module gate log" "$TMP/gate.log"
fi
# ASCII only in everything this change adds (documentation and comments included).
if LC_ALL=C grep -n -P '[^\x09\x0a\x20-\x7e]' "$BK" "$PATCH" "$REPO/patches/README.md" \
"$REPO/tests/test-hang/run-test-hang-tests.sh" "$HERE/run-missing-tools-tests.sh" \
"$REPO/build/lib-module-gate.sh" "$HERE/run-module-gate-tests.sh" >/dev/null; then
bad "non-ASCII byte in a file this change touches"
else
ok "ASCII only in the files this change touches"
fi
# --- configuration expansion: needs the tarball and a cross compiler ---------
if [ -z "${KERNEL_TARBALL:-}" ]; then
skip "configuration checks: KERNEL_TARBALL not set (run on the build farm)"
elif [ -z "${CROSS_COMPILE:-}" ] || ! command -v "${CROSS_COMPILE}gcc" >/dev/null 2>&1; then
skip "configuration checks: no cross compiler (set CROSS_COMPILE)"
elif ! command -v python >/dev/null 2>&1; then
skip "configuration checks: no python on PATH (the SDK quirk)"
elif ! command -v flex >/dev/null 2>&1 || ! command -v bison >/dev/null 2>&1; then
skip "configuration checks: flex and bison must both be on PATH (the kernel configuration parser needs them)"
elif [ ! -f "$KERNEL_TARBALL" ] && ! bash "$REPO/build/fetch-kernel-tarball.sh" "$KERNEL_TARBALL" >"$TMP/fetch.log" 2>&1; then
bad "pinned kernel tarball could not be fetched into $KERNEL_TARBALL"
show_tail "fetch output" "$TMP/fetch.log"
else
# Patches 05 and 95 both touch the two hook files; they must apply in order.
mkdir -p "$TMP/hooks"
tar -C "$TMP/hooks" -xJf "$KERNEL_TARBALL" linux-6.18.46/drivers/Kconfig linux-6.18.46/drivers/Makefile \
&& cd "$TMP/hooks/linux-6.18.46" \
&& git init -q . && git add -A && git -c user.name=t -c user.email=t@local commit -q -m base \
&& git apply --include='drivers/Kconfig' --include='drivers/Makefile' "$REPO/patches/05-build-wiring.patch" \
&& git apply --whitespace=nowarn "$PATCH" \
&& grep -q '^source "drivers/warden-test/Kconfig"$' drivers/Kconfig \
&& grep -q '^obj-$(CONFIG_WARDEN_TEST_HANG) += warden-test/$' drivers/Makefile \
&& ok "patch 95 applies after patch 05 on pristine 6.18.46" \
|| bad "patch 95 does not apply after patch 05 on pristine 6.18.46"
cd "$HERE" || exit 1
# Release: the symbol stays unset. Test: it is =m only when the directory is listed.
cfg() { # <out> <env assignments...>: expand the configuration only
local out="$1"; shift
env -u WARDEN_KCONFIG_FRAGMENT -u WARDEN_MODULES_COLLECT "$@" \
WORK="$TMP/work-$(basename "$out" .config)" CONFIG_OUT="$out" WARDEN_CONFIG_ONLY=1 \
KERNEL_TARBALL="$KERNEL_TARBALL" CROSS_COMPILE="$CROSS_COMPILE" \
bash "$BK" >"$out.log" 2>&1
}
if cfg "$TMP/release.config"; then
if grep -q '^CONFIG_WARDEN_TEST_HANG=' "$TMP/release.config"; then
bad "release configuration enables CONFIG_WARDEN_TEST_HANG"
else
ok "release configuration leaves CONFIG_WARDEN_TEST_HANG out"
fi
else
bad "release configuration expansion failed"
show_tail "release configuration log" "$TMP/release.config.log"
fi
if cfg "$TMP/test.config" WARDEN_MODULES_COLLECT=drivers/warden-test; then
grep -qx 'CONFIG_WARDEN_TEST_HANG=m' "$TMP/test.config" \
&& ok "test configuration sets CONFIG_WARDEN_TEST_HANG=m" \
|| bad "test configuration does not set CONFIG_WARDEN_TEST_HANG=m"
if [ -f "$TMP/release.config" ] && [ "$(sha256sum < "$TMP/test.config")" != "$(sha256sum < "$TMP/release.config")" ]; then
ok "test and release configurations differ (KCONFIG_SHA256 follows the request)"
else
bad "test configuration equals the release configuration"
fi
else
bad "test configuration expansion failed"
show_tail "test configuration log" "$TMP/test.config.log"
fi
fi
if [ "$FAIL" -eq 0 ]; then echo "test-hang: all checks passed"; else echo "test-hang: FAILED"; fi
exit "$FAIL"
+19
View File
@@ -0,0 +1,19 @@
# VOP pixel clock bench helpers (bfe-core1106-sdk#43)
Helpers for the bench proof of the CPLL 900 MHz clock plan. They run on a Warden panel
(busybox sh), read-only except for the UI workload, and need the panel's warden-ui test
hook (FIFO `/tmp/warden-ui.ctl`).
- `vopcheck.sh candidate|baseline`: reads clk_summary and the eth0 carrier. Candidate expects
pll_cpll 900000000, dclk_vop 30000000, clk_50m_src 50000000, clk_100m_src 100000000,
aclk_ddr_root 450000000 and clk_250m_src 225000000. Baseline expects pll_cpll 1000000000 and
dclk_vop 31250000. Exit 0 when all rows pass.
- `uirun.sh LABEL SECONDS`: fixed UI workload (wake, nav, two scrolls, home), one `stats` read
after each action. Writes `/tmp/vop-ui-LABEL.csv` and `.log` on the panel.
- `gic121.sh`: VOP frame-start count (GIC 121) in three-second windows, with INTR_EN0 and
DSP_CTRL0 read only. `WINDOWS=n` sets the number of windows.
- `summarize.py FILE...`: render_ms and render_max_ms statistics for each CSV
(`python3 -I summarize.py`).
Run a helper with `sh /tmp/<name>.sh` after copying it to the panel. Hold the panel's bench
lock for the whole run (`bench-lock run --class SOAK` for a workload).
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
# gic121.sh: VOP frame-start count (GIC 121) over three 3 s windows, read-only (no UI verbs, INTR_EN0 untouched).
cnt() { awk '/GIC-0 121 /{s=0; for(i=2;i<=NF;i++){ if($i ~ /^[0-9]+$/){s+=$i} else break }; print s; exit}' /proc/interrupts; }
bl=$(cat /sys/class/backlight/*/bl_power 2>/dev/null | head -1); br=$(cat /sys/class/backlight/*/brightness 2>/dev/null | head -1)
echo "backlight bl_power=$bl brightness=$br"
echo "INTR_EN0=$(devmem 0xff990034 2>/dev/null) DSP_CTRL0=$(devmem 0xff990020 2>/dev/null)"
i=1
while [ $i -le ${WINDOWS:-3} ]; do
c1=$(cnt); t1=$(cut -d' ' -f1 /proc/uptime); sleep 3; c2=$(cnt); t2=$(cut -d' ' -f1 /proc/uptime)
echo "window $i: count=$((c2-c1)) span=$(awk -v a=$t1 -v b=$t2 'BEGIN{printf "%.3f", b-a}') s rate=$(awk -v d=$((c2-c1)) -v a=$t1 -v b=$t2 'BEGIN{printf "%.2f", d/(b-a)}')/s"
i=$((i+1))
done
echo "GIC121DONE"
+42
View File
@@ -0,0 +1,42 @@
"""Summarize one UI-run CSV: stats samples per action and overall (python3 -I summarize.py FILE...)."""
import csv
import statistics
import sys
def num(v):
try:
return float(v)
except (TypeError, ValueError):
return None
def summarize(path):
rows = list(csv.DictReader(open(path, encoding="ascii")))
ok = [r for r in rows if num(r["render_ms"]) is not None and num(r["render_max_ms"]) is not None]
busy = [r for r in ok if (num(r["fps"]) or 0) > 0]
rmax = [num(r["render_max_ms"]) for r in ok]
rms = [num(r["render_ms"]) for r in busy]
fps = [num(r["fps"]) for r in busy]
out = {
"file": path,
"samples": len(rows),
"parsed": len(ok),
"busy_windows": len(busy),
"fps_mean": round(statistics.mean(fps), 2) if fps else None,
"render_ms_mean_busy": round(statistics.mean(rms), 3) if rms else None,
"render_ms_p95_busy": round(sorted(rms)[int(0.95 * (len(rms) - 1))], 3) if rms else None,
"render_max_ms_max": round(max(rmax), 2) if rmax else None,
"render_max_ms_p95": round(sorted(rmax)[int(0.95 * (len(rmax) - 1))], 2) if rmax else None,
"render_max_ms_mean": round(statistics.mean(rmax), 3) if rmax else None,
}
per = {}
for r in ok:
per.setdefault(r["action"], []).append(num(r["render_max_ms"]))
out["render_max_by_action"] = {a: round(max(v), 2) for a, v in per.items()}
return out
if __name__ == "__main__":
for p in sys.argv[1:]:
print(summarize(p))
+27
View File
@@ -0,0 +1,27 @@
#!/bin/sh
# uirun.sh LABEL SECONDS: fixed UI workload for SECONDS. Each action is followed by one stats read.
LABEL=$1; DUR=$2
OUT=/tmp/vop-ui-$LABEL.csv; LOG=/tmp/vop-ui-$LABEL.log
ui() { rm -f /tmp/warden-ui.dbg; printf '%s\n' "$1" > /tmp/warden-ui.ctl; n=0; while [ ! -s /tmp/warden-ui.dbg ] && [ $n -lt 100 ]; do sleep 0.05; n=$((n+1)); done; cat /tmp/warden-ui.dbg 2>/dev/null; }
key() { printf '%s\n' "$1" | awk -F': ' -v k="$2" '$1==k {print $2; exit}' | awk '{print $1}' | tr -d '%'; }
pid0=$(pidof warden-ui 2>/dev/null); echo "start uptime=$(cut -d' ' -f1 /proc/uptime) warden-ui=$pid0" > $LOG
dmesg | grep -i -E 'ddr|axi|vop|rga|error|fail|underflow|oops|bug|warn|timeout' | wc -l > /tmp/vop-dmesg-$LABEL.before
echo "uptime_s,action,reply1,page,cpu,fps,render_ms,render_max_ms,idle,memavail_kb" > $OUT
start=$(cut -d' ' -f1 /proc/uptime); cycles=0
while :; do
now=$(cut -d' ' -f1 /proc/uptime)
done_=$(awk -v a=$start -v b=$now -v d=$DUR 'BEGIN{print (b-a>=d)?1:0}')
[ "$done_" = 1 ] && break
for act in "wake" "nav settings/system" "scroll 360 300 300" "scroll 360 300 -300" "home"; do
r1=$(ui "$act" | head -1 | tr ',' ';')
sleep 1.2
s=$(ui stats)
page=$(key "$s" page); cpu=$(key "$s" cpu); fps=$(key "$s" fps); rms=$(key "$s" render); rmax=$(key "$s" render_max); idle=$(key "$s" idle); mem=$(key "$s" memavail)
echo "$(cut -d' ' -f1 /proc/uptime),$act,$r1,$page,$cpu,$fps,$rms,$rmax,$idle,$mem" >> $OUT
sleep 0.3
done
cycles=$((cycles+1)); sleep 1
done
echo "end uptime=$(cut -d' ' -f1 /proc/uptime) warden-ui=$(pidof warden-ui 2>/dev/null) cycles=$cycles" >> $LOG
dmesg | grep -i -E 'ddr|axi|vop|rga|error|fail|underflow|oops|bug|warn|timeout' | wc -l > /tmp/vop-dmesg-$LABEL.after
echo "DONE $LABEL" >> $LOG
+23
View File
@@ -0,0 +1,23 @@
#!/bin/sh
# vopcheck.sh MODE (candidate|baseline): read-only clock plan and eth0 check on a bench panel.
MODE=${1:-candidate}
CS=/sys/kernel/debug/clk/clk_summary
rate() { awk -v n="$1" '$1==n {print $5; exit}' $CS; }
fail=0
chk() { if [ "$3" = "$2" ]; then echo "PASS $1 = $3"; else echo "FAIL $1 = $3 (want $2)"; fail=1; fi; }
if [ "$MODE" = candidate ]; then
chk pll_cpll 900000000 "$(rate pll_cpll)"
chk dclk_vop_src 30000000 "$(rate dclk_vop_src)"
chk dclk_vop 30000000 "$(rate dclk_vop)"
chk clk_50m_src 50000000 "$(rate clk_50m_src)"
chk clk_100m_src 100000000 "$(rate clk_100m_src)"
chk aclk_ddr_root 450000000 "$(rate aclk_ddr_root)"
chk clk_250m_src 225000000 "$(rate clk_250m_src)"
else
chk pll_cpll 1000000000 "$(rate pll_cpll)"
chk dclk_vop 31250000 "$(rate dclk_vop)"
fi
carrier=$(cat /sys/class/net/eth0/carrier 2>/dev/null)
if [ "$carrier" = 1 ]; then echo "PASS eth0 carrier=1 speed=$(cat /sys/class/net/eth0/speed 2>/dev/null)"; else echo "FAIL eth0 carrier=$carrier"; fail=1; fi
echo "VOPCHECK mode=$MODE release=$(sed -n 's/.*GIT_COMMIT=\([^ ]*\).*/\1/p' /etc/warden-release) rc=$fail"
exit $fail