[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210416185139.GA42339@roeck-us.net>
Date: Fri, 16 Apr 2021 11:51:39 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Alexandre Ghiti <alex@...ti.fr>
Cc: Jonathan Corbet <corbet@....net>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Arnd Bergmann <arnd@...db.de>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>, linux-doc@...r.kernel.org,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
kasan-dev@...glegroups.com, linux-arch@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH v4 1/3] riscv: Move kernel mapping outside of linear
mapping
On Fri, Apr 09, 2021 at 02:14:58AM -0400, Alexandre Ghiti wrote:
> This is a preparatory patch for relocatable kernel and sv48 support.
>
> The kernel used to be linked at PAGE_OFFSET address therefore we could use
> the linear mapping for the kernel mapping. But the relocated kernel base
> address will be different from PAGE_OFFSET and since in the linear mapping,
> two different virtual addresses cannot point to the same physical address,
> the kernel mapping needs to lie outside the linear mapping so that we don't
> have to copy it at the same physical offset.
>
> The kernel mapping is moved to the last 2GB of the address space, BPF
> is now always after the kernel and modules use the 2GB memory range right
> before the kernel, so BPF and modules regions do not overlap. KASLR
> implementation will simply have to move the kernel in the last 2GB range
> and just take care of leaving enough space for BPF.
>
> In addition, by moving the kernel to the end of the address space, both
> sv39 and sv48 kernels will be exactly the same without needing to be
> relocated at runtime.
>
> Suggested-by: Arnd Bergmann <arnd@...db.de>
> Signed-off-by: Alexandre Ghiti <alex@...ti.fr>
In next-20210416, when booting a riscv32 image in qemu, this patch results in:
[ 0.000000] Linux version 5.12.0-rc7-next-20210416 (groeck@...ktop) (riscv32-linux-gcc (GCC) 10.3.0, GNU ld (GNU Binutils) 2.36.1) #1 SMP Fri Apr 16 10:38:09 PDT 2021
[ 0.000000] OF: fdt: Ignoring memory block 0x80000000 - 0xa0000000
[ 0.000000] Machine model: riscv-virtio,qemu
[ 0.000000] earlycon: uart8250 at MMIO 0x10000000 (options '115200')
[ 0.000000] printk: bootconsole [uart8250] enabled
[ 0.000000] efi: UEFI not found.
[ 0.000000] Kernel panic - not syncing: init_resources: Failed to allocate 160 bytes
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.12.0-rc7-next-20210416 #1
[ 0.000000] Hardware name: riscv-virtio,qemu (DT)
[ 0.000000] Call Trace:
[ 0.000000] [<80005292>] walk_stackframe+0x0/0xce
[ 0.000000] [<809f4db8>] dump_backtrace+0x38/0x46
[ 0.000000] [<809f4dd4>] show_stack+0xe/0x16
[ 0.000000] [<809ff1d0>] dump_stack+0x92/0xc6
[ 0.000000] [<809f4fee>] panic+0x10a/0x2d8
[ 0.000000] [<80c02b24>] setup_arch+0x2a0/0x4ea
[ 0.000000] [<80c006b0>] start_kernel+0x90/0x628
[ 0.000000] ---[ end Kernel panic - not syncing: init_resources: Failed to allocate 160 bytes ]---
Reverting it fixes the problem. I understand that the version in -next is
different to this version of the patch, but I also tried v4 and it still
crashes with the same error message.
Guenter
Powered by blists - more mailing lists