Repository navigation
ramips: mt7620: fix direct call failures - #24723
dormancygrace wants to merge 1 commit into
Conversation
openwrt-ai
left a comment
There was a problem hiding this comment.
Reviewed 2 commits (fresh review). Both commit messages match their diffs, including the documented 821-SPI-ralink-add-Ralink-SoC-spi-driver.patch offset refresh.
Verified locally against gregkh/linux v6.18.44: both new patches and the refreshed 821 apply with zero fuzz and zero offset (patch -p1 -F0), the 128 → 132 offset bump is exactly the 4 lines 334 adds to drivers/spi/Makefile, mix_pool_bytes()'s signature matches the mix_pool_t typedef so the uncast assignment is well-typed, and all direct callers of spi_finalize_current_message() and udp6_ehashfn() reachable in a ramips build live inside spi.o / net/ipv6/udp.o respectively — so the per-object -mlong-calls scope does cover the reported call sites. CONFIG_NET_RALINK_MT7620 is set only in target/linux/ramips/mt7620/config-6.18, matching the existing 330–332 guard convention.
Remaining comments are inline and mostly patch hygiene, plus one question about whether 333's #ifdef blocks could be replaced by the same per-object -mlong-calls mechanism 334 introduces.
Generated by Claude Code
f27b418 to
0391d1f
Compare
|
Addressed the new Formality suggestions. Both embedded kernel patches now carry complete |
215b496 to
6d8dc16
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Re-reviewed after the rework from #ifdef-based function-pointer indirection to per-object -mlong-calls. The new form is much cleaner; the remaining points are one commit-message inaccuracy and two nits.
Commit checks
- 269c3f1 "ramips: mt7620: avoid direct jal in entropy bootstrap" — the message opens with "Linux 6.18 introduced direct calls to
mix_pool_bytes()in the timer entropy bootstrap", but those call sites are not new in 6.18.try_to_generate_entropy()has the same two direct calls in 6.12:random.c:1339and:1343(v6.12.103), matchingrandom.c:1344and:1348(v6.18.44) — in fact the full set ofmix_pool_bytes()/_mix_pool_bytes()call sites inrandom.cis identical between the two trees. What 6.18 changed is the resulting layout/codegen, not the source. Worth rewording (e.g. "Linux 6.18 codegen places these calls out ofjalrange" / "exposed") so nobody goes hunting for a 6.18 commit that doesn't exist. The embedded patch's own wording — "Linux 6.18 callsmix_pool_bytes()directly from the timer-based entropy bootstrap" — is accurate and needs no change. 6d8dc16's message matches its diff, including the documented 821 offset refresh.
Verified against gregkh/linux v6.18.44: 333, 334 and the refreshed 821 apply in that order with zero fuzz and zero offset (patch -p1 -F0); the @@ -128 → @@ -132 bump is exactly the four lines 334 adds to drivers/spi/Makefile. -mlong-calls is effective here because MIPS kernels build with -mno-abicalls -fno-pic (arch/mips/Makefile:97) — GCC documents the option as a no-op for abicalls code. The per-object scope still covers the reported sites in a mt7620 build: the only in-build direct callers of spi_finalize_current_message() live in spi.c itself (CONFIG_SPI_RT2880's spi-rt2880.c never calls it, nor does spi-mem.c), and udp6_ehashfn()'s only non-udp.c reference is the INDIRECT_CALL_INET() in inet6_hashtables.c:141, which without CONFIG_MITIGATION_RETPOLINE (unavailable on MIPS) expands to a real indirect call. CONFIG_IPV6 resolves to y via KERNEL_IPV6 in config/Config-kernel.in, so net/ipv6/udp.o is built-in and not already covered by KBUILD_CFLAGS_MODULE += -mlong-calls. Patch numbers 333/334 are free and sit correctly next to the existing 330–332 MT7620 workarounds. CI on the head commit reports nothing failed.
Generated by Claude Code
6d8dc16 to
049557d
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Re-reviewed the fold of 333+334 into a single 333-mt7620-use-long-calls.patch. The change since my last review is structural only — same twelve added lines, same three Makefiles — and the two substantive points from last round are resolved: the "Linux 6.18 introduced direct calls to mix_pool_bytes()" claim is gone (the new message correctly says 6.18 codegen/layout exposed the failures), and the SPI hunk now sits above the upstream comment block it was splitting. Only two nits left, both inline.
Verified against gregkh/linux v6.18.44: 333 and the refreshed 821 apply in that order with zero fuzz and zero offset (patch -p1 -F0), and the @@ -128 → @@ -132 bump in 821 is exactly the four lines 333 now adds to drivers/spi/Makefile — the refresh stays correct after the fold, since the insertion count is unchanged and 333 still sorts before 821. All three hunk headers are internally consistent (@@ -3,6 +3,10 @@ / @@ -5,6 +5,10 @@ ×2) and the diffstat "3 files changed, 12 insertions(+)" matches. No other patch in target/linux/ramips/patches-6.18/ or target/linux/generic/{backport,pending,hack}-6.18/ touches drivers/char/Makefile, drivers/spi/Makefile or net/ipv6/Makefile, so nothing else needs a refresh. Patch number 334 is now free and unreferenced. CONFIG_NET_RALINK_MT7620=y only in target/linux/ramips/mt7620/config-6.18 (explicitly is not set in mt76x8), matching the 330–332 guard convention, and KERNEL_PATCHVER:=6.18 is the only patch series in this target, so there is no 6.12 parity gap. CI on the head commit is green, including Check Kernel patches (ramips, mt7620) and the mt7620 kernel build.
Generated by Claude Code
049557d to
c872b92
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Re-reviewed the single new revision (049557d → c872b92). The only change is whitespace: CFLAGS_random.o went from two tabs to three, and CFLAGS_udp.o from three tabs to a single space — both exactly as requested last round, and both now correct. The patch payload is otherwise byte-identical, so the hardware and build results carry over unchanged.
The From <sha> Mon Sep 17 00:00:00 2001 envelope point is settled: your reasoning (siblings 330–332 use the same bare From: form, FormalityCheck / Code Patches is green, and a fabricated object id would be misleading) is sound, and I won't raise it again.
Re-verified against gregkh/linux v6.18.44 at this head: 333 and the refreshed 821 apply in that order with zero fuzz and zero offset (patch -p1 -F0); the diffstat "3 files changed, 12 insertions(+)" still matches the three 4-line hunks; and the @@ -128 → @@ -132 bump in 821 remains exactly the four lines 333 adds to drivers/spi/Makefile. CI on c872b92 is fully green — Check Kernel patches (ramips, mt7620), all five ramips subtarget kernel builds, and all three FormalityCheck runs. The commit message matches its diff, including the documented 821 offset refresh.
One cosmetic nit remains, inline — and it is a correction of something I got wrong last round rather than a new request.
Generated by Claude Code
c872b92 to
6cf6354
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Re-reviewed c872b921 → 6cf6354b. The two commits are content-identical: same tree 59ee5947835a18826b0452dd65df4543bf31b69d, same parent f6bc2a3b294b3d6b298cf5a625e9923459d64edd, same message — only the committer date moved (2026-08-15 16:29:02 → 2026-08-16 07:55:52). git diff c872b921..6cf6354b is empty.
That means the one open nit from last round is still open: CFLAGS_spi.o in the embedded patch remains at three tabs, not four. Details inline. Nothing else changed, so the previous verification carries over unaltered — 333 and the refreshed 821 still apply against gregkh/linux v6.18.44 in order with zero fuzz and zero offset, the @@ -128 → @@ -132 bump still matches the four lines 333 adds to drivers/spi/Makefile, and the diffstat still matches the three 4-line hunks.
CI on 6cf6354b is green: Check Kernel patches (ramips, mt7620), all five ramips subtarget kernel builds, and all three FormalityCheck runs. The commit message matches its diff, including the documented 821 offset refresh. The From <sha> envelope question stays settled as agreed — not raising it again.
Generated by Claude Code
6cf6354 to
15ac158
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Re-reviewed 6cf6354b → 15ac158a. The only change is the whitespace fix left open last round: CFLAGS_spi.o in the embedded patch went from three tabs to four, which aligns its += to column 40 to match obj-$(CONFIG_SPI_MASTER) in drivers/spi/Makefile. That was the last open nit, and it is now correct. The other two objects were already right and are unchanged — CFLAGS_random.o aligns to column 32 (matching obj-y / obj-$(CONFIG_TTY_PRINTK)), and CFLAGS_udp.o uses a single space to match its neighbour obj-$(CONFIG_IPV6) in net/ipv6/Makefile. The commit message and the rest of the patch payload are byte-identical to the previous revision, so the earlier build/hardware verification carries over.
CI on 15ac158a is green: all five ramips subtarget kernel builds, Check Kernel patches (ramips, mt7620), and all three FormalityCheck runs (Git & Commits, Code Patches, OpenWrt Makefiles). The commit message matches its diff, including the documented 821 offset refresh.
Reviewed 1 new commit; no new issues found.
Generated by Claude Code
15ac158 to
c1696ad
Compare
c1696ad to
4192393
Compare
MT7620 can sporadically execute direct J-type calls with an incorrect high address nibble. Linux 6.18 code generation and layout exposed failures in the entropy bootstrap, SPI core and IPv6 UDP code. Compile only random.o, spi.o and IPv6 udp.o with -mlong-calls. Applying the option globally was tested on MT7620N hardware and prevents PDMA from processing its first transmit descriptor. The targeted workaround boots and passes sustained bidirectional traffic while retaining the known-good frame-engine code generation. Keep the workaround in one kernel patch because all three objects address the same MT7620 direct-call failure mechanism. Refresh the SPI driver patch offset after adding four lines to drivers/spi/Makefile. Link: openwrt#20553 Signed-off-by: Gleb Pesin <[email protected]> Assisted-by: Codex:gpt-6.1-sol
4192393 to
2c60dec
Compare
|
Closing in favor of #26650, which works around the MIPS 24K EPC erratum by keeping executable kernel and module code out of the affected address ranges. I tested the kernel padding change on a Zbtlink WE826-T2 (MT7620A) with the entropy, SPI, and IPv6 UDP workarounds from this PR removed. Both GCC 14.4 and 16.2 builds booted and passed the SPI read and bidirectional IPv6 UDP tests without an oops or panic. The test results are in #26650. |
Summary
Fix three MT7620 direct-call failures observed after moving the target to Linux 6.18:
jaltomix_pool_bytes()with the wrong high address nibble and crash during early boot;spi_finalize_current_message()andudp6_ehashfn()can fail for the same reason later in boot or under network activity.Compile only
random.o, the SPI corespi.o, and the IPv6udp.owith-mlong-callson MT7620. This covers every direct call in the affected objects without carrying target-specific function-pointer indirection in generic random code.Applying
-mlong-callsglobally is deliberately avoided: on tested MT7620N hardware it changes frame-engine code generation enough to leave PDMA stuck on the first TX descriptor.Build and static verification
random.o,spi.o, and IPv6udp.owere inspected withreadelf -rWandobjdump -dr;mix_pool_bytes,spi_finalize_current_message, and external calls toudp6_ehashfnuse full-addressHI16/LO16relocations followed byjalr; none uses a directR_MIPS_26relocation to the target function.Hardware testing
The same object-level fix was built for Linux 6.12.94 with GCC 16.2 and tested on a D-Link DWR-921 C3 (MT7620N rev 2 eco 6, 64 MiB RAM).
It reached userspace and passed concurrent stress consisting of:
/dev/urandom;The kernel log contained no panic, Oops, reserved instruction, call trace, page fault, or unaligned-access report. The normal flash boot also completed with Ethernet, DSA, PPE, SPI, IPv6 and CRNG initialization intact. These runtime tests predate the rebase.
Related: #20553
Extracted from: #24493