Re: [PATCH] x86, mm: Reserver some memory for bootmem allocator for NO_BOOTMEM

From: Feng Tang
Date: Mon Sep 17 2018 - 02:56:41 EST


Hi Thomas,

On Sun, Sep 16, 2018 at 11:06:41PM +0800, Feng Tang wrote:
> Hi Thomas,
>
> On Sun, Sep 16, 2018 at 04:43:55PM +0200, Thomas Gleixner wrote:
> > On Sun, 16 Sep 2018, Feng Tang wrote:
> > > diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
> > > index e848a4811785..a927f5f39bee 100644
> > > --- a/arch/x86/mm/pgtable.c
> > > +++ b/arch/x86/mm/pgtable.c
> > > @@ -637,6 +637,16 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte)
> > > {
> > > unsigned long address = __fix_to_virt(idx);
> > >
> > > +#ifdef CONFIG_X86_64
> > > + /*
> > > + * In arch/x86/kernel/head_64.S, the static page table has
> > > + * been setup for fixmap. Add a sanity compiling check
> > > + * whether fixmap space has exceeded the capacity.
> > > + */
> > > + BUILD_BUG_ON((__end_of_permanent_fixed_addresses + 511)/512
> > > + > FIXMAP_PMD_NUM);
> >
> > There exist macros for rounding up and doing this in the header file is
> > perfectly fine.
>
> I'll find the sample for the round up.
>
> And for the header file check, I initially put this check directly in
> the fixmap.h like:
>
> #if ((__end_of_permanent_fixed_addresses + 511)/512 > FIXMAP_PMD_NUM)
> #erro "some warning...."
> #endif
>
> But failed to compile, I got the warning
> warning: "__end_of_permanent_fixed_addresses" is not defined
>
> I guess the header file preprocessing can't handle it.

Below is a patch against 4.19-rc4, verified with earlycon
working fine, please review, thanks!

- Feng

---