Skip to contentSkip to conversation

clean up page aligned data and bss sections

PATCH Superseded Tim Abbott 6 participants 29 messages Apr 27, 2009 – Apr 28, 2009

Subsystems (7)
x86 PowerPC s390 SuperH +3 more subsystems

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Tim Abbott

author
#0 lore raw

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(-)
author
#1 lore raw

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
index 89853bc..d6ae1bd 100644
@@ -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
index fee9e59..af051fc 100644
@@ -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
author
#2 lore raw

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
index 3f1372e..9853fde 100644
@@ -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
index dd9b2ee..99a4124 100644
@@ -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
index 6966446..cb46577 100644
@@ -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
author
#3 lore raw

PATCH 3/14 mn10300: Use macros for .bss.page_aligned section.

Cc David Howells <[email protected]>
---
 arch/mn10300/kernel/vmlinux.lds.S |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/mn10300/kernel/vmlinux.lds.S +1 -1
index 24de6b9..6ad0fa8 100644
@@ -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
author
#4 lore raw

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
index d9ddc1b..d215adc 100644
@@ -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
index 5accf51..f96f354 100644
@@ -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
author
#5 lore raw

PATCH 5/14 x86: Use macros for .bss.page_aligned section.

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(-)
arch/x86/kernel/head_32.S +1 -1
index a299ecc..9694aee 100644
@@ -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
index dbb6fb5..7cd4956 100644
@@ -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
index bfe9efd..594aabc 100644
@@ -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
index 0e27ecd..9b52841 100644
@@ -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
author
#6 lore raw

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.

Cc Richard Henderson <[email protected]>
---
 arch/alpha/kernel/vmlinux.lds.S |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/alpha/kernel/vmlinux.lds.S +1 -5
index b9d6568..2f33cf9 100644
@@ -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
author
#7 lore raw

PATCH 7/14 avr32: Use standard macros for .data.page_aligned section.

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(-)
arch/avr32/kernel/vmlinux.lds.S +1 -2
index 7910d41..36d676f 100644
@@ -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
index e819fa6..cc60d10 100644
@@ -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
author
#8 lore raw

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
index 99a4124..325af0b 100644
@@ -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
index cb46577..b222700 100644
@@ -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
author
#9 lore raw

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.

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
index 89b2e7f..eff6fba 100644
@@ -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
index 61639a8..ae42f8c 100644
@@ -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
index d8e2ac1..c245842 100644
@@ -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
index 89399b8..d552089 100644
@@ -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
author
#10 lore raw

PATCH 10/14 powerpc: Remove unused __page_aligned macro.

Cc Benjamin Herrenschmidt <[email protected]>
---
 arch/powerpc/include/asm/page_64.h |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/page_64.h +0 -8
index 043bfdf..20f9c74 100644
@@ -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
author
#11 lore raw

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.

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(-)
arch/powerpc/kernel/vdso.c +1 -1
index ad06d5c..841910a 100644
@@ -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
index 556f0ca..6e8f507 100644
@@ -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
index 0529cb9..b8553d6 100644
@@ -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
index 433ae11..cb4a7ca 100644
@@ -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
author
#12 lore raw

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.

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 -3
index 6ad0fa8..364250f 100644
@@ -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
author
#13 lore raw

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
index a1d2883..d7affb7 100644
@@ -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
index 594aabc..a57d39c 100644
@@ -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
author
#14 lore raw

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
index 9694aee..ad0510d 100644
@@ -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
index a57d39c..b458ab4 100644
@@ -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
index 9b52841..056db9a 100644
@@ -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
Acked-by on v1 12/14
#15 lore raw

Re: [PATCH 12/14] mn10300: Drop unused .data.idt section.

In reply to Tim Abbott
Quoted 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.

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
index 6ad0fa8..364250f 100644
@@ -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!

author
#16 lore raw

Re: [PATCH 11/14] powerpc: Use macros for .data.page_aligned section.

In reply to Tim Abbott

arch/powerpc/kernel/vmlinux.lds.S SECTIONS · line 228

Quoted 9 lines · Tim Abbott

+++ b/arch/powerpc/kernel/vmlinux.lds.S

arch/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

author
#17 lore raw

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.

Cc Benjamin Herrenschmidt <[email protected]>
---
 arch/powerpc/kernel/vmlinux.lds.S |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
arch/powerpc/kernel/vmlinux.lds.S +3 -4
index 433ae11..4f0f7d1 100644
@@ -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
author
#18 lore raw

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.

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(-)
arch/powerpc/kernel/vdso.c +1 -1
index ad06d5c..841910a 100644
@@ -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
index 556f0ca..6e8f507 100644
@@ -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
index 0529cb9..b8553d6 100644
@@ -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
index 4f0f7d1..30ec994 100644
@@ -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
#19 lore raw

Re: [PATCH 11/14] powerpc: Use macros for .data.page_aligned section.

In reply to Tim Abbott

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).

Quoted 11 lines · On Mon, 27 Apr 2009 16:33:05 -0400 Tim Abbott <[email protected]> wrote:

+++ b/arch/powerpc/kernel/vmlinux.lds.S

arch/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/
author
#20 lore raw

Re: [PATCH 11/14] powerpc: Use macros for .data.page_aligned section.

Quoted 2 lines · Stephen Rothwell

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

#21 lore raw

Re: [PATCH 11/14] powerpc: Use macros for .data.page_aligned section.

In reply to Stephen Rothwell
Quoted 3 lines · On Wed, 29 Apr 2009 01:07:53 +1000 Stephen Rothwell <[email protected]>…

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.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#22 lore raw

Re: [PATCH 09/14] s390: Use macros for .data.page_aligned.

In reply to Tim Abbott
Quoted 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
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
index 89b2e7f..eff6fba 100644
@@ -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
index 61639a8..ae42f8c 100644
@@ -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
index d8e2ac1..c245842 100644
@@ -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 -6
index 89399b8..d552089 100644
@@ -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

#25 lore raw

Re: [PATCH 03/14] mn10300: Use macros for .bss.page_aligned section.

In reply to Tim Abbott

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 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

author
#26 lore raw

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 find PAGE_ALIGNED_BSS

Quoted 6 lines

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

#27 lore raw

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
index a76275f..c9b16a6 100644
@@ -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