Message ID | 1456245085-2302-7-git-send-email-andrew.cooper3@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
>>> On 23.02.16 at 17:31, <andrew.cooper3@citrix.com> wrote: > In preparation for using superpage mappings, .data and .bss will both want to > be mapped as read-write. By making them adjacent, they can share the same > superpage and will not require superpage alignment between themselves. > > While making this change, fix an exposed alignment bug. __init_end only needs > page alignment, while .bss.stack_aligned needs STACK_SIZE alignment. Well, this has become a bug only with your changes (perhaps that what you mean with "fix an exposed alignment bug", but it reads as if there was a latent one, which isn't the case afaict). > .bss : { /* BSS */ > __bss_start = .; > + . = ALIGN(STACK_SIZE); These two lines should be swapped - there's no point in starting the BSS ahead of the alignment, causing us to needlessly zero a few more pages during boot. Jan
On 24/02/16 11:41, Jan Beulich wrote: >>>> On 23.02.16 at 17:31, <andrew.cooper3@citrix.com> wrote: >> In preparation for using superpage mappings, .data and .bss will both want to >> be mapped as read-write. By making them adjacent, they can share the same >> superpage and will not require superpage alignment between themselves. >> >> While making this change, fix an exposed alignment bug. __init_end only needs >> page alignment, while .bss.stack_aligned needs STACK_SIZE alignment. > Well, this has become a bug only with your changes (perhaps > that what you mean with "fix an exposed alignment bug", but > it reads as if there was a latent one, which isn't the case afaict). It is a latent bug. The alignment directive for .bss.stack_aligned was part of .init rather than .bss > >> .bss : { /* BSS */ >> __bss_start = .; >> + . = ALIGN(STACK_SIZE); > These two lines should be swapped - there's no point in starting > the BSS ahead of the alignment, causing us to needlessly zero > a few more pages during boot. Will do. ~Andrew
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 106067a..63dbcff 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -73,36 +73,6 @@ SECTIONS #endif } :text - . = ALIGN(SMP_CACHE_BYTES); - .data.read_mostly : { - /* Exception table */ - __start___ex_table = .; - *(.ex_table) - __stop___ex_table = .; - - /* Pre-exception table */ - __start___pre_ex_table = .; - *(.ex_table.pre) - __stop___pre_ex_table = .; - - *(.data.read_mostly) - . = ALIGN(8); - __start_schedulers_array = .; - *(.data.schedulers) - __end_schedulers_array = .; - *(.data.rel.ro) - *(.data.rel.ro.*) - } :text - - .data : { /* Data */ - . = ALIGN(PAGE_SIZE); - *(.data.page_aligned) - *(.data) - *(.data.rel) - *(.data.rel.*) - CONSTRUCTORS - } :text - . = ALIGN(PAGE_SIZE); /* Init code and data */ __init_begin = .; .init.text : { @@ -162,11 +132,42 @@ SECTIONS *(.xsm_initcall.init) __xsm_initcall_end = .; } :text - . = ALIGN(STACK_SIZE); + . = ALIGN(PAGE_SIZE); __init_end = .; + . = ALIGN(SMP_CACHE_BYTES); + .data.read_mostly : { + /* Exception table */ + __start___ex_table = .; + *(.ex_table) + __stop___ex_table = .; + + /* Pre-exception table */ + __start___pre_ex_table = .; + *(.ex_table.pre) + __stop___pre_ex_table = .; + + *(.data.read_mostly) + . = ALIGN(8); + __start_schedulers_array = .; + *(.data.schedulers) + __end_schedulers_array = .; + *(.data.rel.ro) + *(.data.rel.ro.*) + } :text + + .data : { /* Data */ + . = ALIGN(PAGE_SIZE); + *(.data.page_aligned) + *(.data) + *(.data.rel) + *(.data.rel.*) + CONSTRUCTORS + } :text + .bss : { /* BSS */ __bss_start = .; + . = ALIGN(STACK_SIZE); *(.bss.stack_aligned) . = ALIGN(PAGE_SIZE); *(.bss.page_aligned*)
In preparation for using superpage mappings, .data and .bss will both want to be mapped as read-write. By making them adjacent, they can share the same superpage and will not require superpage alignment between themselves. While making this change, fix an exposed alignment bug. __init_end only needs page alignment, while .bss.stack_aligned needs STACK_SIZE alignment. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> --- CC: Jan Beulich <JBeulich@suse.com> New in v2. --- xen/arch/x86/xen.lds.S | 63 +++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 31 deletions(-)