New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
malta: Support kernel 6.6 and fix kernel_bump.sh script #15215
Conversation
ec5f4c6
to
0f650d9
Compare
Added commit to revert mips64 breakage due to c5dee97. See commit comments for more information. |
This patch fixes the broken detect_memory_region() function on 6.6 kernel. Signed-off-by: Shiji Yang <yangshiji66@qq.com>
@guidosarducci Has the revert been tested not to break other targets? |
@robimarko I tested that both The original commit was part of #14774 (you asked about it too) and targets I would be fine with merging the malta update separately from dealing with this revert. |
The mentioned patch also targets ath79 see #14880. |
void __init detect_memory_region(phys_addr_t start, phys_addr_t sz_min, phys_addr_t sz_max) | ||
{ | ||
- void *dm = &detect_magic; | ||
+ void *dm = (void *)KSEG1ADDR(&detect_magic); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@namiltd Hi! Could you help test if changing this line to void *dm = &detect_magic;
can work on your MT7620 device? I don't have Linux build environment recently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, after this change, RAM size detection does not work correctly:
total used free shared buff/cache available
Mem: 251372 21644 205884 232 23844 193116
Swap: 0 0 0
instead of:
total used free shared buff/cache available
Mem: 56636 20804 11224 232 24608 11856
Swap: 0 0 0
This router only has 64MB RAM, but it incorrectly detects 256MB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the patch so complicated to begin with and lack a description of how/why it should work? Why does it write when the original code doesn't?
@namiltd Maybe try replacing the whole patch with something simpler:
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -103,7 +103,7 @@
phys_addr_t size;
for (size = sz_min; size < sz_max; size <<= 1) {
- if (!memcmp(dm, dm + size, sizeof(detect_magic)))
+ if (*(long *)(dm) != *(volatile long __force *)(dm + size))
break;
}
This at least compiles on 32-bit and 64-bit mips malta...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch (https://github.com/openwrt/openwrt/blob/main/target/linux/generic/pending-6.6/350-mips-kernel-fix-detect_memory_region-function.patch) was not caused by compilation errors, but because the router stopped during startup and displayed the following message:
[ 0.000000] Linux 6.6.20 (builder@buildhost) (mipsel-openwrt-linux-musl-gcc (OpenWrt GCC 12.3.0 r25430-eb44f39e39) 12.3.0, GNU ld (GNU Binutils) 2.40.0) Mar 6 11:40:57 2024
[ 0.000000] Board has DDR2
[ 0.000000] Analog PMU set to hw control
[ 0.000000] Digital PMU set to hw control
[ 0.000000] SoC Type: MediaTek MT7620A ver:2 eco:6
[ 0.000000] printk: bootconsole [early0] enabled
[ 0.000000] CPU0 revision is: 00019650 (MIPS 24KEc)
[ 0.000000] MIPS: machine is TP-Link Archer C5 v4
[ 0.000000] detected buffer overflow in memcmp
@PolynomialDivision Yes, I'm aware. The upstream Linux patch history showed the reverted code was borrowed from existing ath79 implementation in 4d9f77d25268 ("MIPS: add detect_memory_region()") by @blogic . That doesn't really change anything however: the commit is still written for 32-bit only and thus wasn't well-tested, hasn't been reviewed upstream, and breaks mips64. I assumed reverting this would be straightforward given the above but apparently not. Since I intended this PR to push along the stalled malta kernel 6.6 support rather than tangential development, maybe it's better to drop the revert and let any further testing/development continue in the original commit/PR by the folks involved. |
350-mips-kernel-fix-detect_memory_region-function.patch e.g.:
|
@namiltd That seems very kludgy and it's difficult to see it being accepted upstream. The minimal patch I posted above has the original Could you try it on your device if you have a chance? i.e. just replace
@DragonBluep Are you able to ping/bump your patch on the |
0f650d9
to
f919520
Compare
I've dropped the revert of c5dee97 as mentioned in #15215 (comment). That can be dealt with separately/in the the original PR. @PolynomialDivision @robimarko @hauke It should be OK to merge this or incorporate needed changes into #14891, if you'd care to have a look. Thanks... |
@guidosarducci I don't have physical access to the mt7620 router for the next two weeks, so I won't test it. I took the risk of updating remotely and unfortunately the router did not get up after the update. That's all I can say without having physical access to it. On site, the network was connected to another router and I will restore it to the previous version at a later date. |
@namiltd Would you clarify if it was a "regular" update that failed to boot, or one with the last patch I posted? Timing of your post and then edit was a little confusing... |
@namiltd @guidosarducci A workaround for mips64 ARCH: |
Text of a commit message body should wrap at 75 characters. Manual commits are expected to do so, but automated commits *must* do so to avoid adding repeated ugly commits. Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
This is an automatically generated commit. When doing `git bisect`, consider `git bisect --skip`. Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
This is an automatically generated commit which aids following Kernel patch history, as git will see the move and copy as a rename thus defeating the purpose. For the original discussion see: https://lists.openwrt.org/pipermail/openwrt-devel/2023-October/041673.html Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
This refreshes the configuration on top of kernel 6.6 and activates it as test kernel configuration. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
f919520
to
a638d01
Compare
Thank you for taking car of this PR and sorry for the delay. |
Adding kernel 6.6 support for malta has been tested and pending for more over a month in PR #14891 , but merging appears to be stalled. I've added this PR to tackle possibly outstanding issues and hopefully encourage some progress.
Additional changes from #14891 include:
scripts/kernel_bump.sh
while adding malta 6.6 support to preserve history.scripts/kernel_bump.sh
to generate commit text with correct word-wrapping.@robimarko @PolynomialDivision @Ansuel @hauke Please feel free to pull anything needed from here into #14891, or simply merge this as is, or comment on further changes needed. I deferred my own malta/6.6 update expecting #14891 would be merged quickly, and would like to move things along since having 6.6 support helps with my upstream kernel work.