Re: [PATCH 1/2] x86: Make E820_X_MAX unconditionally larger than E820MAX

From: Ingo Molnar
Date: Wed Nov 30 2016 - 01:22:03 EST



* Alex Thorlton <athorlton@xxxxxxx> wrote:

> It's really not necessary to limit E820_X_MAX to 128 in the non-EFI
> case. This commit drops E820_X_MAX's dependency on CONFIG_EFI, so that
> E820_X_MAX is always at least slightly larger than E820MAX.
>
> The real motivation behind this is actually to prevent some issues in
> the Xen kernel, where the XENMEM_machine_memory_map hypercall can
> produce an e820 map larger than 128 entries, even on systems where the
> original e820 table was quite a bit smaller than that, depending on how
> many IOAPICs are installed on the system.
>
> Signed-off-by: Alex Thorlton <athorlton@xxxxxxx>
> Suggested-by: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Russ Anderson <rja@xxxxxxx>
> Cc: David Vrabel <david.vrabel@xxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Juergen Gross <jgross@xxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> Cc: Denys Vlasenko <dvlasenk@xxxxxxxxxx>
> Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
> Cc: x86@xxxxxxxxxx
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
> ---
> arch/x86/include/asm/e820.h | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
> index 476b574..aa00d33 100644
> --- a/arch/x86/include/asm/e820.h
> +++ b/arch/x86/include/asm/e820.h
> @@ -1,13 +1,15 @@
> #ifndef _ASM_X86_E820_H
> #define _ASM_X86_E820_H
>
> -#ifdef CONFIG_EFI
> +/*
> + * We need to make sure that E820_X_MAX is defined
> + * before we include uapi/asm/e820.h
> + */
> #include <linux/numa.h>
> #define E820_X_MAX (E820MAX + 3 * MAX_NUMNODES)

What we need an explanation for in the comment is what does this stand for (what
does the 'X' mean?), and what is the magic 3*MAX_NUMNODES about?

Thanks,

Ingo