Thread (69 messages) 69 messages, 4 authors, 2016-01-27

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

From: Ard Biesheuvel <hidden>
Date: 2016-01-13 11:14:04
Also in: lkml

On 13 January 2016 at 12:11, Mark Rutland [off-list ref] wrote:
On Wed, Jan 13, 2016 at 10:58:55AM +0100, Ard Biesheuvel wrote:
quoted
On 13 January 2016 at 09:39, Ard Biesheuvel [off-list ref] wrote:
quoted
On 12 January 2016 at 19:14, Mark Rutland [off-list ref] wrote:
quoted
On Mon, Jan 11, 2016 at 02:19:00PM +0100, Ard Biesheuvel wrote:
quoted
@@ -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?
I'm using this now:

if (!pgd_val(*pgd_offset_raw(pgd, FIXADDR_START))) {

which I think is appropriate, since we don't expect to share any top
level entry, folded or not.

-- 
Ard.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help