[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] xen: introduce common macros for per-CPU sections defintion



commit 11eb4e2969c15be701f4485b5770834439682b47
Author:     Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
AuthorDate: Tue Sep 24 18:42:27 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Sep 25 12:12:35 2024 +0100

    xen: introduce common macros for per-CPU sections defintion
    
    Introduce PERCPU_BSS macro which manages:
     * Alignment of the section start
     * Insertion of per-CPU data sections
     * Alignment and start/end markers for per-CPU data
    This change simplifies the linker script maintenance and ensures a unified
    approach for per-CPU sections across different architectures.
    
    Refactor the linker scripts for Arm, PPC, and x86 architectures by using
    the common macro PERCPU_BSS defined in xen/xen.lds.h to handle per-CPU
    data sections.
    
    No functional changes.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
    Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/arm/xen.lds.S    |  9 +--------
 xen/arch/ppc/xen.lds.S    |  9 +--------
 xen/arch/riscv/xen.lds.S  |  9 +--------
 xen/arch/x86/xen.lds.S    |  9 +--------
 xen/include/xen/xen.lds.h | 10 ++++++++++
 5 files changed, 14 insertions(+), 32 deletions(-)

diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index bd884664ad..0987052f1a 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -198,14 +198,7 @@ SECTIONS
        __bss_start = .;
        *(.bss.stack_aligned)
        *(.bss.page_aligned)
-       . = ALIGN(PAGE_SIZE);
-       __per_cpu_start = .;
-       *(.bss.percpu.page_aligned)
-       *(.bss.percpu)
-       . = ALIGN(SMP_CACHE_BYTES);
-       *(.bss.percpu.read_mostly)
-       . = ALIGN(SMP_CACHE_BYTES);
-       __per_cpu_data_end = .;
+       PERCPU_BSS
        *(.bss .bss.*)
        . = ALIGN(POINTER_ALIGN);
        __bss_end = .;
diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S
index 38cd857187..0c4b94814b 100644
--- a/xen/arch/ppc/xen.lds.S
+++ b/xen/arch/ppc/xen.lds.S
@@ -148,14 +148,7 @@ SECTIONS
         __bss_start = .;
         *(.bss.stack_aligned)
         *(.bss.page_aligned)
-        . = ALIGN(PAGE_SIZE);
-        __per_cpu_start = .;
-        *(.bss.percpu.page_aligned)
-        *(.bss.percpu)
-        . = ALIGN(SMP_CACHE_BYTES);
-        *(.bss.percpu.read_mostly)
-        . = ALIGN(SMP_CACHE_BYTES);
-        __per_cpu_data_end = .;
+        PERCPU_BSS
         *(.bss .bss.*)
         . = ALIGN(POINTER_ALIGN);
         __bss_end = .;
diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S
index 070b19d915..871b47a235 100644
--- a/xen/arch/riscv/xen.lds.S
+++ b/xen/arch/riscv/xen.lds.S
@@ -145,14 +145,7 @@ SECTIONS
         __bss_start = .;
         *(.bss.stack_aligned)
         *(.bss.page_aligned)
-        . = ALIGN(PAGE_SIZE);
-        __per_cpu_start = .;
-        *(.bss.percpu.page_aligned)
-        *(.bss.percpu)
-        . = ALIGN(SMP_CACHE_BYTES);
-        *(.bss.percpu.read_mostly)
-        . = ALIGN(SMP_CACHE_BYTES);
-        __per_cpu_data_end = .;
+        PERCPU_BSS
         *(.sbss .sbss.* .bss .bss.*)
         . = ALIGN(POINTER_ALIGN);
         __bss_end = .;
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index d48de67cfd..b60d2f0d82 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -321,14 +321,7 @@ SECTIONS
   DECL_SECTION(.bss) {
        __bss_start = .;
        *(.bss.page_aligned*)
-       . = ALIGN(PAGE_SIZE);
-       __per_cpu_start = .;
-       *(.bss.percpu.page_aligned)
-       *(.bss.percpu)
-       . = ALIGN(SMP_CACHE_BYTES);
-       *(.bss.percpu.read_mostly)
-       . = ALIGN(SMP_CACHE_BYTES);
-       __per_cpu_data_end = .;
+       PERCPU_BSS
        *(.bss .bss.*)
        . = ALIGN(POINTER_ALIGN);
        __bss_end = .;
diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
index a17810bb28..24b8900ffe 100644
--- a/xen/include/xen/xen.lds.h
+++ b/xen/include/xen/xen.lds.h
@@ -151,6 +151,16 @@
 #define LOCK_PROFILE_DATA
 #endif
 
+#define PERCPU_BSS                 \
+       . = ALIGN(PAGE_SIZE);       \
+       __per_cpu_start = .;        \
+       *(.bss.percpu.page_aligned) \
+       *(.bss.percpu)              \
+       . = ALIGN(SMP_CACHE_BYTES); \
+       *(.bss.percpu.read_mostly)  \
+       . = ALIGN(SMP_CACHE_BYTES); \
+       __per_cpu_data_end = .;     \
+
 #ifdef CONFIG_HAS_VPCI
 #define VPCI_ARRAY               \
        . = ALIGN(POINTER_ALIGN); \
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.