[PATCH] x86/boot: move l<N>_bootmap

Jan Beulich posted 1 patch 4 months, 1 week ago
Failed in applying to current master (apply log)
[PATCH] x86/boot: move l<N>_bootmap
Posted by Jan Beulich 4 months, 1 week ago
Having them in the general .init.data section is somewhat wasteful, due
to involved padding. Move them into .init.data.page_aligned, and place
that right after .init.bss.stack_aligned.

Overall .init.data* shrinks by slightly over 2 pages in the build I'm
looking at.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
All three tables are merely zero-filled. They could hence even be put in
.init.bss.page_aligned, yet then we perhaps better wouldn't use .fill
but .skip there (i.e. a larger diff for little gain). Thoughts?

--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -193,7 +193,7 @@ END(idle_pg_table)
 GLOBAL(__page_tables_end)
 
 /* Init pagetables. Enough page directories to map into 4GB. */
-        .section .init.data, "aw", @progbits
+        .section .init.data.page_aligned, "aw", @progbits
 
 DATA_LOCAL(l1_bootmap, PAGE_SIZE)
         .fill L1_PAGETABLE_ENTRIES, 8, 0
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -221,6 +221,7 @@ SECTIONS
   DECL_SECTION(.init.data) {
 #endif
        *(.init.bss.stack_aligned)
+       *(.init.data.page_aligned)
 
        . = ALIGN(POINTER_ALIGN);
        __initdata_cf_clobber_start = .;
Re: [PATCH] x86/boot: move l<N>_bootmap
Posted by Andrew Cooper 4 months, 1 week ago
On 25/06/2025 10:05 am, Jan Beulich wrote:
> Having them in the general .init.data section is somewhat wasteful, due
> to involved padding. Move them into .init.data.page_aligned, and place
> that right after .init.bss.stack_aligned.
>
> Overall .init.data* shrinks by slightly over 2 pages in the build I'm
> looking at.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

> ---
> All three tables are merely zero-filled. They could hence even be put in
> .init.bss.page_aligned, yet then we perhaps better wouldn't use .fill
> but .skip there (i.e. a larger diff for little gain). Thoughts?

It makes no difference to the binary.  .init.bss is merged with the rest
of .init, so is a block of real zeroes.

I'd opt for lower churn.

~Andrew