U-Boot: enable CMD_MEMTEST and validate the 3.5 GiB DRAM geometry before upstreaming #38
Labels
No labels
blocked-physical
cleanup
hardware
infra
kernel
P1-critical
P2-high
P3-normal
P4-later
reliability
security
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
tiagoagueda/a80#38
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The DRAM geometry change that unlocked 3.5 GiB has never been validated beyond "Linux
boots and reports the right size", and the patch is queued to go to a mailing list.
What changed
Per 22-dram-4gb.md,
rank1 -> 2 androws16 -> 15, taking usablememory from 2011 MB to 3471 MB.
patches/uboot-sun9i-dram/is staged foru-boot@lists.denx.de per patches/README.md.
Why "it boots" is not enough
Wrong DRAM geometry does not fail at boot. It fails as address aliasing under memory
pressure — silent corruption, hours later, in whatever the board happens to be running.
A 3.5 GiB box that has mostly been idle is exactly the case where that would not have
been noticed yet.
There is also a hint in the vendor boot0 output already captured in
logs/uboot-interrupt.log:
Change
mtestat the U-Boot prompt walks the full range with no OS in the way — the cheapestpossible check, and the right place for it since the claim being tested is a
bootloader-level one.
Also worth running
memtesterfrom Linux userspace over a large allocation, as a second opinion underreal conditions (cache, DVFS, thermals). The two are complementary:
mtestcovers thefull range,
memtestercovers realistic access patterns.Acceptance
mtestpass across all 3.5 GiB, clean.what was actually verified rather than implying it.
Blocks: sending
uboot-sun9i-dramupstream.More useful than when this was filed, 2026-08-28. A whole day went into #53, a
memory-corruption bug, and one of the things that made it slow was having no way to exercise
DRAM outside Linux.
CMD_MEMTESTwould have given a check that runs before any of thescheduler, cache or cluster complexity exists.
It would also have settled the DRAM question directly.
CONFIG_DRAM_CLKwas changed 672 -> 600and
CONFIG_DRAM_ZQto this board's own value, and neither moved the failure rate at all -but that took a kernel-side test each time, with a bootloader flash and a reboot per data
point. A U-Boot memtest is the right instrument for that and it is a config symbol.
Note the DRAM geometry validation part of this issue is now more interesting too: the settings
in use are this board's own (
dram_clk = 600,dram_zq = 0x3b3bbb) rather than the A80Optimus values inherited before, so anything measured now measures the intended configuration.
Done 2026-08-29. Both acceptance criteria met; recorded in
22-dram-4gb.md.The geometry, stated by the bootloader
bdinfo, with no OS in the way:One bank,
0xe0000000= 3584 MiB. That is what theuboot-sun9i-drampatch claims, nowasserted by U-Boot itself rather than inferred from what Linux later reports.
Full-range mtest, clean
3503 MiB, zero errors, with
SYS_ALT_MEMTESTandSYS_ALT_MEMTEST_BITFLIPso it includesthe address-line walk - the part that actually catches aliasing.
One run, deliberately. Chunking it would have been worthless: the address-line walk covers
the range it is given, so an alias between two chunks is invisible if they are tested
separately, and aliasing is the whole failure mode this issue is about.
⚠️ Stop the watchdogs first
The first attempt reset the board ~45 minutes in - no error line, no
Testedline, nopstorerecord, just an SPL banner. That was our own watchdog from #34. The mechanism isin
cmd/mem.c:compare_regions()has noschedule()at all, so one pass over a large region blows throughthe 16 s timeout. At 256 MiB it stays under; at 3503 MiB it does not.
CONFIG_CMD_WDT, fromthe same series, is what lets you stop them:
Probably worth reporting upstream - a command that runs for minutes without servicing the
watchdog - but it is our config that exposes it. Also
setenv bootretry -1first, or #35boots the board out from under the session; it fired the instant the test finished.
Measured, not assumed
the first failure was a reset, not a slowdown.
extrapolated from the small run was wrong; nothing depends on it, but do not plan against it.
Not covered
The range stops at
0xfaf5c000because U-Boot reserves everything above for itself, so thetop 81 MiB is untested. That needs the Linux-side
memtestersecond opinion this issue alsosuggests, and
memtesteris not installed on the board. Raising it as its own item ratherthan holding this open, since the bootloader-level claim - the one that blocked
uboot-sun9i-dram- is now verified.Unblocks: sending
uboot-sun9i-dramupstream, which can now say what was actually tested.