Use macros rather than hardcoding section names
Subsystems (13)
v4 cover Use macros rather than hardcoding section names
This patch series cleans up the kernel's explicit references to .data.page_aligned, .bss.page_aligned, and .data.init_task in C and assembly code to instead use the standard macros for that purpose.
Version 4 differs from version 3 in two ways:
- It is rebased on top of current kbuild-next/master
- __LINKER_SCRIPT__ was renamed to LINKER_SCRIPT
Version 3 differs from version 2 in two ways:
- The .data.init_task patch also updates the score architecture
- The powerpc __page_aligned_data patch was removed (since Benjamin Herrenschmidt said he was taking it).
Version 2 differed from version 1 in that it added the kbuild patch, fixing breakage in the x86 linker script caused indirectly by including linux/linkage.h in x86's asm/cache.h.
This cleanup is in preparation for being able to change the names of the .data.page_aligned and .bss.page_aligned sections to be compatible with -ffunction-sections -fdata-sections (a prerequisite for Ksplice).
Joe Perches (1):
Use new __init_task_data macro in arch init_task.c files.
Tim Abbott (3):
kbuild: Don't define ALIGN and ENTRY when preprocessing linker
scripts.
Use macros for .bss.page_aligned section.
Use macros for .data.page_aligned section.
arch/arm/kernel/init_task.c | 5 ++--- arch/avr32/kernel/init_task.c | 5 ++--- arch/avr32/mm/init.c | 4 +--- arch/cris/kernel/process.c | 5 ++--- arch/frv/kernel/init_task.c | 5 ++--- arch/h8300/kernel/init_task.c | 5 ++--- arch/ia64/kernel/init_task.c | 3 ++- arch/m32r/kernel/init_task.c | 5 ++--- arch/m68k/kernel/process.c | 6 +++--- arch/m68knommu/kernel/init_task.c | 5 ++--- arch/microblaze/kernel/init_task.c | 5 ++--- arch/mips/kernel/init_task.c | 5 ++--- arch/mn10300/kernel/init_task.c | 5 ++--- arch/parisc/kernel/init_task.c | 4 ++-- arch/powerpc/kernel/init_task.c | 5 ++--- arch/powerpc/kernel/machine_kexec_64.c | 5 +++-- arch/powerpc/kernel/vdso.c | 3 ++- arch/powerpc/kernel/vdso32/vdso32_wrapper.S | 3 ++- arch/powerpc/kernel/vdso64/vdso64_wrapper.S | 3 ++- arch/s390/kernel/init_task.c | 5 ++--- arch/s390/kernel/vdso.c | 2 +- arch/s390/kernel/vdso32/vdso32_wrapper.S | 3 ++- arch/s390/kernel/vdso64/vdso64_wrapper.S | 3 ++- arch/score/kernel/init_task.c | 5 ++--- arch/sh/kernel/init_task.c | 5 ++--- arch/sh/kernel/irq.c | 6 ++---- arch/sparc/kernel/init_task.c | 5 ++--- arch/um/kernel/init_task.c | 5 ++--- arch/x86/include/asm/cache.h | 4 +++- arch/x86/kernel/head_32.S | 4 ++-- arch/x86/kernel/head_64.S | 2 +- arch/x86/kernel/init_task.c | 5 ++--- arch/xtensa/kernel/head.S | 2 +- arch/xtensa/kernel/init_task.c | 5 ++--- include/linux/linkage.h | 2 ++ scripts/Makefile.build | 2 +- 36 files changed, 70 insertions(+), 81 deletions(-)
PATCH v4 1/4 kbuild: Don't define ALIGN and ENTRY when preprocessing linker scripts.
Adding a reference to <linux/linkage.h> to x86's <asm/cache.h> causes the x86 linker script to have syntax errors, because the ALIGN and ENTRY keywords get redefined to the assembly implementations of those. One could fix this by adjusting the include structure, but I think any solution based on that approach would be fragile.
Currently, it is impossible when writing a header to do something different for assembly files and linker scripts, even though there are clearly cases where one wants them to define macros differently for the two (ENTRY being an excellent example). So I think the right solution here is to introduce a new preprocessor definition, tentatively called LINKER_SCRIPT that is set along with __ASSEMBLY__ for linker scripts, and to use that to not define ALIGN and ENTRY in linker scripts. I suspect we'll find other uses for this mechanism in the future.
--- include/linux/linkage.h | 2 ++ scripts/Makefile.build | 2 +- 2 files changed, 3 insertions(+), 1 deletions(-)
include/linux/linkage.h +2 -0
@@ -57,6 +57,7 @@#ifdef __ASSEMBLY__ +#ifndef LINKER_SCRIPT #define ALIGN __ALIGN#define ALIGN_STR __ALIGN_STR
@@ -66,6 +67,7 @@ALIGN ; \ name:#endif +#endif /* LINKER_SCRIPT */ #ifndef WEAK #define WEAK (name) \
scripts/Makefile.build +1 -1
@@ -271,7 +271,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(always) # --------------------------------------------------------------------------- quiet_cmd_cpp_lds_S = LDS $@ cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \ - -D__ASSEMBLY__ -o $@ $< + -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $< $(obj)/%.lds: $(src)/%.lds.S FORCE $(call if_changed_dep,cpp_lds_S)
Signature · 1 line
1.6.3.3
PATCH v4 2/4 Use new __init_task_data macro in arch init_task.c files.
In reply to Tim AbbottFrom: Joe Perches <[email protected]>
--- arch/arm/kernel/init_task.c | 5 ++--- arch/avr32/kernel/init_task.c | 5 ++--- arch/cris/kernel/process.c | 5 ++--- arch/frv/kernel/init_task.c | 5 ++--- arch/h8300/kernel/init_task.c | 5 ++--- arch/ia64/kernel/init_task.c | 3 ++- arch/m32r/kernel/init_task.c | 5 ++--- arch/m68k/kernel/process.c | 6 +++--- arch/m68knommu/kernel/init_task.c | 5 ++--- arch/microblaze/kernel/init_task.c | 5 ++--- arch/mips/kernel/init_task.c | 5 ++--- arch/mn10300/kernel/init_task.c | 5 ++--- arch/parisc/kernel/init_task.c | 4 ++-- arch/powerpc/kernel/init_task.c | 5 ++--- arch/powerpc/kernel/machine_kexec_64.c | 5 +++-- arch/s390/kernel/init_task.c | 5 ++--- arch/score/kernel/init_task.c | 5 ++--- arch/sh/kernel/init_task.c | 5 ++--- arch/sparc/kernel/init_task.c | 5 ++--- arch/um/kernel/init_task.c | 5 ++--- arch/x86/kernel/init_task.c | 5 ++--- arch/xtensa/kernel/init_task.c | 5 ++--- 22 files changed, 46 insertions(+), 62 deletions(-)
arch/arm/kernel/init_task.c +2 -3
@@ -24,9 +24,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);* * The things we do for performance.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };/* * Initial task structure.
arch/avr32/kernel/init_task.c +2 -3
@@ -18,9 +18,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);/* * Initial thread structure. Must be aligned on an 8192-byte boundary. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };/* * Initial task structure.
arch/cris/kernel/process.c +2 -3
@@ -45,9 +45,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);* way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };/* * Initial task structure.
arch/frv/kernel/init_task.c +2 -3
@@ -19,9 +19,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);* way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };/* * Initial task structure.
arch/h8300/kernel/init_task.c +2 -3
@@ -31,7 +31,6 @@ EXPORT_SYMBOL(init_task);* way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };
arch/ia64/kernel/init_task.c +2 -1
@@ -33,7 +33,8 @@ union {struct thread_info thread_info; } s;unsigned long stack[KERNEL_STACK_SIZE /sizeof (unsigned long )]; -} init_task_mem asm ("init_task") __attribute__((section(".data.init_task"))) = {{ +} init_task_mem asm ("init_task") __init_task_data = + {{ .task = INIT_TASK(init_task_mem.s.task), .thread_info = INIT_THREAD_INFO(init_task_mem.s.task) }};
arch/m32r/kernel/init_task.c +2 -3
@@ -20,9 +20,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);* way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };/* * Initial task structure.
arch/m68k/kernel/process.c +3 -3
@@ -42,9 +42,9 @@*/ static struct signal_struct init_signals =INIT_SIGNALS (init_signals);static struct sighand_struct init_sighand =INIT_SIGHAND (init_sighand); -union thread_union init_thread_union -__attribute__((section (".data.init_task" ),aligned (THREAD_SIZE ))) - = { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data + __attribute__((aligned(THREAD_SIZE))) = + {INIT_THREAD_INFO (init_task) };/* initial task structure */ struct task_struct init_task =INIT_TASK (init_task);
arch/m68knommu/kernel/init_task.c +2 -3
@@ -31,7 +31,6 @@ EXPORT_SYMBOL(init_task);* way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };
arch/microblaze/kernel/init_task.c +2 -3
@@ -19,9 +19,8 @@static struct signal_struct init_signals =INIT_SIGNALS (init_signals);static struct sighand_struct init_sighand =INIT_SIGHAND (init_sighand); -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = -{ INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };struct task_struct init_task =INIT_TASK (init_task);EXPORT_SYMBOL (init_task);
arch/mips/kernel/init_task.c +2 -3
@@ -21,9 +21,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);* * The things we do for performance.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"), - __aligned__(THREAD_SIZE))) = +union thread_union init_thread_union __init_task_data + __attribute__((__aligned__(THREAD_SIZE))) = {INIT_THREAD_INFO (init_task) };/*
arch/mn10300/kernel/init_task.c +2 -3
@@ -27,9 +27,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);* way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };/* * Initial task structure.
arch/parisc/kernel/init_task.c +2 -2
@@ -43,8 +43,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);* way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((aligned(128))) __attribute__((__section__(".data.init_task"))) = +union thread_union init_thread_union __init_task_data + __attribute__((aligned(128))) = {INIT_THREAD_INFO (init_task) };#if PT_NLEVELS ==3
arch/powerpc/kernel/init_task.c +2 -3
@@ -16,9 +16,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);* way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };/* * Initial task structure.
arch/powerpc/kernel/machine_kexec_64.c +3 -2
@@ -13,6 +13,7 @@#include <linux/kexec.h> #include <linux/smp.h> #include <linux/thread_info.h> +#include <linux/init_task.h> #include <linux/errno.h> #include <asm/page.h>
@@ -249,8 +250,8 @@ static void kexec_prepare_cpus(void)* We could use a smaller stack if we don't care about anything using * current, but that audit has not been performed. */ -static union thread_union kexec_stack - __attribute__((__section__(".data.init_task"))) = { }; +static union thread_union kexec_stack __init_task_data = + { };/* Our assembly helper, in kexec_stub.S */ extern NORET_TYPE void kexec_sequence(void *newstack, unsigned long start,
arch/s390/kernel/init_task.c +2 -3
@@ -25,9 +25,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);* way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };/* * Initial task structure.
arch/score/kernel/init_task.c +2 -3
@@ -34,9 +34,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);* way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"), __aligned__(THREAD_SIZE))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };/* * Initial task structure.
arch/sh/kernel/init_task.c +2 -3
@@ -17,9 +17,8 @@ struct pt_regs fake_swapper_regs;* way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };/* * Initial task structure.
arch/sparc/kernel/init_task.c +2 -3
@@ -18,6 +18,5 @@ EXPORT_SYMBOL(init_task);* If this is not aligned on a 8k boundry, then you should change code * in etrap.S which assumes it. */ -union thread_union init_thread_union - __attribute__((section (".data.init_task"))) - = { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };
arch/um/kernel/init_task.c +2 -3
@@ -30,9 +30,8 @@ EXPORT_SYMBOL(init_task);* "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) }; union thread_union cpu0_irqstack __attribute__((__section__(".data.init_irqstack"))) =
arch/x86/kernel/init_task.c +2 -3
@@ -20,9 +20,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);* way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };/* * Initial task structure.
arch/xtensa/kernel/init_task.c +2 -3
@@ -23,9 +23,8 @@static struct signal_struct init_signals =INIT_SIGNALS (init_signals);static struct sighand_struct init_sighand =INIT_SIGHAND (init_sighand); -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = -{ INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + {INIT_THREAD_INFO (init_task) };struct task_struct init_task =INIT_TASK (init_task);
Signature · 1 line
1.6.3.3
PATCH v4 3/4 Use macros for .bss.page_aligned section.
In reply to Tim AbbottThis patch changes the remaining direct references to .bss.page_aligned in C and assembly code to use the macros in include/linux/linkage.h.
--- arch/sh/kernel/irq.c | 6 ++---- arch/x86/kernel/head_32.S | 2 +- arch/x86/kernel/head_64.S | 2 +- arch/xtensa/kernel/head.S | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-)
arch/sh/kernel/irq.c +2 -4
@@ -165,11 +165,9 @@ asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs) }#ifdef CONFIG_IRQSTACKS -static char softirq_stack[NR_CPUS * THREAD_SIZE] - __attribute__((__section__(".bss.page_aligned"))); +static char softirq_stack[NR_CPUS * THREAD_SIZE] __page_aligned_bss; -static char hardirq_stack[NR_CPUS * THREAD_SIZE] - __attribute__((__section__(".bss.page_aligned"))); +static char hardirq_stack[NR_CPUS * THREAD_SIZE] __page_aligned_bss;/* * allocate per-cpu stacks for hardirq and for softirq processing
arch/x86/kernel/head_32.S +1 -1
@@ -608,7 +608,7 @@ ENTRY(initial_code) /* * BSS section */ -.section ".bss.page_aligned","wa" +__PAGE_ALIGNED_BSS .align PAGE_SIZE_asm #ifdef CONFIG_X86_PAE swapper_pg_pmd:
arch/x86/kernel/head_64.S +1 -1
@@ -418,7 +418,7 @@ ENTRY(phys_base) ENTRY(idt_table) .skip IDT_ENTRIES * 16 - .section .bss.page_aligned, "aw", @nobits + __PAGE_ALIGNED_BSS .align PAGE_SIZE ENTRY(empty_zero_page) .skip PAGE_SIZE
arch/xtensa/kernel/head.S +1 -1
@@ -235,7 +235,7 @@ should_never_return: * BSS section */ -.section ".bss.page_aligned", "w" +__PAGE_ALIGNED_BSS #ifdef CONFIG_MMU ENTRY(swapper_pg_dir) .fill PAGE_SIZE, 1, 0
Signature · 1 line
1.6.3.3
PATCH v4 4/4 Use macros for .data.page_aligned section.
In reply to Tim AbbottThis patch changes the remaining direct references to .data.page_aligned in C and assembly code to use the macros in include/linux/linkage.h.
--- arch/avr32/mm/init.c | 4 +--- arch/powerpc/kernel/vdso.c | 3 ++- arch/powerpc/kernel/vdso32/vdso32_wrapper.S | 3 ++- arch/powerpc/kernel/vdso64/vdso64_wrapper.S | 3 ++- arch/s390/kernel/vdso.c | 2 +- arch/s390/kernel/vdso32/vdso32_wrapper.S | 3 ++- arch/s390/kernel/vdso64/vdso64_wrapper.S | 3 ++- arch/x86/include/asm/cache.h | 4 +++- arch/x86/kernel/head_32.S | 2 +- 9 files changed, 16 insertions(+), 11 deletions(-)
arch/avr32/mm/init.c +1 -3
@@ -24,11 +24,9 @@#include <asm/setup.h> #include <asm/sections.h> -#define __page_aligned __attribute__((section(".data.page_aligned"))) - DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); -pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned; +pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_data;struct page *empty_zero_page;EXPORT_SYMBOL (empty_zero_page);
arch/powerpc/kernel/vdso.c +2 -1
@@ -1,3 +1,4 @@ +/* * Copyright (C) 2004 Benjamin Herrenschmidt, IBM Corp. * <[email protected]>
@@ -74,7 +75,7 @@ static int vdso_ready;static union {struct vdso_data data;u8 page[PAGE_SIZE ]; -} vdso_data_store __attribute__((__section__(".data.page_aligned"))); +} vdso_data_store __page_aligned_data;struct vdso_data *vdso_data = &vdso_data_store.data;/* Format of the patch table */
arch/powerpc/kernel/vdso32/vdso32_wrapper.S +2 -1
@@ -1,7 +1,8 @@ #include <linux/init.h> +#include <linux/linkage.h> #include <asm/page.h> - .section ".data.page_aligned" + __PAGE_ALIGNED_DATA .globl vdso32_start, vdso32_end .balign PAGE_SIZE
arch/powerpc/kernel/vdso64/vdso64_wrapper.S +2 -1
@@ -1,7 +1,8 @@ #include <linux/init.h> +#include <linux/linkage.h> #include <asm/page.h> - .section ".data.page_aligned" + __PAGE_ALIGNED_DATA .globl vdso64_start, vdso64_end .balign PAGE_SIZE
arch/s390/kernel/vdso.c +1 -1
@@ -75,7 +75,7 @@ __setup("vdso=", vdso_setup);static union {struct vdso_data data;u8 page[PAGE_SIZE ]; -} vdso_data_store __attribute__((__section__(".data.page_aligned"))); +} vdso_data_store __page_aligned_data;struct vdso_data *vdso_data = &vdso_data_store.data;/*
arch/s390/kernel/vdso32/vdso32_wrapper.S +2 -1
@@ -1,7 +1,8 @@ #include <linux/init.h> +#include <linux/linkage.h> #include <asm/page.h> - .section ".data.page_aligned" + __PAGE_ALIGNED_DATA .globl vdso32_start, vdso32_end .balign PAGE_SIZE
arch/s390/kernel/vdso64/vdso64_wrapper.S +2 -1
@@ -1,7 +1,8 @@ #include <linux/init.h> +#include <linux/linkage.h> #include <asm/page.h> - .section ".data.page_aligned" + __PAGE_ALIGNED_DATA .globl vdso64_start, vdso64_end .balign PAGE_SIZE
arch/x86/include/asm/cache.h +3 -1
@@ -1,6 +1,8 @@#ifndef _ASM_X86_CACHE_H#define _ASM_X86_CACHE_H +#include <linux/linkage.h> +/* L1 cache line size */ #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
@@ -13,7 +15,7 @@#ifdef CONFIG_SMP #define __cacheline_aligned_in_smp \ __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT)))) \ - __attribute__((__section__(".data.page_aligned"))) + __page_aligned_data#endif #endif
arch/x86/kernel/head_32.S +1 -1
@@ -626,7 +626,7 @@ ENTRY(empty_zero_page) * This starts the data section. */ #ifdef CONFIG_X86_PAE -.section ".data.page_aligned","wa" +__PAGE_ALIGNED_DATA /* Page-aligned for the benefit of paravirt? */ .align PAGE_SIZE_asm ENTRY(swapper_pg_dir)
Signature · 1 line
1.6.3.3
Re: [PATCH v4 4/4] Use macros for .data.page_aligned section.
Quoted 9 lines · Tim Abbott
This patch changes the remaining direct references to .data.page_aligned in C and assembly code to use the macros in
include/linux/linkage.h.Signed-off-by Tim Abbott <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc H. Peter Anvin <[email protected]>Cc Haavard Skinnemoen <[email protected]>
Quoted 154 lines
Cc Paul Mackerras <[email protected]>Cc Martin Schwidefsky <[email protected]>Cc Sam Ravnborg <[email protected]>--- arch/avr32/mm/init.c | 4 +--- arch/powerpc/kernel/vdso.c | 3 ++- arch/powerpc/kernel/vdso32/vdso32_wrapper.S | 3 ++- arch/powerpc/kernel/vdso64/vdso64_wrapper.S | 3 ++- arch/s390/kernel/vdso.c | 2 +- arch/s390/kernel/vdso32/vdso32_wrapper.S | 3 ++- arch/s390/kernel/vdso64/vdso64_wrapper.S | 3 ++- arch/x86/include/asm/cache.h | 4 +++- arch/x86/kernel/head_32.S | 2 +- 9 files changed, 16 insertions(+), 11 deletions(-)arch/avr32/mm/init.c +1
-3@@ -24,11 +24,9 @@#include <asm/setup.h> #include <asm/sections.h> -#define __page_aligned __attribute__((section(".data.page_aligned"))) - DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); -pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned; +pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_data;struct page *empty_zero_page;EXPORT_SYMBOL (empty_zero_page);arch/powerpc/kernel/vdso.c +2
-1@@ -1,3 +1,4 @@ +/* * Copyright (C) 2004 Benjamin Herrenschmidt, IBM Corp. * <[email protected]> @@ -74,7 +75,7 @@ static int vdso_ready;static union {struct vdso_data data;u8 page[PAGE_SIZE ]; -} vdso_data_store __attribute__((__section__(".data.page_aligned"))); +} vdso_data_store __page_aligned_data;struct vdso_data *vdso_data = &vdso_data_store.data;/* Format of the patch table */ arch/powerpc/kernel/vdso32/vdso32_wrapper.S +2
-1@@ -1,7 +1,8 @@ #include <linux/init.h> +#include <linux/linkage.h> #include <asm/page.h> - .section ".data.page_aligned" + __PAGE_ALIGNED_DATA .globl vdso32_start, vdso32_end .balign PAGE_SIZEarch/powerpc/kernel/vdso64/vdso64_wrapper.S +2
-1@@ -1,7 +1,8 @@ #include <linux/init.h> +#include <linux/linkage.h> #include <asm/page.h> - .section ".data.page_aligned" + __PAGE_ALIGNED_DATA .globl vdso64_start, vdso64_end .balign PAGE_SIZEarch/s390/kernel/vdso.c +1
-1@@ -75,7 +75,7 @@ __setup("vdso=", vdso_setup);static union {struct vdso_data data;u8 page[PAGE_SIZE ]; -} vdso_data_store __attribute__((__section__(".data.page_aligned"))); +} vdso_data_store __page_aligned_data;struct vdso_data *vdso_data = &vdso_data_store.data;/* arch/s390/kernel/vdso32/vdso32_wrapper.S +2
-1@@ -1,7 +1,8 @@ #include <linux/init.h> +#include <linux/linkage.h> #include <asm/page.h> - .section ".data.page_aligned" + __PAGE_ALIGNED_DATA .globl vdso32_start, vdso32_end .balign PAGE_SIZEarch/s390/kernel/vdso64/vdso64_wrapper.S +2
-1@@ -1,7 +1,8 @@ #include <linux/init.h> +#include <linux/linkage.h> #include <asm/page.h> - .section ".data.page_aligned" + __PAGE_ALIGNED_DATA .globl vdso64_start, vdso64_end .balign PAGE_SIZEarch/x86/include/asm/cache.h +3
-1@@ -1,6 +1,8 @@#ifndef _ASM_X86_CACHE_H#define _ASM_X86_CACHE_H +#include <linux/linkage.h> +/* L1 cache line size */ #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)@@ -13,7 +15,7 @@#ifdef CONFIG_SMP #define __cacheline_aligned_in_smp \ __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT)))) \ - __attribute__((__section__(".data.page_aligned"))) + __page_aligned_data#endif #endif arch/x86/kernel/head_32.S +1
-1@@ -626,7 +626,7 @@ ENTRY(empty_zero_page) * This starts the data section. */ #ifdef CONFIG_X86_PAE -.section ".data.page_aligned","wa" +__PAGE_ALIGNED_DATA /* Page-aligned for the benefit of paravirt? */ .align PAGE_SIZE_asm ENTRY(swapper_pg_dir)
Re: [PATCH v4 4/4] Use macros for .data.page_aligned section.
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 4 lines · Tim Abbott
This patch changes the remaining direct references to .data.page_aligned in C and assembly code to use the macros in
include/linux/linkage.h.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Tim Abbott <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc H. Peter Anvin <[email protected]>Cc Haavard Skinnemoen <[email protected]>
Thanks for the ack Benjamin.
I already sent a pull that includes this patchset - expect to land in mainline soon.
The changes all looked trivially correct so I wanted it pulled so I could batch two of the kbuild stuff for this merge window.
Sam
Re: [PATCH v4 4/4] Use macros for .data.page_aligned section.
Quoted 12 lines · Sam Ravnborg
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 9 lines · Tim Abbott
This patch changes the remaining direct references to .data.page_aligned in C and assembly code to use the macros in
include/linux/linkage.h.Signed-off-by Tim Abbott <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc H. Peter Anvin <[email protected]>Cc Haavard Skinnemoen <[email protected]>
Quoted 7 lines
Quoted 1 line
Thanks for the ack Benjamin.
I already sent a pull that includes this patchset - expect to land in mainline soon.
The changes all looked trivially correct so I wanted it pulled so I could batch two of the kbuild stuff for this merge window.
That's ok, I've been a bit slow looking at it I'm afraid.
Ben.
Re: [PATCH v4 4/4] Use macros for .data.page_aligned section.
In reply to Benjamin HerrenschmidtQuoted 5 lines · Benjamin Herrenschmidt
Quoted 4 lines · Tim Abbott
This patch changes the remaining direct references to .data.page_aligned in C and assembly code to use the macros in
include/linux/linkage.h.
Quoted 11 lines
Quoted 5 lines
Signed-off-by Tim Abbott <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc H. Peter Anvin <[email protected]>Cc Haavard Skinnemoen <[email protected]>Quoted 3 lines
Cc Paul Mackerras <[email protected]>Cc Martin Schwidefsky <[email protected]>Cc Sam Ravnborg <[email protected]>
Quoted 22 lines · Tim Abbott
This patch series cleans up the kernel's explicit references to .data.page_aligned, .bss.page_aligned, and .data.init_task in C and assembly code to instead use the standard macros for that purpose.
Version 4 differs from version 3 in two ways:
- It is rebased on top of current kbuild-next/master
-__LINKER_SCRIPT__was renamed toLINKER_SCRIPTVersion 3 differs from version 2 in two ways:
- The .data.init_task patch also updates the score architecture
- The powerpc__page_aligned_datapatch was removed (since Benjamin Herrenschmidt said he was taking it).Version 2 differed from version 1 in that it added the kbuild patch, fixing breakage in the x86 linker script caused indirectly by including
linux/linkage.hin x86'sasm/cache.h.This cleanup is in preparation for being able to change the names of the .data.page_aligned and .bss.page_aligned sections to be compatible with -ffunction-sections -fdata-sections (a prerequisite for Ksplice).
Quoted 8 lines
Joe Perches (1):
Use new__init_task_datamacro in archinit_task.cfiles.Tim Abbott (3):
kbuild: Don't define ALIGN and ENTRY when preprocessing linker
scripts.
Use macros for .bss.page_aligned section.
Use macros for .data.page_aligned section.
Thanks - applied all 4.
Sam