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

2019-03-28 Thread Anthony Coulter
If your goal is to be able to boot from any 4k-aligned address, then disallowing boots between PAGE_OFFSET and PAGE_OFSSET + vmlinux_size seems counterproductive, since there are a lot of 4k-aligned addresses in that range that are now disallowed. (And worse, the specific range of disallowed

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

2019-03-28 Thread Anup Patel
On Thu, Mar 28, 2019 at 3:22 PM Anup Patel wrote: > > On Thu, Mar 28, 2019 at 1:25 PM Mike Rapoport wrote: > > > > On Wed, Mar 27, 2019 at 12:54:41AM -0700, Christoph Hellwig wrote: > > > On Mon, Mar 25, 2019 at 09:46:59PM +0530, Anup Patel wrote: > > > > > Why do you even care about kernel

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

2019-03-28 Thread Anup Patel
On Thu, Mar 28, 2019 at 1:25 PM Mike Rapoport wrote: > > On Wed, Mar 27, 2019 at 12:54:41AM -0700, Christoph Hellwig wrote: > > On Mon, Mar 25, 2019 at 09:46:59PM +0530, Anup Patel wrote: > > > > Why do you even care about kernel mappings for non-existant ram. > > > > > > We care because there

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

2019-03-28 Thread Mike Rapoport
On Wed, Mar 27, 2019 at 12:54:41AM -0700, Christoph Hellwig wrote: > On Mon, Mar 25, 2019 at 09:46:59PM +0530, Anup Patel wrote: > > > Why do you even care about kernel mappings for non-existant ram. > > > > We care because there will always be some buggy kernel driver/code going > > out-of-bound

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

2019-03-27 Thread Christoph Hellwig
On Mon, Mar 25, 2019 at 09:46:59PM +0530, Anup Patel wrote: > > Why do you even care about kernel mappings for non-existant ram. > > We care because there will always be some buggy kernel driver/code going > out-of-bound and accessing non-existent RAM. If we by default map all > possible kernel

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

2019-03-25 Thread Anup Patel
On Mon, Mar 25, 2019 at 8:29 PM Christoph Hellwig wrote: > > On Mon, Mar 25, 2019 at 06:18:45PM +0530, Anup Patel wrote: > > We trying to addresses following issues in current code: > > 1. The current setup_vm() maps all possible kernel virtual addresses (128GB > > on 64bit system and 1GB on

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

2019-03-25 Thread Christoph Hellwig
On Mon, Mar 25, 2019 at 06:18:45PM +0530, Anup Patel wrote: > We trying to addresses following issues in current code: > 1. The current setup_vm() maps all possible kernel virtual addresses (128GB > on 64bit system and 1GB on 32bit system). The amount RAM present on > real systems might be much

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

2019-03-25 Thread Christoph Hellwig
On Mon, Mar 25, 2019 at 06:12:28PM +0530, Anup Patel wrote: > It uses new code for 2M mappings as well. That seems to be an odd view - yes some code is shared, but we still have two different ways using ifdefs. > The code is lot better, readable and flexible. better is in the eye of the

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

2019-03-25 Thread Anup Patel
On Mon, Mar 25, 2019 at 5:09 PM Christoph Hellwig wrote: > > I'm still not sold on this at all. It is a lot more code, a lot harder > to read code and all for a very narrow corner case that isn't even > going to be enabled in default configs. In case you missed my previous response about why

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

2019-03-25 Thread Anup Patel
On Mon, Mar 25, 2019 at 5:09 PM Christoph Hellwig wrote: > > I'm still not sold on this at all. It is a lot more code, a lot harder > to read code and all for a very narrow corner case that isn't even > going to be enabled in default configs. The old page table setup code does not exist

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

2019-03-25 Thread Christoph Hellwig
I'm still not sold on this at all. It is a lot more code, a lot harder to read code and all for a very narrow corner case that isn't even going to be enabled in default configs.

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

2019-03-25 Thread Anup Patel
Currently, we have to boot RISCV64 kernel from a 2MB aligned physical address and RISCV32 kernel from a 4MB aligned physical address. This constraint is because initial pagetable setup (i.e. setup_vm()) maps entire RAM using hugepages (i.e. 2MB for 3-level pagetable and 4MB for 2-level pagetable).