xen/init: Annotate all command line parameter infrastructure as const
PATCH 1/1 xen/init: Annotate all command line parameter infrastructure as const
There is no reason for any of it to be modified. Additionally, link .init.setup beside the other constant .init data.
While editing this area, correct the types used in the extern declarations for __setup_start and __setup_end to match the types the linker actually produces.
No functional change.
---
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
--- xen/arch/arm/xen.lds.S | 11 ++++++----- xen/arch/x86/xen.lds.S | 11 ++++++----- xen/common/kernel.c | 2 +- xen/include/xen/init.h | 7 ++++--- 4 files changed, 17 insertions(+), 14 deletions(-)
xen/arch/arm/xen.lds.S +6 -5
@@ -135,6 +135,12 @@ SECTIONS *(.init.rodata) *(.init.rodata.rel) *(.init.rodata.str*) + + . = ALIGN(POINTER_ALIGN); + __setup_start = .; + *(.init.setup) + __setup_end = .; + *(.init.data) *(.init.data.rel) *(.init.data.rel.*)
@@ -145,11 +151,6 @@ SECTIONS __ctors_end = .; } :text . = ALIGN(32); - .init.setup : { - __setup_start = .; - *(.init.setup) - __setup_end = .; - } :text .init.proc.info : { __proc_info_start = .; *(.init.proc.info)
xen/arch/x86/xen.lds.S +6 -5
@@ -152,6 +152,12 @@ SECTIONS *(.init.rodata) *(.init.rodata.rel) *(.init.rodata.str*) + + . = ALIGN(POINTER_ALIGN); + __setup_start = .; + *(.init.setup) + __setup_end = .; + *(.init.data) *(.init.data.rel) *(.init.data.rel.*)
@@ -178,11 +184,6 @@ SECTIONS __ctors_end = .; } :text . = ALIGN(32); - .init.setup : { - __setup_start = .; - *(.init.setup) - __setup_end = .; - } :text .initcall.init : { __initcall_start = .; *(.initcallpresmp.init)
xen/common/kernel.c +1 -1
@@ -96,7 +96,7 @@ void __init cmdline_parse(const char *cmdline)if ( !bool_assert ) optkey +=3 ; -for ( param = &__setup_start; param < &__setup_end; param++ ) +for ( param = __setup_start; param < __setup_end; param++ ) {if (strcmp (param->name, optkey) ) {
xen/include/xen/init.h +4 -3
@@ -86,10 +86,11 @@ struct kernel_param {void *var; }; -extern struct kernel_param __setup_start, __setup_end; +extern struct kernel_param __setup_start[], __setup_end[]; -#define __setup_str static __initdata __attribute__((__aligned__(1))) char -#define __kparam static __initsetup \ +#define __setup_str static const __initconstrel \ + __attribute__((__aligned__(1))) char +#define __kparam static const __initsetup \ __attribute__((__aligned__(sizeof(void *)))) struct kernel_param#define custom_param (_name, _var) \
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH 1/1 xen/xsm: Annotate xsm_initcall() data as const
Additionally, link it adjacently to the other constant init data.
---
CC: Daniel De Graaf <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
--- xen/arch/arm/xen.lds.S | 9 ++++----- xen/arch/x86/xen.lds.S | 9 ++++----- xen/include/xsm/xsm.h | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-)
xen/arch/arm/xen.lds.S +4 -5
@@ -141,6 +141,10 @@ SECTIONS *(.init.setup) __setup_end = .; + __xsm_initcall_start = .; + *(.xsm_initcall.init) + __xsm_initcall_end = .; + *(.init.data) *(.init.data.rel) *(.init.data.rel.*)
@@ -163,11 +167,6 @@ SECTIONS *(.initcall1.init) __initcall_end = .; } :text - .xsm_initcall.init : { - __xsm_initcall_start = .; - *(.xsm_initcall.init) - __xsm_initcall_end = .; - } :text __init_end_efi = .; . = ALIGN(STACK_SIZE); __init_end = .;
xen/arch/x86/xen.lds.S +4 -5
@@ -158,6 +158,10 @@ SECTIONS *(.init.setup) __setup_end = .; + __xsm_initcall_start = .; + *(.xsm_initcall.init) + __xsm_initcall_end = .; + *(.init.data) *(.init.data.rel) *(.init.data.rel.*)
@@ -191,11 +195,6 @@ SECTIONS *(.initcall1.init) __initcall_end = .; } :text - .xsm_initcall.init : { - __xsm_initcall_start = .; - *(.xsm_initcall.init) - __xsm_initcall_end = .; - } :text . = ALIGN(PAGE_SIZE); __init_end = .;
xen/include/xsm/xsm.h +1 -1
@@ -51,7 +51,7 @@ typedef void (*xsm_initcall_t)(void);extern xsm_initcall_t __xsm_initcall_start[], __xsm_initcall_end[];#define xsm_initcall (fn) \ - static xsm_initcall_t __initcall_##fn \ + static const xsm_initcall_t __initcall_##fn \ __used_section(".xsm_initcall.init") = fnstruct xsm_operations {
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH] xen/xsm: Annotate xsm_initcall() data as const
xen/include/xsm/xsm.h typedef void (*xsm_initcall_t)(void); · line 55
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 09.06.16 at 11:58, <[email protected]> wrote:
xen/include/xsm/xsm.h +1
-1@@ -51,7 +51,7 @@ typedef void (*xsm_initcall_t)(void);extern xsm_initcall_t __xsm_initcall_start[], __xsm_initcall_end[];#define xsm_initcall (fn) \ - static xsm_initcall_t __initcall_##fn \ + static const xsm_initcall_t __initcall_##fn \ __used_section(".xsm_initcall.init") = fn
Same here - please make the bounding symbol declarations then const too.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH] xen/xsm: Annotate xsm_initcall() data as const
In reply to Andrew CooperQuoted 3 lines · Andrew Cooper
Additionally, link it adjacently to the other constant init data.
Signed-off-by Andrew Cooper <[email protected]>
I think this section can actually be removed instead: it only has one user, additional users will need special switching code added anyway, and it should make the setup code easier to follow.
I already have a patch for the removal; I'll send that series soon.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH] xen/xsm: Annotate xsm_initcall() data as const
Quoted 10 lines · Daniel De Graaf
Quoted 3 lines · Andrew Cooper
Additionally, link it adjacently to the other constant init data.
Signed-off-by Andrew Cooper <[email protected]>I think this section can actually be removed instead: it only has one user, additional users will need special switching code added anyway, and it should make the setup code easier to follow.
I already have a patch for the removal; I'll send that series soon.
Ok - I will drop this patch from my series.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 1/1 x86/boot: copy/clear sections more efficiently
In reply to Andrew CooperBoth the trampoline copy and BSS initialise can be performed more efficiently by using 4-byte variants of the string operations.
On Intel systems with ERMSB (efficient rep movsb), this is no practical difference. On all other systems, this is 4 times more efficient.
---
CC: Jan Beulich <[email protected]>
--- xen/arch/x86/boot/head.S | 9 +++++---- xen/arch/x86/xen.lds.S | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-)
xen/arch/x86/boot/head.S +5 -4
@@ -128,7 +128,8 @@ __start: mov $sym_phys(__bss_end),%ecx sub %edi,%ecx xor %eax,%eax - rep stosb + shr $2,%ecx + rep stosl /* Interrogate CPU extended features via CPUID. */ mov $0x80000000,%eax
@@ -192,8 +193,8 @@ __start: /* Copy bootstrap trampoline to low memory, below 1MB. */ mov $sym_phys(trampoline_start),%esi - mov $trampoline_end - trampoline_start,%ecx - rep movsb + mov $((trampoline_end - trampoline_start) / 4),%ecx + rep movsl /* Jump into the relocated trampoline. */ lret
@@ -205,6 +206,6 @@ reloc: ENTRY(trampoline_start) #include "trampoline.S" -GLOBAL(trampoline_end) +ENTRY(trampoline_end) #include "x86_64.S"
xen/arch/x86/xen.lds.S +6 -0
@@ -240,6 +240,7 @@ SECTIONS *(.bss.percpu.read_mostly) . = ALIGN(SMP_CACHE_BYTES); __per_cpu_data_end = .; + . = ALIGN(4); __bss_end = .; } :text _end = . ;
@@ -320,3 +321,8 @@ ASSERT(IS_ALIGNED(cpu0_stack, STACK_SIZE), "cpu0_stack misaligned") ASSERT(IS_ALIGNED(__init_begin, PAGE_SIZE), "__init_begin misaligned") ASSERT(IS_ALIGNED(__init_end, PAGE_SIZE), "__init_end misaligned") + +ASSERT(IS_ALIGNED(trampoline_start, 4), "trampoline_start misaligned") +ASSERT(IS_ALIGNED(trampoline_end, 4), "trampoline_end misaligned") +ASSERT(IS_ALIGNED(__bss_start, 4), "__bss_start misaligned") +ASSERT(IS_ALIGNED(__bss_end, 4), "__bss_end misaligned")
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH] x86/boot: copy/clear sections more efficiently
xen/arch/x86/boot/head.S __start: · line 132
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 09.06.16 at 11:58, <[email protected]> wrote:
xen/arch/x86/boot/head.S +2
-1@@ -128,7 +128,8 @@ __start: mov $sym_phys(__bss_end),%ecx sub %edi,%ecx xor %eax,%eax - rep stosb + shr $2,%ecx + rep stosl
Please take the opportunity and reduce the whitespace between prefix and instruction to just one (to make clear "rep" is not the instruction and "stosl" is not it operand).
xen/arch/x86/boot/head.S __start: · line 197
Quoted 8 lines
xen/arch/x86/boot/head.S +2
-2@@ -192,8 +193,8 @@ __start: /* Copy bootstrap trampoline to low memory, below 1MB. */ mov $sym_phys(trampoline_start),%esi - mov $trampoline_end - trampoline_start,%ecx - rep movsb + mov $((trampoline_end - trampoline_start) / 4),%ecx + rep movsl
Same here.
With that
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
CC'ing Stefano's correct address. (This patch pre-dates quite a lot of recent changes).
Quoted 101 lines · Andrew Cooper
There is no reason for any of it to be modified. Additionally, link .init.setup beside the other constant .init data.
While editing this area, correct the types used in the extern declarations for
__setup_startand__setup_endto match the types the linker actually produces.No functional change.
Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>--- xen/arch/arm/xen.lds.S | 11 ++++++----- xen/arch/x86/xen.lds.S | 11 ++++++----- xen/common/kernel.c | 2 +- xen/include/xen/init.h | 7 ++++--- 4 files changed, 17 insertions(+), 14 deletions(-)xen/arch/arm/xen.lds.S +6
-5@@ -135,6 +135,12 @@ SECTIONS *(.init.rodata) *(.init.rodata.rel) *(.init.rodata.str*) + + . = ALIGN(POINTER_ALIGN); + __setup_start = .; + *(.init.setup) + __setup_end = .; + *(.init.data) *(.init.data.rel) *(.init.data.rel.*)@@ -145,11 +151,6 @@ SECTIONS __ctors_end = .; } :text . = ALIGN(32); - .init.setup : { - __setup_start = .; - *(.init.setup) - __setup_end = .; - } :text .init.proc.info : { __proc_info_start = .; *(.init.proc.info)xen/arch/x86/xen.lds.S +6
-5@@ -152,6 +152,12 @@ SECTIONS *(.init.rodata) *(.init.rodata.rel) *(.init.rodata.str*) + + . = ALIGN(POINTER_ALIGN); + __setup_start = .; + *(.init.setup) + __setup_end = .; + *(.init.data) *(.init.data.rel) *(.init.data.rel.*)@@ -178,11 +184,6 @@ SECTIONS __ctors_end = .; } :text . = ALIGN(32); - .init.setup : { - __setup_start = .; - *(.init.setup) - __setup_end = .; - } :text .initcall.init : { __initcall_start = .; *(.initcallpresmp.init)xen/common/kernel.c +1
-1@@ -96,7 +96,7 @@ void __init cmdline_parse(const char *cmdline)if ( !bool_assert ) optkey +=3 ; -for ( param = &__setup_start; param < &__setup_end; param++ ) +for ( param = __setup_start; param < __setup_end; param++ ) {if (strcmp (param->name, optkey) ) {xen/include/xen/init.h +0
-1@@ -86,10 +86,11 @@ struct kernel_param {void *var; }; -extern struct kernel_param __setup_start, __setup_end;
xen/include/xen/init.h struct kernel_param { · line 96
Quoted 10 lines
xen/include/xen/init.h +4
-2+extern struct kernel_param __setup_start[], __setup_end[]; -#define __setup_str static __initdata __attribute__((__aligned__(1))) char -#define __kparam static __initsetup \ +#define __setup_str static const __initconstrel \ + __attribute__((__aligned__(1))) char +#define __kparam static const __initsetup \ __attribute__((__aligned__(sizeof(void *)))) struct kernel_param#define custom_param (_name, _var) \
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 09.06.16 at 11:58, <[email protected]> wrote:
xen/arch/arm/xen.lds.S +6
-0@@ -135,6 +135,12 @@ SECTIONS *(.init.rodata) *(.init.rodata.rel) *(.init.rodata.str*) + + . = ALIGN(POINTER_ALIGN); + __setup_start = .; + *(.init.setup) + __setup_end = .; + *(.init.data) *(.init.data.rel) *(.init.data.rel.*)
xen/arch/arm/xen.lds.S SECTIONS · line 154
Quoted 9 lines
xen/arch/arm/xen.lds.S +0
-5@@ -145,11 +151,6 @@ SECTIONS __ctors_end = .; } :text . = ALIGN(32); - .init.setup : { - __setup_start = .; - *(.init.setup) - __setup_end = .; - } :text .init.proc.info : {
Surely that ALIGN() then has no reason to retain the 32 (similar for x86)?
xen/include/xen/init.h struct kernel_param { · line 89
Quoted 8 lines
xen/include/xen/init.h +1
-1@@ -86,10 +86,11 @@ struct kernel_param {void *var; }; -extern struct kernel_param __setup_start, __setup_end; +extern struct kernel_param __setup_start[], __setup_end[];
I thought your respective remark in the commit message would also implied making these const now that they are.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 20 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 09.06.16 at 11:58, <[email protected]> wrote:
xen/arch/arm/xen.lds.S +6
-0@@ -135,6 +135,12 @@ SECTIONS *(.init.rodata) *(.init.rodata.rel) *(.init.rodata.str*) + + . = ALIGN(POINTER_ALIGN); + __setup_start = .; + *(.init.setup) + __setup_end = .; + *(.init.data) *(.init.data.rel) *(.init.data.rel.*)@@ -145,11 +151,6 @@ SECTIONS __ctors_end = .; } :text . = ALIGN(32);
Quoted 8 lines
xen/arch/arm/xen.lds.S SECTIONS · line 154
Quoted 6 lines
xen/arch/arm/xen.lds.S +0
-5- .init.setup : { - __setup_start = .; - *(.init.setup) - __setup_end = .; - } :text .init.proc.info : {Surely that
ALIGN()then has no reason to retain the 32 (similar for x86)?
I don't know where this ALIGN() came from, but I am hesitant to remove it until I am sure it is safe to do so.
For both x86 and arm, .initcall will take a little more work to disentangle, although I do intend to make it happen.
On arm, .init.proc.info is an array of 32byte elements. Looking at its contents, it should be constant, and probably wants 4 byte alignment as opposed to 32.
Quoted 11 lines
xen/include/xen/init.h struct kernel_param { · line 89
Quoted 9 lines
xen/include/xen/init.h +1
-1@@ -86,10 +86,11 @@ struct kernel_param {void *var; }; -extern struct kernel_param __setup_start, __setup_end; +extern struct kernel_param __setup_start[], __setup_end[];I thought your respective remark in the commit message would also implied making these const now that they are.
Will do.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Hi Andrew,
Quoted 33 lines · Andrew Cooper
Quoted 20 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 09.06.16 at 11:58, <[email protected]> wrote:
xen/arch/arm/xen.lds.S +6
-0@@ -135,6 +135,12 @@ SECTIONS *(.init.rodata) *(.init.rodata.rel) *(.init.rodata.str*) + + . = ALIGN(POINTER_ALIGN); + __setup_start = .; + *(.init.setup) + __setup_end = .; + *(.init.data) *(.init.data.rel) *(.init.data.rel.*)@@ -145,11 +151,6 @@ SECTIONS __ctors_end = .; } :text . = ALIGN(32);Quoted 8 lines
xen/arch/arm/xen.lds.S SECTIONS · line 154
Quoted 6 lines
xen/arch/arm/xen.lds.S +0
-5- .init.setup : { - __setup_start = .; - *(.init.setup) - __setup_end = .; - } :text .init.proc.info : {Surely that
ALIGN()then has no reason to retain the 32 (similar for x86)?I don't know where this
ALIGN()came from, but I am hesitant to remove it until I am sure it is safe to do so.
Quoted 6 lines
For both x86 and arm, .initcall will take a little more work to disentangle, although I do intend to make it happen.
On arm, .init.proc.info is an array of 32byte elements. Looking at its contents, it should be constant, and probably wants 4 byte alignment as opposed to 32.
proc_info_list contains some pointers, so we want 4-byte for ARM32 and 8-byte for ARM64. I would use POINTER_ALIGN here.
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
(CC the correct email for Stefano)
Quoted 48 lines · Julien Grall
Hi Andrew,
Quoted 33 lines · Andrew Cooper
Quoted 20 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 09.06.16 at 11:58, <[email protected]> wrote:
xen/arch/arm/xen.lds.S +6
-0@@ -135,6 +135,12 @@ SECTIONS *(.init.rodata) *(.init.rodata.rel) *(.init.rodata.str*) + + . = ALIGN(POINTER_ALIGN); + __setup_start = .; + *(.init.setup) + __setup_end = .; + *(.init.data) *(.init.data.rel) *(.init.data.rel.*)@@ -145,11 +151,6 @@ SECTIONS __ctors_end = .; } :text . = ALIGN(32);Quoted 8 lines
xen/arch/arm/xen.lds.S SECTIONS · line 154
Quoted 6 lines
xen/arch/arm/xen.lds.S +0
-5- .init.setup : { - __setup_start = .; - *(.init.setup) - __setup_end = .; - } :text .init.proc.info : {Surely that
ALIGN()then has no reason to retain the 32 (similar for x86)?I don't know where this
ALIGN()came from, but I am hesitant to remove it until I am sure it is safe to do so.Quoted 6 lines
For both x86 and arm, .initcall will take a little more work to disentangle, although I do intend to make it happen.
On arm, .init.proc.info is an array of 32byte elements. Looking at its contents, it should be constant, and probably wants 4 byte alignment as opposed to 32.
proc_info_listcontains some pointers, so we want 4-byte for ARM32 and 8-byte for ARM64. I would usePOINTER_ALIGNhere.Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 39 lines · Julien Grall
Hi Andrew,
Quoted 36 lines · Andrew Cooper
Quoted 20 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 09.06.16 at 11:58, <[email protected]> wrote:
xen/arch/arm/xen.lds.S +6
-0@@ -135,6 +135,12 @@ SECTIONS *(.init.rodata) *(.init.rodata.rel) *(.init.rodata.str*) + + . = ALIGN(POINTER_ALIGN); + __setup_start = .; + *(.init.setup) + __setup_end = .; + *(.init.data) *(.init.data.rel) *(.init.data.rel.*)@@ -145,11 +151,6 @@ SECTIONS __ctors_end = .; } :text . = ALIGN(32);Quoted 8 lines
xen/arch/arm/xen.lds.S SECTIONS · line 154
Quoted 6 lines
xen/arch/arm/xen.lds.S +0
-5- .init.setup : { - __setup_start = .; - *(.init.setup) - __setup_end = .; - } :text .init.proc.info : {Surely that
ALIGN()then has no reason to retain the 32 (similar for x86)?I don't know where this
ALIGN()came from, but I am hesitant to remove it until I am sure it is safe to do so.For both x86 and arm, .initcall will take a little more work to disentangle, although I do intend to make it happen.
Quoted 6 lines
Quoted 3 lines
On arm, .init.proc.info is an array of 32byte elements. Looking at its contents, it should be constant, and probably wants 4 byte alignment as opposed to 32.
proc_info_listcontains some pointers, so we want 4-byte for ARM32 and 8-byte for ARM64. I would usePOINTER_ALIGNhere.
I will add a patch to my series making this change.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel