[PATCH v3 07/21] arm64: move kernel image to base of vmalloc area

Mark Rutland mark.rutland at arm.com
Wed Jan 13 03:11:53 PST 2016


On Wed, Jan 13, 2016 at 10:58:55AM +0100, Ard Biesheuvel wrote:
> On 13 January 2016 at 09:39, Ard Biesheuvel <ard.biesheuvel at linaro.org> wrote:
> > On 12 January 2016 at 19:14, Mark Rutland <mark.rutland at arm.com> wrote:
> >> On Mon, Jan 11, 2016 at 02:19:00PM +0100, Ard Biesheuvel wrote:
> >>> @@ -438,12 +442,29 @@ static void __init map_kernel(pgd_t *pgd)
> >>>       map_kernel_chunk(pgd, __init_begin, __init_end, PAGE_KERNEL_EXEC);
> >>>       map_kernel_chunk(pgd, _data, _end, PAGE_KERNEL);
> >>>
> >>> -     /*
> >>> -      * The fixmap falls in a separate pgd to the kernel, and doesn't live
> >>> -      * in the carveout for the swapper_pg_dir. We can simply re-use the
> >>> -      * existing dir for the fixmap.
> >>> -      */
> >>> -     set_pgd(pgd_offset_raw(pgd, FIXADDR_START), *pgd_offset_k(FIXADDR_START));
> >>> +     if (pgd_index(FIXADDR_START) != pgd_index((u64)_end)) {
> >>
> >> To match the style of early_fixmap_init, and given we already mapped the
> >> kernel image, this could be:
> >>
> >>         if (pgd_none(pgd_offset_raw(pgd, FIXADDR_START))) {
> >>
> >> Which also serves as a run-time check that the pgd entry really was
> >> clear.
> >>
> >
> > Yes, that looks better. I will steal that :-)
> >
> 
> OK, that doesn't work. pgd_none() is hardcoded to 'false' when running
> with fewer than 4 pgtable levels, and so we always hit the BUG() here.

Ah, sorry.

We could also check CONFIG_PGTABLE_LEVELS > 3 check, as with
fixmap_init, perhaps?

Thanks,
Mark.



More information about the linux-arm-kernel mailing list