x86/boot: re-order .init.data contributions
PATCH 1/1 x86/boot: re-order .init.data contributions
Putting a few bytes ahead of page tables isn't very efficient; there's a gap almost worth a full page. To avoid re-ordering of items in the source file, simply put the few small items in sub-section 1, for them to end up after the page tables, followed (in the final binary) by non- page-aligned items from other CUs.
xen/arch/x86/boot/head.S +1 -0
@@ -136,6 +136,7 @@ multiboot2_header: .Lno_nx_msg: .asciz "ERR: Not an NX-capable CPU!" .section .init.data, "aw", @progbits + .subsection 1 /* Put data here after the page tables (in x86_64.S). */ .align 4 .word 0
Quoted 7 lines · Jan Beulich
Putting a few bytes ahead of page tables isn't very efficient; there's a gap almost worth a full page. To avoid re-ordering of items in the source file, simply put the few small items in sub-section 1, for them to end up after the page tables, followed (in the final binary) by non- page-aligned items from other CUs.
Signed-off-by Jan Beulich <[email protected]>
Seems a little fragile, but I don't have a better suggestion.
Regards,
Jason
Quoted 11 lines · Jan Beulich
Putting a few bytes ahead of page tables isn't very efficient; there's a gap almost worth a full page. To avoid re-ordering of items in the source file, simply put the few small items in sub-section 1, for them to end up after the page tables, followed (in the final binary) by non- page-aligned items from other CUs.
Signed-off-by Jan Beulich <[email protected]>
xen/arch/x86/boot/head.S multiboot2_header: · line 142
Quoted 7 lines
xen/arch/x86/boot/head.S +1
-0@@ -136,6 +136,7 @@ multiboot2_header: .Lno_nx_msg: .asciz "ERR: Not an NX-capable CPU!" .section .init.data, "aw", @progbits + .subsection 1 /* Put data here after the page tables (in x86_64.S). */ .align 4 .word 0
Just as a note, this depends on the toolchain baseline bump, so can't be backported.
Clang-11 does now like subsection, so we can remove the !__clang__ specialisation for UNLIKELY_{START,END}_SECTION.
~Andrew
Quoted 18 lines · Andrew Cooper
Quoted 17 lines · Jan Beulich
Putting a few bytes ahead of page tables isn't very efficient; there's a gap almost worth a full page. To avoid re-ordering of items in the source file, simply put the few small items in sub-section 1, for them to end up after the page tables, followed (in the final binary) by non- page-aligned items from other CUs.
Signed-off-by Jan Beulich <[email protected]>xen/arch/x86/boot/head.S +1
-0@@ -136,6 +136,7 @@ multiboot2_header: .Lno_nx_msg: .asciz "ERR: Not an NX-capable CPU!" .section .init.data, "aw", @progbits + .subsection 1 /* Put data here after the page tables (in x86_64.S). */ .align 4
Quoted 7 lines
xen/arch/x86/boot/head.S multiboot2_header: · line 142
Quoted 1 line
xen/arch/x86/boot/head.S +0
-0.word 0Just as a note, this depends on the toolchain baseline bump, so can't be backported.
Clang-11 does now like subsection, so we can remove the !__clang__ specialisation for UNLIKELY_{START,END}_SECTION.
Funny you should mention that: I did check before even making the change, and in assembly code we used .subsection already before. We just needed to be careful about inline assembly. See UNLIKELY_START() vs the two forms of UNLIKELY_START_SECTION.
Irrespective of that: I had no intention to backport this.
Jan