clean up page aligned data and bss sections
cover clean up page aligned data and bss sections
Sam,
This patch series add new macros for .data.page_aligned and .bss.page_aligned, and converts the various architectures to use them. It also eliminates the few remaining uses of .data.idt by replacing them with references to .data.page_aligned.
This patch series is a bunch of cleanup in preparation for being able to change the names of the .data.page_aligned and .bss.page_aligned sections to be compatabible with -ffunction-sections -fdata-sections.
The x86 patches are on top of the your commit in the x86/kbuild of linux-tip entitled:
x86: beautify vmlinux_64.lds.S
-Tim Abbott--
Tim Abbott (14):
Add new macros for page-aligned data and bss sections.
sh: Use macros for .bss.page_aligned section.
mn10300: Use macros for .bss.page_aligned section.
xtensa: Use macros for .bss.page_aligned section.
x86: Use macros for .bss.page_aligned section.
alpha: Use macros for .data.page_aligned.
avr32: Use standard macros for .data.page_aligned section.
sh: Use macros for .data.page_aligned section.
s390: Use macros for .data.page_aligned.
powerpc: Remove unused __page_aligned macro.
powerpc: Use macros for .data.page_aligned section.
mn10300: Drop unused .data.idt section.
x86: Use section .data.page_aligned for the idt_table.
x86: Use macros for .data.page_aligned.
arch/alpha/kernel/vmlinux.lds.S | 6 +----- arch/avr32/kernel/vmlinux.lds.S | 3 +-- arch/avr32/mm/init.c | 4 +--- arch/mn10300/kernel/vmlinux.lds.S | 5 +---- arch/powerpc/include/asm/page_64.h | 8 -------- arch/powerpc/kernel/vdso.c | 2 +- arch/powerpc/kernel/vdso32/vdso32_wrapper.S | 3 ++- arch/powerpc/kernel/vdso64/vdso64_wrapper.S | 3 ++- arch/powerpc/kernel/vmlinux.lds.S | 6 +----- arch/s390/kernel/vdso.c | 2 +- arch/s390/kernel/vdso32/vdso32_wrapper.S | 3 ++- arch/s390/kernel/vdso64/vdso64_wrapper.S | 3 ++- arch/s390/kernel/vmlinux.lds.S | 6 +----- arch/sh/kernel/irq.c | 6 ++---- arch/sh/kernel/vmlinux_32.lds.S | 5 ++--- arch/sh/kernel/vmlinux_64.lds.S | 5 ++--- arch/x86/kernel/head_32.S | 4 ++-- arch/x86/kernel/head_64.S | 2 +- arch/x86/kernel/traps.c | 6 ++---- arch/x86/kernel/vmlinux_32.lds.S | 9 ++------- arch/x86/kernel/vmlinux_64.lds.S | 8 ++------ arch/xtensa/kernel/head.S | 2 +- arch/xtensa/kernel/vmlinux.lds.S | 2 +- include/asm-generic/vmlinux.lds.h | 8 ++++++++ include/linux/linkage.h | 9 +++++++++ 25 files changed, 50 insertions(+), 70 deletions(-)
PATCH 1/14 Add new macros for page-aligned data and bss sections.
This patch is preparation for replacing most uses of ".bss.page_aligned" and ".data.page_aligned" in the kernel with macros, so that the section name can later be changed without having to touch a lot of the kernel.
The long-term goal here is to be able to change the kernel's magic section names to those that are compatible with -ffunction-sections -fdata-sections. This requires renaming all magic sections with names of the form ".data.foo".
--- include/asm-generic/vmlinux.lds.h | 8 ++++++++ include/linux/linkage.h | 9 +++++++++ 2 files changed, 17 insertions(+), 0 deletions(-)
include/asm-generic/vmlinux.lds.h +8 -0
@@ -116,6 +116,14 @@ FTRACE_EVENTS() \ TRACE_SYSCALLS() +#define PAGE_ALIGNED_DATA \ + . = ALIGN(PAGE_SIZE) \ + *(.data.page_aligned) + +#define PAGE_ALIGNED_BSS \ + . = ALIGN(PAGE_SIZE) \ + *(.bss.page_aligned) +#define RO_DATA (align) \ . = ALIGN((align)); \ .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
include/linux/linkage.h +9 -0
@@ -22,6 +22,15 @@#define __page_aligned_bss __section(.bss.page_aligned) __aligned(PAGE_SIZE)/* +* For assembly routines. +* +* Note when using these that you must specify the appropriate +* alignment directives yourself +*/ +#define __PAGE_ALIGNED_DATA .section ".data.page_aligned", "aw", @progbits +#define __PAGE_ALIGNED_BSS .section ".bss.page_aligned", "aw", @nobits + +/* * This is used by architectures to keep arguments on the stack * untouched by the compiler by keeping them live until the end. * The argument stack may be owned by the assembly-language
Signature · 1 line
1.6.2.1
PATCH 2/14 sh: Use macros for .bss.page_aligned section.
--- arch/sh/kernel/irq.c | 6 ++---- arch/sh/kernel/vmlinux_32.lds.S | 2 +- arch/sh/kernel/vmlinux_64.lds.S | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-)
arch/sh/kernel/irq.c +2 -4
@@ -157,11 +157,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/sh/kernel/vmlinux_32.lds.S +1 -1
@@ -131,7 +131,7 @@ SECTIONS .bss : { __init_end = .; __bss_start = .; /* BSS */ - *(.bss.page_aligned) + PAGE_ALIGNED_BSS *(.bss) *(COMMON) . = ALIGN(4);
arch/sh/kernel/vmlinux_64.lds.S +1 -1
@@ -140,7 +140,7 @@ SECTIONS .bss : C_PHYS(.bss) { __init_end = .; __bss_start = .; /* BSS */ - *(.bss.page_aligned) + PAGE_ALIGNED_BSS *(.bss) *(COMMON) . = ALIGN(4);
Signature · 1 line
1.6.2.1
PATCH 3/14 mn10300: Use macros for .bss.page_aligned section.
--- arch/mn10300/kernel/vmlinux.lds.S | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/mn10300/kernel/vmlinux.lds.S +1 -1
@@ -131,7 +131,7 @@ SECTIONS __bss_start = .; /* BSS */ .bss : { - *(.bss.page_aligned) + PAGE_ALIGNED_BSS *(.bss) } . = ALIGN(4);
Signature · 1 line
1.6.2.1
PATCH 4/14 xtensa: Use macros for .bss.page_aligned section.
--- arch/xtensa/kernel/head.S | 2 +- arch/xtensa/kernel/vmlinux.lds.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
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
arch/xtensa/kernel/vmlinux.lds.S +1 -1
@@ -262,7 +262,7 @@ SECTIONS /* BSS section */ _bss_start = .; - .bss : { *(.bss.page_aligned) *(.bss) } + .bss : { PAGE_ALIGNED_BSS *(.bss) } _bss_end = .; _end = .;
Signature · 1 line
1.6.2.1
PATCH 5/14 x86: Use macros for .bss.page_aligned section.
--- arch/x86/kernel/head_32.S | 2 +- arch/x86/kernel/head_64.S | 2 +- arch/x86/kernel/vmlinux_32.lds.S | 2 +- arch/x86/kernel/vmlinux_64.lds.S | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/head_32.S +1 -1
@@ -618,7 +618,7 @@ ENTRY(_stext) /* * 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
@@ -419,7 +419,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/x86/kernel/vmlinux_32.lds.S +1 -1
@@ -182,7 +182,7 @@ SECTIONS .bss : AT(ADDR(.bss) - LOAD_OFFSET) { __init_end = .; __bss_start = .; /* BSS */ - *(.bss.page_aligned) + PAGE_ALIGNED_BSS *(.bss) . = ALIGN(4); __bss_stop = .;
arch/x86/kernel/vmlinux_64.lds.S +1 -1
@@ -283,7 +283,7 @@ SECTIONS .bss : AT(ADDR(.bss) - LOAD_OFFSET) { . = ALIGN(PAGE_SIZE); __bss_start = .; /* BSS */ - *(.bss.page_aligned) + PAGE_ALIGNED_BSS *(.bss) __bss_stop = .; }
Signature · 1 line
1.6.2.1
PATCH 6/14 alpha: Use macros for .data.page_aligned.
.data.page_aligned should not need a separate output section, so as part of this cleanup I moved into the .data output section in the linker scripts in order to eliminate unnecessary references to the section name.
--- arch/alpha/kernel/vmlinux.lds.S | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
arch/alpha/kernel/vmlinux.lds.S +1 -5
@@ -97,11 +97,6 @@ SECTIONS *(.data.init_thread) } - . = ALIGN(PAGE_SIZE); - .data.page_aligned : { - *(.data.page_aligned) - } - . = ALIGN(64); .data.cacheline_aligned : { *(.data.cacheline_aligned)
@@ -110,6 +105,7 @@ SECTIONS _data = .; /* Data */ .data : { + PAGE_ALIGNED_DATA DATA_DATA CONSTRUCTORS }
Signature · 1 line
1.6.2.1
PATCH 7/14 avr32: Use standard macros for .data.page_aligned section.
--- arch/avr32/kernel/vmlinux.lds.S | 3 +-- arch/avr32/mm/init.c | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-)
arch/avr32/kernel/vmlinux.lds.S +1 -2
@@ -98,8 +98,7 @@ SECTIONS *(.data.init_task) /* Then, the page-aligned data */ - . = ALIGN(PAGE_SIZE); - *(.data.page_aligned) + PAGE_ALIGNED_DATA /* Then, the cacheline aligned data */ . = ALIGN(L1_CACHE_BYTES);
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);
Signature · 1 line
1.6.2.1
PATCH 8/14 sh: Use macros for .data.page_aligned section.
--- arch/sh/kernel/vmlinux_32.lds.S | 3 +-- arch/sh/kernel/vmlinux_64.lds.S | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
arch/sh/kernel/vmlinux_32.lds.S +1 -2
@@ -69,8 +69,7 @@ SECTIONS . = ALIGN(L1_CACHE_BYTES); *(.data.read_mostly) - . = ALIGN(PAGE_SIZE); - *(.data.page_aligned) + PAGE_ALIGNED_DATA __nosave_begin = .; *(.data.nosave)
arch/sh/kernel/vmlinux_64.lds.S +1 -2
@@ -78,8 +78,7 @@ SECTIONS . = ALIGN(L1_CACHE_BYTES); *(.data.read_mostly) - . = ALIGN(PAGE_SIZE); - *(.data.page_aligned) + PAGE_ALIGNED_DATA __nosave_begin = .; *(.data.nosave)
Signature · 1 line
1.6.2.1
PATCH 9/14 s390: Use macros for .data.page_aligned.
.data.page_aligned should not need a separate output section, so as part of this cleanup I moved into the .data output section in the linker scripts in order to eliminate unnecessary references to the section name.
Remove the reference to .data.idt, since nothing is put into the .data.idt section on the s390 architecture. It looks like Cyrill Gorcunov posted a patch to remove the .data.idt code on s390 previously:
<http://lkml.indiana.edu/hypermail/linux/kernel/0802.2/2536.html>
CCing him and the people who acked that patch in case there's a reason it wasn't applied.
--- arch/s390/kernel/vdso.c | 2 +- arch/s390/kernel/vdso32/vdso32_wrapper.S | 3 ++- arch/s390/kernel/vdso64/vdso64_wrapper.S | 3 ++- arch/s390/kernel/vmlinux.lds.S | 6 +----- 4 files changed, 6 insertions(+), 8 deletions(-)
arch/s390/kernel/vdso.c +1 -1
@@ -64,7 +64,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/s390/kernel/vmlinux.lds.S +1 -5
@@ -59,6 +59,7 @@ SECTIONS } :data .data : { /* Data */ + PAGE_ALIGNED_DATA DATA_DATA CONSTRUCTORS }
@@ -71,11 +72,6 @@ SECTIONS . = ALIGN(PAGE_SIZE); __nosave_end = .; - . = ALIGN(PAGE_SIZE); - .data.page_aligned : { - *(.data.idt) - } - . = ALIGN(0x100); .data.cacheline_aligned : { *(.data.cacheline_aligned)
Signature · 1 line
1.6.2.1
PATCH 10/14 powerpc: Remove unused __page_aligned macro.
--- arch/powerpc/include/asm/page_64.h | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/page_64.h +0 -8
@@ -152,14 +152,6 @@ do { \#endif /* !CONFIG_HUGETLB_PAGE */ -#ifdef MODULE -#define __page_aligned __attribute__((__aligned__(PAGE_SIZE))) -#else -#define __page_aligned \ - __attribute__((__aligned__(PAGE_SIZE), \ - __section__(".data.page_aligned"))) -#endif -#define VM_DATA_DEFAULT_FLAGS \ (test_thread_flag(TIF_32BIT) ? \ VM_DATA_DEFAULT_FLAGS32 : VM_DATA_DEFAULT_FLAGS64)
Signature · 1 line
1.6.2.1
PATCH 11/14 powerpc: Use macros for .data.page_aligned section.
.data.page_aligned should not need a separate output section, so as part of this cleanup I moved into the .data output section in the linker scripts in order to eliminate unnecessary references to the section name.
Note that this change moves the page-aligned data inside _edata. Since it _is_ data, I suspect having page-aligned data outside _edata was a bug. Please comment if it is not.
--- arch/powerpc/kernel/vdso.c | 2 +- arch/powerpc/kernel/vdso32/vdso32_wrapper.S | 3 ++- arch/powerpc/kernel/vdso64/vdso64_wrapper.S | 3 ++- arch/powerpc/kernel/vmlinux.lds.S | 6 +----- 4 files changed, 6 insertions(+), 8 deletions(-)
arch/powerpc/kernel/vdso.c +1 -1
@@ -74,7 +74,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/powerpc/kernel/vmlinux.lds.S +1 -5
@@ -222,6 +222,7 @@ SECTIONS #ifdef CONFIG_PPC32 .data : AT(ADDR(.data) - LOAD_OFFSET) { + PAGE_ALIGNED_DATA DATA_DATA *(.sdata) *(.got.plt) *(.got)
@@ -259,11 +260,6 @@ SECTIONS *(.data.init_task) } - . = ALIGN(PAGE_SIZE); - .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { - *(.data.page_aligned) - } - .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { *(.data.cacheline_aligned) }
Signature · 1 line
1.6.2.1
PATCH 12/14 mn10300: Drop unused .data.idt section.
Since nothing gets put into .data.idt on this architecture, eliminate it from the linker script.
This change was apparently proposed previously:
<http://lkml.indiana.edu/hypermail/linux/kernel/0802.2/2538.html>
CCing the author and people who acked that patch in case there was a reason it wasn't applied.
--- arch/mn10300/kernel/vmlinux.lds.S | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
arch/mn10300/kernel/vmlinux.lds.S +0 -3
@@ -59,9 +59,6 @@ SECTIONS . = ALIGN(PAGE_SIZE); __nosave_end = .; - . = ALIGN(PAGE_SIZE); - .data.page_aligned : { *(.data.idt) } - . = ALIGN(32); .data.cacheline_aligned : { *(.data.cacheline_aligned) }
Signature · 1 line
1.6.2.1
PATCH 13/14 x86: Use section .data.page_aligned for the idt_table.
The .data.idt section is just squashed into the .data.page_aligned output section by the linker script anyway, so it might as well be in the .data.page_aligned section.
This eliminates all references to .data.idt on x86.
--- arch/x86/kernel/traps.c | 6 ++---- arch/x86/kernel/vmlinux_32.lds.S | 1 - 2 files changed, 2 insertions(+), 5 deletions(-)
arch/x86/kernel/traps.c +2 -4
@@ -73,11 +73,9 @@ char ignore_fpu_irq;/* * The IDT has to be page-aligned to simplify the Pentium -* F0 0F bug workaround.. We have a special link segment -* for this. +* F0 0F bug workaround. */ -gate_desc idt_table[256] - __attribute__((__section__(".data.idt"))) = { { { { 0, 0 } } }, }; +gate_desc idt_table[256] __page_aligned_data = { { { { 0, 0 } } }, };#endif DECLARE_BITMAP (used_vectors,NR_VECTORS );
arch/x86/kernel/vmlinux_32.lds.S +0 -1
@@ -76,7 +76,6 @@ SECTIONS . = ALIGN(PAGE_SIZE); .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { *(.data.page_aligned) - *(.data.idt) } . = ALIGN(32);
Signature · 1 line
1.6.2.1
PATCH 14/14 x86: Use macros for .data.page_aligned.
.data.page_aligned should not need a separate output section. So, as part of this cleanup I moved it into the .data output section in the linker scripts in order to eliminate unnecessary references to the section name.
--- arch/x86/kernel/head_32.S | 2 +- arch/x86/kernel/vmlinux_32.lds.S | 6 +----- arch/x86/kernel/vmlinux_64.lds.S | 6 +----- 3 files changed, 3 insertions(+), 11 deletions(-)
arch/x86/kernel/head_32.S +1 -1
@@ -636,7 +636,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)
arch/x86/kernel/vmlinux_32.lds.S +1 -5
@@ -61,6 +61,7 @@ SECTIONS /* writeable */ . = ALIGN(PAGE_SIZE); .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */ + PAGE_ALIGNED_DATA DATA_DATA CONSTRUCTORS } :data
@@ -73,11 +74,6 @@ SECTIONS __nosave_end = .; } - . = ALIGN(PAGE_SIZE); - .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { - *(.data.page_aligned) - } - . = ALIGN(32); .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { *(.data.cacheline_aligned)
arch/x86/kernel/vmlinux_64.lds.S +1 -5
@@ -64,6 +64,7 @@ SECTIONS . = ALIGN(PAGE_SIZE); /* Data */ .data : AT(ADDR(.data) - LOAD_OFFSET) { + PAGE_ALIGNED_DATA DATA_DATA CONSTRUCTORS /* End of data section */
@@ -157,11 +158,6 @@ SECTIONS *(.data.init_task) } :data.init - .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { - . = ALIGN(PAGE_SIZE); - *(.data.page_aligned) - } - .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { /* might get freed after init */ . = ALIGN(PAGE_SIZE);
Signature · 1 line
1.6.2.1
Re: [PATCH 12/14] mn10300: Drop unused .data.idt section.
In reply to Tim AbbottQuoted 33 lines · Tim Abbott
Since nothing gets put into .data.idt on this architecture, eliminate it from the linker script.
This change was apparently proposed previously:
<http://lkml.indiana.edu/hypermail/linux/kernel/0802.2/2538.html>CCing the author and people who acked that patch in case there was a reason it wasn't applied.
Signed-off-by Tim Abbott <[email protected]>Cc David Howells <[email protected]>Cc Cyrill Gorcunov <[email protected]>Cc Sam Ravnborg <[email protected]>--- arch/mn10300/kernel/vmlinux.lds.S | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)arch/mn10300/kernel/vmlinux.lds.S +0
-4@@ -59,9 +59,6 @@ SECTIONS . = ALIGN(PAGE_SIZE); __nosave_end = .; - . = ALIGN(PAGE_SIZE); - .data.page_aligned : { *(.data.idt) } - . = ALIGN(32); .data.cacheline_aligned : { *(.data.cacheline_aligned) } --
Quoted 3 lines
1.6.2.1
Thanks Tim!
Re: [PATCH 11/14] powerpc: Use macros for .data.page_aligned section.
In reply to Tim Abbottarch/powerpc/kernel/vmlinux.lds.S SECTIONS · line 228
Quoted 9 lines · Tim Abbott
+++
b/arch/powerpc/kernel/vmlinux.lds.Sarch/powerpc/kernel/vmlinux.lds.S +1
-0@@ -222,6 +222,7 @@ SECTIONS #ifdef CONFIG_PPC32 .data : AT(ADDR(.data) - LOAD_OFFSET) { + PAGE_ALIGNED_DATA DATA_DATA *(.sdata) *(.got.plt) *(.got)
Just noticed that PAGE_ALIGNED_DATA is only being added for CONFIG_PPC32.
Since there will be several more FOO_DATA macros being added to the .data section, I think the right fix is to first unify the two .data output section definitions, and then convert to using PAGE_ALIGNED_DATA.
-Tim Abbott
PATCH 1/2 powerpc: share .data output section definition between 32 and 64 bits.
Since upcoming changes will add several more common pieces of code between the 32-bit and 64-bit powerpc architectures, it seems best to unify these two blocks.
--- arch/powerpc/kernel/vmlinux.lds.S | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
arch/powerpc/kernel/vmlinux.lds.S +3 -4
@@ -220,20 +220,19 @@ SECTIONS . = ALIGN(PAGE_SIZE); _sdata = .; -#ifdef CONFIG_PPC32 .data : AT(ADDR(.data) - LOAD_OFFSET) { DATA_DATA +#ifdef CONFIG_PPC32 *(.sdata) *(.got.plt) *(.got) - } #else - .data : AT(ADDR(.data) - LOAD_OFFSET) { - DATA_DATA *(.data.rel*) *(.toc1) *(.branch_lt) +#endif } +#ifndef CONFIG_PPC32 .opd : AT(ADDR(.opd) - LOAD_OFFSET) { *(.opd) }
Signature · 1 line
1.6.2.1
PATCH 2/2 powerpc: Use macros for .data.page_aligned section.
.data.page_aligned should not need a separate output section, so as part of this cleanup I moved into the .data output section in the linker scripts in order to eliminate unnecessary references to the section name.
Note that this change moves the page-aligned data inside _edata. Since it _is_ data, I suspect having page-aligned data outside _edata was a bug. Please comment if it is not.
--- arch/powerpc/kernel/vdso.c | 2 +- arch/powerpc/kernel/vdso32/vdso32_wrapper.S | 3 ++- arch/powerpc/kernel/vdso64/vdso64_wrapper.S | 3 ++- arch/powerpc/kernel/vmlinux.lds.S | 6 +----- 4 files changed, 6 insertions(+), 8 deletions(-)
arch/powerpc/kernel/vdso.c +1 -1
@@ -74,7 +74,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/powerpc/kernel/vmlinux.lds.S +1 -5
@@ -221,6 +221,7 @@ SECTIONS _sdata = .; .data : AT(ADDR(.data) - LOAD_OFFSET) { + PAGE_ALIGNED_DATA DATA_DATA #ifdef CONFIG_PPC32 *(.sdata)
@@ -258,11 +259,6 @@ SECTIONS *(.data.init_task) } - . = ALIGN(PAGE_SIZE); - .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { - *(.data.page_aligned) - } - .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { *(.data.cacheline_aligned) }
Signature · 1 line
1.6.2.1
Re: [PATCH 11/14] powerpc: Use macros for .data.page_aligned section.
In reply to Tim AbbottHi Tim,
Firstly, patches for a particular architecture should really be cc'd to the list associated with that architecture. In this case, [email protected] (cc'd).
Quoted 11 lines · On Mon, 27 Apr 2009 16:33:05 -0400 Tim Abbott <[email protected]> wrote:
+++
b/arch/powerpc/kernel/vmlinux.lds.Sarch/powerpc/kernel/vmlinux.lds.S +1
-0@@ -222,6 +222,7 @@ SECTIONS #ifdef CONFIG_PPC32 .data : AT(ADDR(.data) - LOAD_OFFSET) { + PAGE_ALIGNED_DATA DATA_DATA *(.sdata) *(.got.plt) *(.got)
arch/powerpc/kernel/vmlinux.lds.S SECTIONS · line 266
Quoted 8 lines
arch/powerpc/kernel/vmlinux.lds.S +0
-5@@ -259,11 +260,6 @@ SECTIONS *(.data.init_task) } - . = ALIGN(PAGE_SIZE); - .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { - *(.data.page_aligned) - } -
This moves the page_aligned section from a common part of the vmlinux.lds to a 32 bit only part. Was that intentional?
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Re: [PATCH 11/14] powerpc: Use macros for .data.page_aligned section.
Quoted 2 lines · Stephen Rothwell
This moves the
page_alignedsection from a common part of thevmlinux.ldsto a 32 bit only part. Was that intentional?
No. See my reply to this patch from last night
<http://lkml.org/lkml/2009/4/28/16> and the revised pair of patches in reply to that message that replace PATCH 11/14.
-Tim Abbott
Re: [PATCH 11/14] powerpc: Use macros for .data.page_aligned section.
In reply to Stephen RothwellQuoted 3 lines · On Wed, 29 Apr 2009 01:07:53 +1000 Stephen Rothwell <[email protected]>…
This moves the
page_alignedsection from a common part of thevmlinux.ldsto a 32 bit only part. Was that intentional?
Just saw your later patches, so ignore this.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Re: [PATCH 09/14] s390: Use macros for .data.page_aligned.
In reply to Tim AbbottQuoted 10 lines · Tim Abbott
.data.page_aligned should not need a separate output section, so as part of this cleanup I moved into the .data output section in the linker scripts in order to eliminate unnecessary references to the section name.
Remove the reference to .data.idt, since nothing is put into the .data.idt section on the s390 architecture. It looks like Cyrill Gorcunov posted a patch to remove the .data.idt code on s390 previously:
Quoted 5 lines
<http://lkml.indiana.edu/hypermail/linux/kernel/0802.2/2536.html>
CCing him and the people who acked that patch in case there's a reason it wasn't applied.
It was not applied case of being a bit buggy. You've fixed it as well. Thanks and my ack if needed.
Quoted 82 lines
Signed-off-by Tim Abbott <[email protected]>Cc Martin Schwidefsky <[email protected]>Cc Cyrill Gorcunov <[email protected]>Cc Sam Ravnborg <[email protected]>--- arch/s390/kernel/vdso.c | 2 +- arch/s390/kernel/vdso32/vdso32_wrapper.S | 3 ++- arch/s390/kernel/vdso64/vdso64_wrapper.S | 3 ++- arch/s390/kernel/vmlinux.lds.S | 6 +----- 4 files changed, 6 insertions(+), 8 deletions(-)arch/s390/kernel/vdso.c +1
-1@@ -64,7 +64,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/s390/kernel/vmlinux.lds.S +1
-6@@ -59,6 +59,7 @@ SECTIONS } :data .data : { /* Data */ + PAGE_ALIGNED_DATA DATA_DATA CONSTRUCTORS }@@ -71,11 +72,6 @@ SECTIONS . = ALIGN(PAGE_SIZE); __nosave_end = .; - . = ALIGN(PAGE_SIZE); - .data.page_aligned : { - *(.data.idt) - } - . = ALIGN(0x100); .data.cacheline_aligned : { *(.data.cacheline_aligned) --1.6.2.1
Re: [PATCH 08/14] sh: Use macros for .data.page_aligned section.
In reply to Tim AbbottQuoted 7 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>Cc Paul Mundt <[email protected]>--- arch/sh/kernel/vmlinux_32.lds.S | 3 +-- arch/sh/kernel/vmlinux_64.lds.S | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
Re: [PATCH 07/14] avr32: Use standard macros for .data.page_aligned section.
In reply to Tim AbbottQuoted 2 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>Cc Haavard Skinnemoen <[email protected]>
Assuming the definition of PAGE_ALIGNED_DATA is sane,
Re: [PATCH 03/14] mn10300: Use macros for .bss.page_aligned section.
In reply to Tim Abbottarch/mn10300/kernel/vmlinux.lds.S SECTIONS · line 134
Quoted 2 lines · Tim Abbott
arch/mn10300/kernel/vmlinux.lds.S +1
-1- *(.bss.page_aligned) + PAGE_ALIGNED_BSS
/opt/nickc/H-i686-pc-linux-gnulibc2.3/bin/am33_2.0-linux-gnu-ld: cannot find PAGE_ALIGNED_BSS
warthog>grep -r PAGE_ALIGNED_BSS include/linux/ warthog1>grep -r PAGE_ALIGNED_BSS include/asm-generic/ warthog1>grep -r PAGE_ALIGNED_BSS arch/frv/ warthog1>
I take it that wasn't what you meant.
David
Re: [PATCH 03/14] mn10300: Use macros for .bss.page_aligned section.
Quoted 7 lines · David Howells
arch/mn10300/kernel/vmlinux.lds.S SECTIONS · line 134
Quoted 2 lines · Tim Abbott
arch/mn10300/kernel/vmlinux.lds.S +1
-1- *(.bss.page_aligned) + PAGE_ALIGNED_BSS
/opt/nickc/H-i686-pc-linux-gnulibc2.3/bin/am33_2.0-linux-gnu-ld: cannot findPAGE_ALIGNED_BSS
Quoted 6 lines
warthog>grep -r
PAGE_ALIGNED_BSSinclude/linux/warthog1>grep -rPAGE_ALIGNED_BSSinclude/asm-generic/warthog1>grep -rPAGE_ALIGNED_BSSarch/frv/warthog1>I take it that wasn't what you meant.
No, it is. The macro is new in PATCH 1/14 of this series.
-Tim Abbott
Re: [PATCH 03/14] mn10300: Use macros for .bss.page_aligned section.
Quoted 1 line · Tim Abbott
No, it is. The macro is new in PATCH 1/14 of this series.
Aha! Okay, I've applied that patch too, and now I see:
LD .tmp_vmlinux1
/opt/nickc/H-i686-pc-linux-gnulibc2.3/bin/am33_2.0-linux-gnu-ld:arch/mn10300/kernel/vmlinux.lds:237: syntax error
Where the error occurs on line 237, which is:
__bss_start = .; /* BSS */
.bss : {
. = ALIGN(+(1 << 12)) *(.bss.page_aligned)
*(.bss)
==> }
. = ALIGN(4);
__bss_stop = .;in the expanded linker script.
The problem is that your patch #1 is wrong. You need to apply:
---
include/asm-generic/vmlinux.lds.h +2 -2
@@ -118,11 +118,11 @@ TRACE_SYSCALLS()#define PAGE_ALIGNED_DATA \ - . = ALIGN(PAGE_SIZE) \ + . = ALIGN(PAGE_SIZE); \ *(.data.page_aligned)#define PAGE_ALIGNED_BSS \ - . = ALIGN(PAGE_SIZE) \ + . = ALIGN(PAGE_SIZE); \ *(.bss.page_aligned)#define RO_DATA (align) \
---
to it.
David
Re: [PATCH 02/14] sh: Use macros for .bss.page_aligned section.
In reply to Tim AbbottQuoted 8 lines · Tim Abbott
Signed-off-by Tim Abbott <[email protected]>Cc Paul Mundt <[email protected]>--- arch/sh/kernel/irq.c | 6 ++---- arch/sh/kernel/vmlinux_32.lds.S | 2 +- arch/sh/kernel/vmlinux_64.lds.S | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-)