Re: [PATCH] x86, mm: Reserver some memory for bootmem allocator for NO_BOOTMEM
From: Thomas Gleixner
Date: Sun Sep 16 2018 - 10:44:04 EST
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.
> +#endif
> +
> if (idx >= __end_of_fixed_addresses) {
> BUG();
> return;
> diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c
> index 45b700ac5fe7..b0aa2364a3c6 100644
> --- a/arch/x86/xen/mmu_pv.c
> +++ b/arch/x86/xen/mmu_pv.c
> @@ -1953,7 +1953,10 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
> set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO);
> set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);
> set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);
> - set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO);
> +
> + for (i = 0; i < FIXMAP_PMD_NUM; i++)
> + set_page_prot(level1_fixmap_pgt + i * 512,
> + PAGE_KERNEL_RO);
The line break is there because?
Thanks,
tglx