[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOnJCUKF-tfN-fHyRcjyAMnYVzQqp=_CLa2F4TQNO7jA4infoQ@mail.gmail.com>
Date: Fri, 17 Jul 2020 18:05:34 -0700
From: Atish Patra <atishp@...shpatra.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: Atish Patra <atish.patra@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Anup Patel <anup.patel@....com>,
Ard Biesheuvel <ardb@...nel.org>,
Greentime Hu <greentime.hu@...ive.com>,
Kees Cook <keescook@...omium.org>,
linux-efi <linux-efi@...r.kernel.org>,
linux-riscv <linux-riscv@...ts.infradead.org>,
Mark Rutland <mark.rutland@....com>,
Masahiro Yamada <masahiroy@...nel.org>,
Mike Rapoport <rppt@...ux.ibm.com>,
Palmer Dabbelt <palmer@...belt.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Will Deacon <will@...nel.org>, Zong Li <zong.li@...ive.com>,
Heinrich Schuchardt <xypron.glpk@....de>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [RFT PATCH v3 1/9] RISC-V: Move DT mapping outof fixmap
On Thu, Jul 16, 2020 at 11:32 PM Arnd Bergmann <arnd@...db.de> wrote:
>
> On Fri, Jul 17, 2020 at 1:41 AM Atish Patra <atish.patra@....com> wrote:
> >
> > From: Anup Patel <anup.patel@....com>
> >
> > Currently, RISC-V reserves 1MB of fixmap memory for device tree. However,
> > it maps only single PMD (2MB) space for fixmap which leaves only < 1MB space
> > left for other kernel features such as early ioremap which requires fixmap
> > as well. The fixmap size can be increased by another 2MB but it brings
> > additional complexity and changes the virtual memory layout as well.
> > If we require some additional feature requiring fixmap again, it has to be
> > moved again.
> >
> > Technically, DT doesn't need a fixmap as the memory occupied by the DT is
> > only used during boot. Thus, init memory section can be used for the same
> > purpose as well. This simplifies fixmap implementation.
> >
> > Signed-off-by: Anup Patel <anup.patel@....com>
> > Signed-off-by: Atish Patra <atish.patra@....com>
>
> The patch seems fine for the moment, but I have one concern for the
> long run:
>
> > +#define DTB_EARLY_SIZE SZ_1M
> > +static char early_dtb[DTB_EARLY_SIZE] __initdata;
>
> Hardcoding the size in .bss seems slightly problematic both for
> small and for big systems. On machines with very little memory,
> this can lead to running out of free pages before .initdata gets freed,
> and it increases the size of the uncompressed vmlinux file by quite
> a bit.
>
> On some systems, the 1MB limit may get too small. While most dtbs
> would fall into the range between 10KB and 100KB, it can also be
> much larger than that, e.g. when there are DT properties that include
> blobs like device firmware that gets loaded into hardware by a kernel
> driver.
>
I was not aware that we can do such things. Is there a current example of that ?
> Is there anything stopping you from parsing the FDT in its original
> location without the extra copy before it gets unflattened?
>
That's what the original code was doing. A fixmap entry was added to
map the original fdt
location to a virtual so that parse_dtb can be operated on a virtual
address. But we can't map
both FDT & early ioremap within a single PMD region( 2MB ). That's why
we removed the DT
mapping from the fixmap to .bss section. The other alternate option is
to increase the fixmap space to
4MB which seems more fragile.
> Arnd
--
Regards,
Atish
Powered by blists - more mailing lists