[PATCH v1] xen: move __ro_after_init section symbols to xen/sections.h

Oleksii Kurochko posted 1 patch 4 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/1254ad9fd9f9fefc71ff8a5f5d23f5037d854943.1750237599.git.oleksii.kurochko@gmail.com
xen/arch/arm/include/asm/setup.h | 2 --
xen/arch/x86/include/asm/setup.h | 1 -
xen/include/xen/sections.h       | 3 +++
3 files changed, 3 insertions(+), 3 deletions(-)
[PATCH v1] xen: move __ro_after_init section symbols to xen/sections.h
Posted by Oleksii Kurochko 4 months, 2 weeks ago
Instead of declaring __ro_after_init_{start,end} in each architecture's
asm/setup.h, move these declarations to the common header xen/sections.h.

This centralizes the declarations and reduces duplication across
architectures.

No functional change intended.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
CI tests:
  https://gitlab.com/xen-project/people/olkur/xen/-/pipelines/1875993985  
---
 xen/arch/arm/include/asm/setup.h | 2 --
 xen/arch/x86/include/asm/setup.h | 1 -
 xen/include/xen/sections.h       | 3 +++
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index 2b58549c1a..b199d92a42 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -65,8 +65,6 @@ int map_irq_to_domain(struct domain *d, unsigned int irq,
 int map_range_to_domain(const struct dt_device_node *dev,
                         uint64_t addr, uint64_t len, void *data);
 
-extern const char __ro_after_init_start[], __ro_after_init_end[];
-
 struct init_info
 {
     /* Pointer to the stack, used by head.S when entering in C */
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index ac34c69855..b01e83a8ed 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -5,7 +5,6 @@
 #include <asm/numa.h>
 
 extern const char __2M_text_start[], __2M_text_end[];
-extern const char __ro_after_init_start[], __ro_after_init_end[];
 extern const char __2M_rodata_start[], __2M_rodata_end[];
 extern char __2M_init_start[], __2M_init_end[];
 extern char __2M_rwdata_start[], __2M_rwdata_end[];
diff --git a/xen/include/xen/sections.h b/xen/include/xen/sections.h
index fe49d7d0e6..cd542bfe10 100644
--- a/xen/include/xen/sections.h
+++ b/xen/include/xen/sections.h
@@ -5,6 +5,9 @@
 
 #include <xen/compiler.h>
 
+/* SAF-0-safe */
+extern const char __ro_after_init_start[], __ro_after_init_end[];
+
 /* SAF-0-safe */
 extern char __init_begin[], __init_end[];
 #define is_init_section(p) ({                           \
-- 
2.49.0
Re: [PATCH v1] xen: move __ro_after_init section symbols to xen/sections.h
Posted by Julien Grall 4 months ago
Hi Oleksii,

On 18/06/2025 10:13, Oleksii Kurochko wrote:
> Instead of declaring __ro_after_init_{start,end} in each architecture's
> asm/setup.h, move these declarations to the common header xen/sections.h.
> 
> This centralizes the declarations and reduces duplication across
> architectures.
> 
> No functional change intended.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Acked-by: Julien Grall <jgrall@amazon.com>

I also don't have a strong opinion either way about Jan's comment about 
the placement.

Cheers,

-- 
Julien Grall
Re: [PATCH v1] xen: move __ro_after_init section symbols to xen/sections.h
Posted by Jan Beulich 4 months, 2 weeks ago
On 18.06.2025 11:13, Oleksii Kurochko wrote:
> Instead of declaring __ro_after_init_{start,end} in each architecture's
> asm/setup.h, move these declarations to the common header xen/sections.h.
> 
> This centralizes the declarations and reduces duplication across
> architectures.
> 
> No functional change intended.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

It can probably go in as-is, hence
Acked-by: Jan Beulich <jbeulich@suse.com>
but ...

> --- a/xen/include/xen/sections.h
> +++ b/xen/include/xen/sections.h
> @@ -5,6 +5,9 @@
>  
>  #include <xen/compiler.h>
>  
> +/* SAF-0-safe */
> +extern const char __ro_after_init_start[], __ro_after_init_end[];
> +
>  /* SAF-0-safe */
>  extern char __init_begin[], __init_end[];
>  #define is_init_section(p) ({                           \

... I generally dislike this pattern of adding to the front, as if the
addition was more important than what's there already. But maybe that's
indeed just me ...

Jan