xen/link: Move SCHEDULER_ARRAY into .rodata
PATCH 1/1 xen/link: Move SCHEDULER_ARRAY into .rodata
This is a list of pointers which is only ever read.
In the ARM linker file, fix some adjacent misalignment.
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Teddy Astie <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Baptiste Le Duc <[email protected]>
CC: Timothy Pearson <[email protected]>
--- xen/arch/arm/xen.lds.S | 6 +++--- xen/arch/ppc/xen.lds.S | 2 +- xen/arch/riscv/xen.lds.S | 2 +- xen/arch/x86/xen.lds.S | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
xen/arch/arm/xen.lds.S +3 -3
@@ -51,9 +51,10 @@ SECTIONS . = ALIGN(PAGE_SIZE); .rodata : { - _srodata = .; /* Read-only data */ + _srodata = .; /* Read-only data */ - BUGFRAMES + BUGFRAMES + SCHEDULER_ARRAY *(.rodata) *(.rodata.*)
@@ -93,7 +94,6 @@ SECTIONS .data : { /* Data */ *(.data.page_aligned) - SCHEDULER_ARRAY HYPFS_PARAM *(.data .data.*)
xen/arch/ppc/xen.lds.S +1 -1
@@ -48,6 +48,7 @@ SECTIONS _srodata = .; /* Read-only data */ BUGFRAMES + SCHEDULER_ARRAY *(.rodata) *(.rodata.*)
@@ -84,7 +85,6 @@ SECTIONS DECL_SECTION(.data) { /* Data */ *(.data.page_aligned) - SCHEDULER_ARRAY HYPFS_PARAM *(.data .data.*)
xen/arch/riscv/xen.lds.S +1 -1
@@ -43,6 +43,7 @@ SECTIONS _srodata = .; /* Read-only data */ BUGFRAMES + SCHEDULER_ARRAY *(.srodata) *(.srodata.*)
@@ -91,7 +92,6 @@ SECTIONS .data : { /* Data */ *(.data.page_aligned) - SCHEDULER_ARRAY HYPFS_PARAM *(.sdata .sdata.*)
xen/arch/x86/xen.lds.S +1 -1
@@ -119,6 +119,7 @@ SECTIONS __ro_after_init_end = .; BUGFRAMES + SCHEDULER_ARRAY *(.rodata) *(.rodata.*)
@@ -297,7 +298,6 @@ SECTIONS DECL_SECTION(.data.read_mostly) { *(.data.read_mostly) - SCHEDULER_ARRAY HYPFS_PARAM } PHDR(text)
Signature · 1 line
2.39.5
Hi,
Quoted 5 lines · Andrew Cooper
This is a list of pointers which is only ever read.
In the ARM linker file, fix some adjacent misalignment.
Signed-off-by Andrew Cooper <[email protected]>
Quoted 103 lines
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Teddy Astie <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Baptiste Le Duc <[email protected]>
CC: Timothy Pearson <[email protected]>--- xen/arch/arm/xen.lds.S | 6 +++--- xen/arch/ppc/xen.lds.S | 2 +- xen/arch/riscv/xen.lds.S | 2 +- xen/arch/x86/xen.lds.S | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)xen/arch/arm/xen.lds.S +3
-3@@ -51,9 +51,10 @@ SECTIONS . = ALIGN(PAGE_SIZE); .rodata : { - _srodata = .; /* Read-only data */ + _srodata = .; /* Read-only data */ - BUGFRAMES + BUGFRAMES + SCHEDULER_ARRAY *(.rodata) *(.rodata.*)@@ -93,7 +94,6 @@ SECTIONS .data : { /* Data */ *(.data.page_aligned) - SCHEDULER_ARRAY HYPFS_PARAM *(.data .data.*)xen/arch/ppc/xen.lds.S +1
-1@@ -48,6 +48,7 @@ SECTIONS _srodata = .; /* Read-only data */ BUGFRAMES + SCHEDULER_ARRAY *(.rodata) *(.rodata.*)@@ -84,7 +85,6 @@ SECTIONS DECL_SECTION(.data) { /* Data */ *(.data.page_aligned) - SCHEDULER_ARRAY HYPFS_PARAM *(.data .data.*)xen/arch/riscv/xen.lds.S +1
-1@@ -43,6 +43,7 @@ SECTIONS _srodata = .; /* Read-only data */ BUGFRAMES + SCHEDULER_ARRAY *(.srodata) *(.srodata.*)@@ -91,7 +92,6 @@ SECTIONS .data : { /* Data */ *(.data.page_aligned) - SCHEDULER_ARRAY HYPFS_PARAM *(.sdata .sdata.*)xen/arch/x86/xen.lds.S +1
-1@@ -119,6 +119,7 @@ SECTIONS __ro_after_init_end = .; BUGFRAMES + SCHEDULER_ARRAY *(.rodata) *(.rodata.*)@@ -297,7 +298,6 @@ SECTIONS DECL_SECTION(.data.read_mostly) { *(.data.read_mostly) - SCHEDULER_ARRAY HYPFS_PARAM } PHDR(text)
Signature · 1 line
WBR, Volodymyr
Quoted 1 line · Andrew Cooper
This is a list of pointers which is only ever read.
I think that's not true. See sched_test_func() macro in scheduler_init() that assigns NULL in case the scheduler does not implement the required hook.
~Michal
Quoted 108 lines
In the ARM linker file, fix some adjacent misalignment.
Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Teddy Astie <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Baptiste Le Duc <[email protected]>
CC: Timothy Pearson <[email protected]>--- xen/arch/arm/xen.lds.S | 6 +++--- xen/arch/ppc/xen.lds.S | 2 +- xen/arch/riscv/xen.lds.S | 2 +- xen/arch/x86/xen.lds.S | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)xen/arch/arm/xen.lds.S +3
-3@@ -51,9 +51,10 @@ SECTIONS . = ALIGN(PAGE_SIZE); .rodata : { - _srodata = .; /* Read-only data */ + _srodata = .; /* Read-only data */ - BUGFRAMES + BUGFRAMES + SCHEDULER_ARRAY *(.rodata) *(.rodata.*)@@ -93,7 +94,6 @@ SECTIONS .data : { /* Data */ *(.data.page_aligned) - SCHEDULER_ARRAY HYPFS_PARAM *(.data .data.*)xen/arch/ppc/xen.lds.S +1
-1@@ -48,6 +48,7 @@ SECTIONS _srodata = .; /* Read-only data */ BUGFRAMES + SCHEDULER_ARRAY *(.rodata) *(.rodata.*)@@ -84,7 +85,6 @@ SECTIONS DECL_SECTION(.data) { /* Data */ *(.data.page_aligned) - SCHEDULER_ARRAY HYPFS_PARAM *(.data .data.*)xen/arch/riscv/xen.lds.S +1
-1@@ -43,6 +43,7 @@ SECTIONS _srodata = .; /* Read-only data */ BUGFRAMES + SCHEDULER_ARRAY *(.srodata) *(.srodata.*)@@ -91,7 +92,6 @@ SECTIONS .data : { /* Data */ *(.data.page_aligned) - SCHEDULER_ARRAY HYPFS_PARAM *(.sdata .sdata.*)xen/arch/x86/xen.lds.S +1
-1@@ -119,6 +119,7 @@ SECTIONS __ro_after_init_end = .; BUGFRAMES + SCHEDULER_ARRAY *(.rodata) *(.rodata.*)@@ -297,7 +298,6 @@ SECTIONS DECL_SECTION(.data.read_mostly) { *(.data.read_mostly) - SCHEDULER_ARRAY HYPFS_PARAM } PHDR(text)
Quoted 6 lines · Michal
Quoted 1 line · Andrew Cooper
This is a list of pointers which is only ever read.
I think that's not true. See
sched_test_func()macro inscheduler_init()that assigns NULL in case the scheduler does not implement the required hook.
The same happens a few lines below if the scheduler's global_init() fails.
Neither NULL assignment can trigger today (both global_init()
implementations return 0 and all in-tree schedulers provide the
hooks), but I think the writes need dropping first, and the entries want to become "const struct sched_ops *const" (both in REGISTER_SCHEDULER() and the __{start,end}_schedulers_array declarations) so the compiler enforces the property. It would also be nice to rename .data.schedulers to .rodata.schedulers while moving it.
The linker script placement itself looks fine to me.
~ Oleksii
Quoted 110 lines
Quoted 109 lines
In the ARM linker file, fix some adjacent misalignment.
Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Teddy Astie <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Baptiste Le Duc <[email protected]>
CC: Timothy Pearson <[email protected]>--- xen/arch/arm/xen.lds.S | 6 +++--- xen/arch/ppc/xen.lds.S | 2 +- xen/arch/riscv/xen.lds.S | 2 +- xen/arch/x86/xen.lds.S | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)xen/arch/arm/xen.lds.S +3
-3@@ -51,9 +51,10 @@ SECTIONS . = ALIGN(PAGE_SIZE); .rodata : { - _srodata = .; /* Read-only data */ + _srodata = .; /* Read-only data */ - BUGFRAMES + BUGFRAMES + SCHEDULER_ARRAY *(.rodata) *(.rodata.*)@@ -93,7 +94,6 @@ SECTIONS .data : { /* Data */ *(.data.page_aligned) - SCHEDULER_ARRAY HYPFS_PARAM *(.data .data.*)xen/arch/ppc/xen.lds.S +1
-1@@ -48,6 +48,7 @@ SECTIONS _srodata = .; /* Read-only data */ BUGFRAMES + SCHEDULER_ARRAY *(.rodata) *(.rodata.*)@@ -84,7 +85,6 @@ SECTIONS DECL_SECTION(.data) { /* Data */ *(.data.page_aligned) - SCHEDULER_ARRAY HYPFS_PARAM *(.data .data.*)xen/arch/riscv/xen.lds.S +1
-1@@ -43,6 +43,7 @@ SECTIONS _srodata = .; /* Read-only data */ BUGFRAMES + SCHEDULER_ARRAY *(.srodata) *(.srodata.*)@@ -91,7 +92,6 @@ SECTIONS .data : { /* Data */ *(.data.page_aligned) - SCHEDULER_ARRAY HYPFS_PARAM *(.sdata .sdata.*)xen/arch/x86/xen.lds.S +1
-1@@ -119,6 +119,7 @@ SECTIONS __ro_after_init_end = .; BUGFRAMES + SCHEDULER_ARRAY *(.rodata) *(.rodata.*)@@ -297,7 +298,6 @@ SECTIONS DECL_SECTION(.data.read_mostly) { *(.data.read_mostly) - SCHEDULER_ARRAY HYPFS_PARAM } PHDR(text)
Quoted 5 lines · Michal
Quoted 1 line · Andrew Cooper
This is a list of pointers which is only ever read.
I think that's not true. See
sched_test_func()macro inscheduler_init()that assigns NULL in case the scheduler does not implement the required hook.
Lovely, sorry I misread the const on the name there.
sched_test_func() on the other hand can be delete. We can force those checks at compiletime.
But, there's the global init case. None of the current global init hooks do anything except return 0, but I suppose in principle that may want to stay.
I suppose I'll keep SCHEDULER_ARRAY in read_mostly for now.
~Andrew
Quoted 7 lines · Andrew Cooper
Quoted 5 lines · Michal
Quoted 1 line · Andrew Cooper
This is a list of pointers which is only ever read.
I think that's not true. See
sched_test_func()macro inscheduler_init()that assigns NULL in case the scheduler does not implement the required hook.
Quoted 8 lines
Lovely, sorry I misread the const on the name there.
sched_test_func()on the other hand can be delete. We can force those checks at compiletime.But, there's the global init case. None of the current global init hooks do anything except return 0, but I suppose in principle that may want to stay.
This can easily be handled per-scheduler:
- make .global_init return void
- in case a global_init hook fails, let it set a static variable in the scheduler, resulting in any .init() call for that scheduler to fail
This will avoid any need to NULL a scheduler in the array (assuming sched_test_func() has been removed, too).
Juergen
Quoted 17 lines · Juergen Gross
Quoted 7 lines · Andrew Cooper
Quoted 5 lines · Michal
Quoted 1 line · Andrew Cooper
This is a list of pointers which is only ever read.
I think that's not true. See
sched_test_func()macro inscheduler_init()that assigns NULL in case the scheduler does not implement the required hook.Quoted 8 lines
Lovely, sorry I misread the const on the name there.
sched_test_func()on the other hand can be delete. We can force those checks at compiletime.But, there's the global init case. None of the current global init hooks do anything except return 0, but I suppose in principle that may want to stay.
Quoted 8 lines
This can easily be handled per-scheduler:
- make .global_init return void
- in case aglobal_inithook fails, let it set a static variable in the scheduler, resulting in any .init() call for that scheduler to failThis will avoid any need to NULL a scheduler in the array (assuming
sched_test_func()has been removed, too).
Thinking more about it: this scheme would even allow to drop the .global_init hook completely. If a scheduler needs that, call it from the .init hook the first time that is being called. As there are never concurrent calls of .init (only called either at boot for the default scheduler, or under cpupool_lock), there is no need for more than a simple per-scheduler variable telling that the global init function has been called and indicating a possible failure of it.
Juergen
Quoted 7 lines · Andrew Cooper
Quoted 4 lines · Michal
Quoted 1 line · Andrew Cooper
This is a list of pointers which is only ever read.
I think that's not true. See
sched_test_func()macro inscheduler_init()that assigns NULL in case the scheduler does not implement the required hook.Lovely, sorry I misread the const on the name there.
Quoted 8 lines
sched_test_func()on the other hand can be delete. We can force those checks at compiletime.But, there's the global init case. None of the current global init hooks do anything except return 0, but I suppose in principle that may want to stay.
I suppose I'll keep
SCHEDULER_ARRAYinread_mostlyfor now.
Actually no. They should be in ro_after_init.
~Andrew