Messages in this thread | | | Date | Mon, 17 Sep 2018 16:07:57 +0800 | From | Feng Tang <> | Subject | Re: [PATCH] x86/mm: Expand static page table for fixmap space |
| |
Hi Juergen,
On Mon, Sep 17, 2018 at 09:48:05AM +0200, Juergen Gross wrote: > On 17/09/18 09:34, Feng Tang wrote: > > We met a kernel panic when enabling earlycon, which is due to > > the fixmap address of earlycon is not statically setup. > > > > Currently the static fixmap setup in head_64.S only covers 2M > > virtual address space, while it acutually could be in 4M space > > with different kernel configurations. > > > > So increase the static space to 4M for now by defining FIXMAP_PMD_NUM > > to 2, and add a build time check for future possible overflow so that > > the macro could be increased accordingly. > > > > Suggested-by: Thomas Gleixner <tglx@linutronix.de> > > Signed-off-by: Feng Tang <feng.tang@intel.com> > > --- > > arch/x86/include/asm/fixmap.h | 3 +++ > > arch/x86/include/asm/pgtable_64.h | 3 ++- > > arch/x86/kernel/head_64.S | 16 ++++++++++++---- > > arch/x86/mm/pgtable.c | 10 ++++++++++ > > arch/x86/xen/mmu_pv.c | 4 +++- > > 5 files changed, 30 insertions(+), 6 deletions(-) > > > > ... > > > diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c > > index 2fe5c9b..19077f9 100644 > > --- a/arch/x86/xen/mmu_pv.c > > +++ b/arch/x86/xen/mmu_pv.c > > @@ -1952,7 +1952,9 @@ 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); > > Please use PTRS_PER_PTE instead of the literal 512. > > Some lines further up level1_fixmap_pgt is mentioned in a comment. > Please update that, too: > > - /* L3_k[511][506] -> level1_fixmap_pgt */ > + /* L3_k[511][506, ...] -> level1_fixmap_pgt */
Thanks for the suggestions, will handle them in v2.
- Feng
> > > Juergen
| |