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(-)
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 <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <jbeulich@suse.com>
CC: Roger Pau Monné <roger@xenproject.org>
CC: Teddy Astie <teddy.astie@vates.tech>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
CC: Bertrand Marquis <bertrand.marquis@arm.com>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
CC: Baptiste Le Duc <baptiste.le-duc@vates.tech>
CC: Timothy Pearson <tpearson@raptorengineering.com>
---
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(-)
diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 613511390ff4..d1bb6c62d208 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -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.*)
diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S
index 37256c8865a9..cddb70855307 100644
--- a/xen/arch/ppc/xen.lds.S
+++ b/xen/arch/ppc/xen.lds.S
@@ -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.*)
diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S
index d9375a961697..250ee3f36f4f 100644
--- a/xen/arch/riscv/xen.lds.S
+++ b/xen/arch/riscv/xen.lds.S
@@ -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.*)
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 8f943e11ead4..925848980219 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -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)
--
2.39.5
On 12-Nov-26 19:36, Andrew Cooper wrote:
> 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
>
> In the ARM linker file, fix some adjacent misalignment.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Roger Pau Monné <roger@xenproject.org>
> CC: Teddy Astie <teddy.astie@vates.tech>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien@xen.org>
> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
> CC: Bertrand Marquis <bertrand.marquis@arm.com>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> CC: Baptiste Le Duc <baptiste.le-duc@vates.tech>
> CC: Timothy Pearson <tpearson@raptorengineering.com>
> ---
> 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(-)
>
> diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
> index 613511390ff4..d1bb6c62d208 100644
> --- a/xen/arch/arm/xen.lds.S
> +++ b/xen/arch/arm/xen.lds.S
> @@ -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.*)
> diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S
> index 37256c8865a9..cddb70855307 100644
> --- a/xen/arch/ppc/xen.lds.S
> +++ b/xen/arch/ppc/xen.lds.S
> @@ -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.*)
> diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S
> index d9375a961697..250ee3f36f4f 100644
> --- a/xen/arch/riscv/xen.lds.S
> +++ b/xen/arch/riscv/xen.lds.S
> @@ -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.*)
> diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
> index 8f943e11ead4..925848980219 100644
> --- a/xen/arch/x86/xen.lds.S
> +++ b/xen/arch/x86/xen.lds.S
> @@ -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)
>
On 13/11/2026 7:31 am, Orzel, Michal wrote: > > On 12-Nov-26 19:36, Andrew Cooper wrote: >> 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. 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
On 13/11/2026 9:47 am, Andrew Cooper wrote: > On 13/11/2026 7:31 am, Orzel, Michal wrote: >> On 12-Nov-26 19:36, Andrew Cooper wrote: >>> 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. > 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. Actually no. They should be in ro_after_init. ~Andrew
On 13.11.26 10:47, Andrew Cooper wrote: > On 13/11/2026 7:31 am, Orzel, Michal wrote: >> >> On 12-Nov-26 19:36, Andrew Cooper wrote: >>> 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. > > 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
On 13.11.26 11:11, Juergen Gross wrote: > On 13.11.26 10:47, Andrew Cooper wrote: >> On 13/11/2026 7:31 am, Orzel, Michal wrote: >>> >>> On 12-Nov-26 19:36, Andrew Cooper wrote: >>>> 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. >> >> 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). 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
On 11/13/26 8:31 AM, Orzel, Michal wrote:
>
>
> On 12-Nov-26 19:36, Andrew Cooper wrote:
>> 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.
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
>
>>
>> In the ARM linker file, fix some adjacent misalignment.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> ---
>> CC: Jan Beulich <jbeulich@suse.com>
>> CC: Roger Pau Monné <roger@xenproject.org>
>> CC: Teddy Astie <teddy.astie@vates.tech>
>> CC: Stefano Stabellini <sstabellini@kernel.org>
>> CC: Julien Grall <julien@xen.org>
>> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
>> CC: Bertrand Marquis <bertrand.marquis@arm.com>
>> CC: Michal Orzel <michal.orzel@amd.com>
>> CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
>> CC: Baptiste Le Duc <baptiste.le-duc@vates.tech>
>> CC: Timothy Pearson <tpearson@raptorengineering.com>
>> ---
>> 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(-)
>>
>> diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
>> index 613511390ff4..d1bb6c62d208 100644
>> --- a/xen/arch/arm/xen.lds.S
>> +++ b/xen/arch/arm/xen.lds.S
>> @@ -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.*)
>> diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S
>> index 37256c8865a9..cddb70855307 100644
>> --- a/xen/arch/ppc/xen.lds.S
>> +++ b/xen/arch/ppc/xen.lds.S
>> @@ -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.*)
>> diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S
>> index d9375a961697..250ee3f36f4f 100644
>> --- a/xen/arch/riscv/xen.lds.S
>> +++ b/xen/arch/riscv/xen.lds.S
>> @@ -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.*)
>> diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
>> index 8f943e11ead4..925848980219 100644
>> --- a/xen/arch/x86/xen.lds.S
>> +++ b/xen/arch/x86/xen.lds.S
>> @@ -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)
>>
>
Hi,
Andrew Cooper <andrew.cooper3@citrix.com> writes:
> 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 <andrew.cooper3@citrix.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> ---
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Roger Pau Monné <roger@xenproject.org>
> CC: Teddy Astie <teddy.astie@vates.tech>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien@xen.org>
> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
> CC: Bertrand Marquis <bertrand.marquis@arm.com>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> CC: Baptiste Le Duc <baptiste.le-duc@vates.tech>
> CC: Timothy Pearson <tpearson@raptorengineering.com>
> ---
> 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(-)
>
> diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
> index 613511390ff4..d1bb6c62d208 100644
> --- a/xen/arch/arm/xen.lds.S
> +++ b/xen/arch/arm/xen.lds.S
> @@ -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.*)
> diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S
> index 37256c8865a9..cddb70855307 100644
> --- a/xen/arch/ppc/xen.lds.S
> +++ b/xen/arch/ppc/xen.lds.S
> @@ -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.*)
> diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S
> index d9375a961697..250ee3f36f4f 100644
> --- a/xen/arch/riscv/xen.lds.S
> +++ b/xen/arch/riscv/xen.lds.S
> @@ -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.*)
> diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
> index 8f943e11ead4..925848980219 100644
> --- a/xen/arch/x86/xen.lds.S
> +++ b/xen/arch/x86/xen.lds.S
> @@ -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)
--
WBR, Volodymyr
© 2016 - 2026 Red Hat, Inc.