Re: [PATCH 3/3] RISC-V: Allow booting kernel from any 4KB aligned address

From: Paul Walmsley
Date: Mon Mar 18 2019 - 12:12:59 EST


On Mon, 18 Mar 2019, Mike Rapoport wrote:

> On Sat, Mar 16, 2019 at 04:55:30AM +0530, Anup Patel wrote:
>
> > We started exploring ways to re-claim memory below kernel because
> > we are trying to get Linux working on Kendryte K210 board
> > (https://kendryte.com/). This board has dual-core 64bit RISC-V but it
> > only has 8MB RAM.
>
> Huh, 8MB of RAM is tough...
>
> It is possible to use the memory below the kernel, e.g x86-64 does that.
> But it is definitely a separate change and with such RAM diet using 4K
> pages seems unavoidable.
>
> I still have concern about using 4K pages whenever the load address is not
> 2M (4M) aligned. People tend to not pay enough attention to such details
> and they would load the kernel at an arbitrary address and get the
> performance hit.
>
> I think the default should remain as is and the ability to map the kernel
> with 4K pages (and use 4K aligned load address) should be a Kconfig option.

Agreed. That Kconfig parameter should also be default-off.

Only a small number of people will try to run RISC-V Linux on a Kendryte
board. That niche use-case shouldn't impact the much larger group of
people who will run Linux on more reasonably-sized systems. No one should
need to ask people to report their kernel load address whenever someone
reports a performance regression.


- Paul