Re: [PATCH v10 20/22] x86: mm: Convert dump_pagetables to use walk_page_range

From: Andrew Morton
Date: Wed Aug 07 2019 - 16:17:01 EST


On Wed, 7 Aug 2019 13:58:21 +0100 Steven Price <steven.price@xxxxxxx> wrote:

> > ./arch/x86/include/asm/pgtable_64_types.h:56:22: error: initializer element is not constant
> > #define PTRS_PER_PGD 512
> > ^
>
> This is very unhelpful of GCC - it's actually PTRS_PER_P4D which isn't
> constant!

Well. You had every right to assume that an all-caps macro is a
compile-time constant.

We are innocent victims of Kirill's c65e774fb3f6af2 ("x86/mm: Make
PGDIR_SHIFT and PTRS_PER_P4D variable") which lazily converted these
macros into runtime-only, under some Kconfig settings. It should have
changed those macros into static inlined lower-case functions.