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(-)
Signed-off-by: Tim Abbott <[email protected]>
Cc: Chris Zankel <[email protected]>
---
arch/xtensa/kernel/head.S | 2 +-
arch/xtensa/kernel/vmlinux.lds.S | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S
index d9ddc1b..d215adc 100644
--- a/arch/xtensa/kernel/head.S
+++ b/arch/xtensa/kernel/head.S
@@ -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
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index 5accf51..f96f354 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -262,7 +262,7 @@ SECTIONS
/* BSS section */
_bss_start = .;
- .bss : { *(.bss.page_aligned) *(.bss) }
+ .bss : { PAGE_ALIGNED_BSS *(.bss) }
_bss_end = .;
_end = .;
--
1.6.2.1
Signed-off-by: Tim Abbott <[email protected]>
Cc: Haavard Skinnemoen <[email protected]>
---
arch/avr32/kernel/vmlinux.lds.S | 3 +--
arch/avr32/mm/init.c | 4 +---
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/avr32/kernel/vmlinux.lds.S b/arch/avr32/kernel/vmlinux.lds.S
index 7910d41..36d676f 100644
--- a/arch/avr32/kernel/vmlinux.lds.S
+++ b/arch/avr32/kernel/vmlinux.lds.S
@@ -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);
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index e819fa6..cc60d10 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -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);
--
1.6.2.1
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(-)
diff --git a/arch/mn10300/kernel/vmlinux.lds.S b/arch/mn10300/kernel/vmlinux.lds.S
index 6ad0fa8..364250f 100644
--- a/arch/mn10300/kernel/vmlinux.lds.S
+++ b/arch/mn10300/kernel/vmlinux.lds.S
@@ -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) }
--
1.6.2.1
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.
Signed-off-by: Tim Abbott <[email protected]>
Cc: Ingo Molnar <[email protected]>
---
arch/x86/kernel/traps.c | 6 ++----
arch/x86/kernel/vmlinux_32.lds.S | 1 -
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index a1d2883..d7affb7 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -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);
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
index 594aabc..a57d39c 100644
--- a/arch/x86/kernel/vmlinux_32.lds.S
+++ b/arch/x86/kernel/vmlinux_32.lds.S
@@ -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);
--
1.6.2.1
Signed-off-by: Tim Abbott <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
---
arch/powerpc/include/asm/page_64.h | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/include/asm/page_64.h b/arch/powerpc/include/asm/page_64.h
index 043bfdf..20f9c74 100644
--- a/arch/powerpc/include/asm/page_64.h
+++ b/arch/powerpc/include/asm/page_64.h
@@ -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)
--
1.6.2.1
Signed-off-by: Tim Abbott <[email protected]>
Cc: David Howells <[email protected]>
---
arch/mn10300/kernel/vmlinux.lds.S | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/mn10300/kernel/vmlinux.lds.S b/arch/mn10300/kernel/vmlinux.lds.S
index 24de6b9..6ad0fa8 100644
--- a/arch/mn10300/kernel/vmlinux.lds.S
+++ b/arch/mn10300/kernel/vmlinux.lds.S
@@ -131,7 +131,7 @@ SECTIONS
__bss_start = .; /* BSS */
.bss : {
- *(.bss.page_aligned)
+ PAGE_ALIGNED_BSS
*(.bss)
}
. = ALIGN(4);
--
1.6.2.1
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(-)
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 3f1372e..9853fde 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -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
diff --git a/arch/sh/kernel/vmlinux_32.lds.S b/arch/sh/kernel/vmlinux_32.lds.S
index dd9b2ee..99a4124 100644
--- a/arch/sh/kernel/vmlinux_32.lds.S
+++ b/arch/sh/kernel/vmlinux_32.lds.S
@@ -131,7 +131,7 @@ SECTIONS
.bss : {
__init_end = .;
__bss_start = .; /* BSS */
- *(.bss.page_aligned)
+ PAGE_ALIGNED_BSS
*(.bss)
*(COMMON)
. = ALIGN(4);
diff --git a/arch/sh/kernel/vmlinux_64.lds.S b/arch/sh/kernel/vmlinux_64.lds.S
index 6966446..cb46577 100644
--- a/arch/sh/kernel/vmlinux_64.lds.S
+++ b/arch/sh/kernel/vmlinux_64.lds.S
@@ -140,7 +140,7 @@ SECTIONS
.bss : C_PHYS(.bss) {
__init_end = .;
__bss_start = .; /* BSS */
- *(.bss.page_aligned)
+ PAGE_ALIGNED_BSS
*(.bss)
*(COMMON)
. = ALIGN(4);
--
1.6.2.1
.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.
Signed-off-by: Tim Abbott <[email protected]>
Cc: Ingo Molnar <[email protected]>
---
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(-)
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 9694aee..ad0510d 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -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)
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
index a57d39c..b458ab4 100644
--- a/arch/x86/kernel/vmlinux_32.lds.S
+++ b/arch/x86/kernel/vmlinux_32.lds.S
@@ -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)
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S
index 9b52841..056db9a 100644
--- a/arch/x86/kernel/vmlinux_64.lds.S
+++ b/arch/x86/kernel/vmlinux_64.lds.S
@@ -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);
--
1.6.2.1
.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.
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(-)
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
index 89b2e7f..eff6fba 100644
--- a/arch/s390/kernel/vdso.c
+++ b/arch/s390/kernel/vdso.c
@@ -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;
/*
diff --git a/arch/s390/kernel/vdso32/vdso32_wrapper.S b/arch/s390/kernel/vdso32/vdso32_wrapper.S
index 61639a8..ae42f8c 100644
--- a/arch/s390/kernel/vdso32/vdso32_wrapper.S
+++ b/arch/s390/kernel/vdso32/vdso32_wrapper.S
@@ -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
diff --git a/arch/s390/kernel/vdso64/vdso64_wrapper.S b/arch/s390/kernel/vdso64/vdso64_wrapper.S
index d8e2ac1..c245842 100644
--- a/arch/s390/kernel/vdso64/vdso64_wrapper.S
+++ b/arch/s390/kernel/vdso64/vdso64_wrapper.S
@@ -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
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index 89399b8..d552089 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -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
Signed-off-by: Tim Abbott <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: H. Peter Anvin <[email protected]>
---
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(-)
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index a299ecc..9694aee 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -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:
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index dbb6fb5..7cd4956 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -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
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
index bfe9efd..594aabc 100644
--- a/arch/x86/kernel/vmlinux_32.lds.S
+++ b/arch/x86/kernel/vmlinux_32.lds.S
@@ -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 = .;
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S
index 0e27ecd..9b52841 100644
--- a/arch/x86/kernel/vmlinux_64.lds.S
+++ b/arch/x86/kernel/vmlinux_64.lds.S
@@ -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 = .;
}
--
1.6.2.1
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".
Signed-off-by: Tim Abbott <[email protected]>
Cc: Sam Ravnborg <[email protected]>
---
include/asm-generic/vmlinux.lds.h | 8 ++++++++
include/linux/linkage.h | 9 +++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 89853bc..d6ae1bd 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -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) { \
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index fee9e59..af051fc 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -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
--
1.6.2.1
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(-)
diff --git a/arch/sh/kernel/vmlinux_32.lds.S b/arch/sh/kernel/vmlinux_32.lds.S
index 99a4124..325af0b 100644
--- a/arch/sh/kernel/vmlinux_32.lds.S
+++ b/arch/sh/kernel/vmlinux_32.lds.S
@@ -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)
diff --git a/arch/sh/kernel/vmlinux_64.lds.S b/arch/sh/kernel/vmlinux_64.lds.S
index cb46577..b222700 100644
--- a/arch/sh/kernel/vmlinux_64.lds.S
+++ b/arch/sh/kernel/vmlinux_64.lds.S
@@ -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)
--
1.6.2.1
.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.
Signed-off-by: Tim Abbott <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
---
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(-)
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index ad06d5c..841910a 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -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 */
diff --git a/arch/powerpc/kernel/vdso32/vdso32_wrapper.S b/arch/powerpc/kernel/vdso32/vdso32_wrapper.S
index 556f0ca..6e8f507 100644
--- a/arch/powerpc/kernel/vdso32/vdso32_wrapper.S
+++ b/arch/powerpc/kernel/vdso32/vdso32_wrapper.S
@@ -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
diff --git a/arch/powerpc/kernel/vdso64/vdso64_wrapper.S b/arch/powerpc/kernel/vdso64/vdso64_wrapper.S
index 0529cb9..b8553d6 100644
--- a/arch/powerpc/kernel/vdso64/vdso64_wrapper.S
+++ b/arch/powerpc/kernel/vdso64/vdso64_wrapper.S
@@ -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
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 433ae11..cb4a7ca 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -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)
}
--
1.6.2.1
.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.
Signed-off-by: Tim Abbott <[email protected]>
Cc: Richard Henderson <[email protected]>
---
arch/alpha/kernel/vmlinux.lds.S | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S
index b9d6568..2f33cf9 100644
--- a/arch/alpha/kernel/vmlinux.lds.S
+++ b/arch/alpha/kernel/vmlinux.lds.S
@@ -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
}
--
1.6.2.1
On Mon, Apr 27, 2009 at 04:32:56PM -0400, Tim Abbott wrote:
> 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(-)
>
Acked-by: Paul Mundt <[email protected]>
On Mon, Apr 27, 2009 at 04:33:02PM -0400, Tim Abbott wrote:
> 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(-)
>
Acked-by: Paul Mundt <[email protected]>
Tim Abbott <[email protected]> wrote:
> - *(.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
On Tue, 28 Apr 2009, David Howells wrote:
> Tim Abbott <[email protected]> wrote:
>
> > - *(.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.
No, it is. The macro is new in PATCH 1/14 of this series.
-Tim Abbott
On Mon, 27 Apr 2009, Tim Abbott wrote:
> +++ b/arch/powerpc/kernel/vmlinux.lds.S
> @@ -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
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.
Signed-off-by: Tim Abbott <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
---
arch/powerpc/kernel/vmlinux.lds.S | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 433ae11..4f0f7d1 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -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)
}
--
1.6.2.1
.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.
Signed-off-by: Tim Abbott <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
---
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(-)
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index ad06d5c..841910a 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -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 */
diff --git a/arch/powerpc/kernel/vdso32/vdso32_wrapper.S b/arch/powerpc/kernel/vdso32/vdso32_wrapper.S
index 556f0ca..6e8f507 100644
--- a/arch/powerpc/kernel/vdso32/vdso32_wrapper.S
+++ b/arch/powerpc/kernel/vdso32/vdso32_wrapper.S
@@ -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
diff --git a/arch/powerpc/kernel/vdso64/vdso64_wrapper.S b/arch/powerpc/kernel/vdso64/vdso64_wrapper.S
index 0529cb9..b8553d6 100644
--- a/arch/powerpc/kernel/vdso64/vdso64_wrapper.S
+++ b/arch/powerpc/kernel/vdso64/vdso64_wrapper.S
@@ -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
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 4f0f7d1..30ec994 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -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)
}
--
1.6.2.1
On 4/28/09, Tim Abbott <[email protected]> wrote:
> 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(-)
>
> diff --git a/arch/mn10300/kernel/vmlinux.lds.S
> b/arch/mn10300/kernel/vmlinux.lds.S
> index 6ad0fa8..364250f 100644
> --- a/arch/mn10300/kernel/vmlinux.lds.S
> +++ b/arch/mn10300/kernel/vmlinux.lds.S
> @@ -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) }
>
> --
> 1.6.2.1
>
>
Thanks Tim!
Acked-by: Cyrill Gorcunov <[email protected]>
On 4/28/09, Tim Abbott <[email protected]> wrote:
> .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.
>
It was not applied case of being a bit buggy.
You've fixed it as well. Thanks and my ack if needed.
> 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(-)
>
> diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
> index 89b2e7f..eff6fba 100644
> --- a/arch/s390/kernel/vdso.c
> +++ b/arch/s390/kernel/vdso.c
> @@ -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;
>
> /*
> diff --git a/arch/s390/kernel/vdso32/vdso32_wrapper.S
> b/arch/s390/kernel/vdso32/vdso32_wrapper.S
> index 61639a8..ae42f8c 100644
> --- a/arch/s390/kernel/vdso32/vdso32_wrapper.S
> +++ b/arch/s390/kernel/vdso32/vdso32_wrapper.S
> @@ -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
> diff --git a/arch/s390/kernel/vdso64/vdso64_wrapper.S
> b/arch/s390/kernel/vdso64/vdso64_wrapper.S
> index d8e2ac1..c245842 100644
> --- a/arch/s390/kernel/vdso64/vdso64_wrapper.S
> +++ b/arch/s390/kernel/vdso64/vdso64_wrapper.S
> @@ -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
> diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
> index 89399b8..d552089 100644
> --- a/arch/s390/kernel/vmlinux.lds.S
> +++ b/arch/s390/kernel/vmlinux.lds.S
> @@ -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
>
>
Tim Abbott <[email protected]> wrote:
> 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:
---
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index a76275f..c9b16a6 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -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
Tim Abbott wrote:
> Signed-off-by: Tim Abbott <[email protected]>
> Cc: Haavard Skinnemoen <[email protected]>
Assuming the definition of PAGE_ALIGNED_DATA is sane,
Acked-by: Haavard Skinnemoen <[email protected]>
Hi 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).
On Mon, 27 Apr 2009 16:33:05 -0400 Tim Abbott <[email protected]> wrote:
>
> +++ b/arch/powerpc/kernel/vmlinux.lds.S
> @@ -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)
> - }
> -
This moves the page_aligned section from a common part of the
vmlinux.lds to a 32 bit only part. Was that intentional?
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/
On Wed, 29 Apr 2009, Stephen Rothwell wrote:
> This moves the page_aligned section from a common part of the
> vmlinux.lds to 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
On Wed, 29 Apr 2009 01:07:53 +1000 Stephen Rothwell <[email protected]> wrote:
>
> This moves the page_aligned section from a common part of the
> vmlinux.lds to a 32 bit only part. Was that intentional?
Just saw your later patches, so ignore this.
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/