From b7dba89d63193a4412791715347dad176f71f944 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Wed, 10 Jul 2024 18:04:11 +0200 Subject: [PATCH] Reduce RAM to 768 MiB to avoid a memory problem --- JOURNAL.md | 23 +++++++++++++++++++++++ lagarto-ox.nix | 25 +++++++++++++------------ ox-plic.dts | 7 ++++--- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/JOURNAL.md b/JOURNAL.md index 84245af..1c4e949 100644 --- a/JOURNAL.md +++ b/JOURNAL.md @@ -1206,3 +1206,26 @@ the actual physical memory. I will try a similar test with uboot with the `mtest` command, but requires enabling it first. + +### OBSERVATION: Memory in the 0xb0000000..0xc0000000 range is bad + +Reproduced from U-Boot: + + => mtest 0x80000000 0x90000000 0 2 + Testing 80000000 ... 90000000: + Pattern FFFFFFFFFFFFFFFF Writing... Reading...Iteration: 2 + Tested 2 iteration(s) with 0 errors. + => mtest 0x90000000 0xa0000000 0 2 + Testing 90000000 ... a0000000: + Pattern FFFFFFFFFFFFFFFF Writing... Reading...Iteration: 2 + Tested 2 iteration(s) with 0 errors. + => mtest 0xa0000000 0xb0000000 0 2 + Testing a0000000 ... b0000000: + Pattern FFFFFFFFFFFFFFFF Writing... Reading...Iteration: 2 + Tested 2 iteration(s) with 0 errors. + => mtest 0xb0000000 0xc0000000 0 2 + Testing b0000000 ... c0000000: + Pattern 0000000000000000 Writing... + +Let's see if we can fix the boot hang by reducing the memory enough to avoid +this bad region. diff --git a/lagarto-ox.nix b/lagarto-ox.nix index f9208ca..568d349 100644 --- a/lagarto-ox.nix +++ b/lagarto-ox.nix @@ -132,17 +132,17 @@ '' echo 0 > /proc/sys/vm/compaction_proactiveness '' - + - # Show stacktrace on calls to the hvc_remove function. - '' - echo "Mount debugfs" - mkdir -p /sys/kernel/debug/ - mount -t debugfs none /sys/kernel/debug/ - td=/sys/kernel/debug/tracing - echo hvc_remove > $td/set_ftrace_filter - echo function > $td/current_tracer - echo 1 > $td/options/func_stack_trace - '' +# + +# # Show stacktrace on calls to the hvc_remove function. +# '' +# echo "Mount debugfs" +# mkdir -p /sys/kernel/debug/ +# mount -t debugfs none /sys/kernel/debug/ +# td=/sys/kernel/debug/tracing +# echo hvc_remove > $td/set_ftrace_filter +# echo function > $td/current_tracer +# echo 1 > $td/options/func_stack_trace +# '' # FIXME: Disable sched_switch for now, as it still hangs the boot... # + # # Exclude the second pid, which is the kthread that will dump the trace to @@ -288,6 +288,7 @@ fdt set /memory@80000000 reg <0x0 0x80000000 0x0 0xc0000000> # Set kernel bootcmd options. + # rdinit=/init2 boot custom init script # NixOS interesting options: # debug1 enable debug shell in stage 1 # boot.trace enable set -x in stage 1 @@ -298,7 +299,7 @@ # tp_printk write ftrace events to console # trace_buf_size=1M set ftrace buffer to 1M # - setenv bootargs "root=/dev/ram0 loglevel=7 debug rw earlycon=sbi console=hvc0 tp_printk trace_buf_size=1M rdinit=/init2 init=${init}" + setenv bootargs "root=/dev/ram0 loglevel=7 debug rw earlycon=sbi console=hvc0 init=${init}" EOF diff --git a/ox-plic.dts b/ox-plic.dts index 3bc0e47..e7e9249 100644 --- a/ox-plic.dts +++ b/ox-plic.dts @@ -70,14 +70,15 @@ * * [0x0_6000_0000, 0x0_7000_0000) -> DMA pool (256 MiB) * [0x0_7000_0000, 0x0_8000_0000) -> DMA pool (256 MiB) - * [0x0_8000_0000, 0x0_fff0_0000) -> RAM memory (1024 MiB) - * [0x0_fff0_0000, 0x1_0000_0000) -> Empty (1024 MiB) + * [0x0_8000_0000, 0x0_b000_0000) -> RAM memory (768 MiB) + * [0x0_b000_0000, 0x0_c000_0000) -> Broken? (256 MiB) + * [0x0_c000_0000, 0x1_0000_0000) -> Empty (1024 MiB) * [0x1_0000_0000, 0x1_c000_0000) -> PMEM (3072 MiB) * [0x1_c000_0000, 0x2_8000_0000) -> Empty (3072 MiB) */ memory@80000000 { device_type = "memory"; - reg = <0x0 0x80000000 0x0 0x40000000>; + reg = <0x0 0x80000000 0x0 0x30000000>; }; reserved-memory { #address-cells = <2>; /* Starting address and size */