Skip to contentSkip to conversation

clean up page aligned data and bss sections

PATCH In review Tim Abbott 4 participants 22 messages Apr 28, 2009 – Apr 29, 2009

Subsystems (7)
x86 PowerPC s390 SuperH +3 more subsystems
lore
Share & tools
lore

Tim Abbott

author
#0 lore raw

v2 cover clean up page aligned data and bss sections

Sam,

Here's a new version of the page-aligned section cleanup patch series. Changes since last version include:

- added missing semicolons for ALIGN() directives in the macro definitions in PATCH 1/14.
- fixed a bug in the powerpc patch where the DATA_PAGE_ALIGNED was inside a CONFIG_PPC32 in PATCH 11/14 (which is now 2 patches)

---

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

as requested by Linus.

Tim Abbott (15):
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: share .data output section definition between 32 and 64
bits.
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           |   13 ++++---------
 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, 53 insertions(+), 74 deletions(-)
author
#1 lore raw

PATCH v2 1/15 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..3d88c87 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 v2 2/15 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 v2 3/15 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 v2 4/15 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 v2 5/15 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 3068388..8f2a18b 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 54b29bb..ae9a453 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 62ad500..db882aa 100644
@@ -185,7 +185,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 6d5a5b0..424fb87 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 v2 6/15 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 v2 7/15 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
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 v2 8/15 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 v2 9/15 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 v2 10/15 powerpc: Remove unused __page_aligned macro.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[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 v2 11/15 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]>
Cc Paul Mackerras <[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 a047a6c..47899b0 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
#12 lore raw

PATCH v2 12/15 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]>
Cc Paul Mackerras <[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 47899b0..d3dcea0 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
author
#13 lore raw

PATCH v2 13/15 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
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
#14 lore raw

PATCH v2 14/15 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 db882aa..fdb0642 100644
@@ -79,7 +79,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
#15 lore raw

PATCH v2 15/15 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 8f2a18b..f2a44f3 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 fdb0642..57cbcf2 100644
@@ -64,6 +64,7 @@ SECTIONS
   /* writeable */
   . = ALIGN(PAGE_SIZE);
   .data : AT(ADDR(.data) - LOAD_OFFSET) {	/* Data */
+	PAGE_ALIGNED_DATA
 	DATA_DATA
 	CONSTRUCTORS
 	} :data
@@ -76,11 +77,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 424fb87..5b74dc9 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 v2 13/15
#16 lore raw

Re: [PATCH v2 13/15] mn10300: Drop unused .data.idt section.

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

Quoted 7 lines

CCing the author and people who acked that patch in case there was a reason it wasn't applied.

#17 lore raw

Re: [PATCH v2 12/15] powerpc: Use macros for .data.page_aligned section.

In reply to Tim Abbott

arch/powerpc/kernel/vdso.c static int vdso_ready; · line 77

Quoted 10 lines · Tim Abbott
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
                                        ^

Surely we need a semicolon here? -------|

Paul.

Acked-by on v2 1/15
#19 lore raw

Re: [PATCH v2 01/15] Add new macros for page-aligned data and bss sections.

In reply to Tim Abbott
Quoted 5 lines · Tim Abbott

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.

Quoted 7 lines

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

author
#20 lore raw
In reply to Tim Abbott
Quoted 2 lines · Tim Abbott

Here's a new version of the page-aligned section cleanup patch series. Changes since last version include:

Sam,

I am close to having prepared another 4 patch series of similar size to this one for .data.nosave, .data.cacheline_aligned, .data.init_task, and .data.read_mostly. Along with this page-aligned series and the things that have already been merged, I think these are all of the major cross-architecture patchsets needed for -ffunction-sections (there will remain a good number of section names that only appear on one or two architectures).

It seems with this set of patches that we're going to bother all the arch maintainers several times if we handle these all completely independently (especially since each patch series has patches that depend on patches from the previous one). So, I was thinking perhaps we should proceed as follows:

(1) I send a patch series that does the architecture-independent macro additions as well as the changes for one architecture (say, x86) to use those macros so that they can be reviewed along with the actual usage.

(2) We get those reviewed and merge at least the architecture-independent patches

(3) I can send one patch series for each architecture that is just using the macros that have already been merged; then the patch series are nicely decoupled and each arch maintainer only has to ack a single set of changes to their architecture.

Does this plan make sense?

-Tim Abbott

#21 lore raw
Quoted 25 lines · Tim Abbott
Quoted 2 lines · Tim Abbott

Here's a new version of the page-aligned section cleanup patch series. Changes since last version include:

Sam,

I am close to having prepared another 4 patch series of similar size to this one for .data.nosave, .data.cacheline_aligned, .data.init_task, and .data.read_mostly. Along with this page-aligned series and the things that have already been merged, I think these are all of the major cross-architecture patchsets needed for -ffunction-sections (there will remain a good number of section names that only appear on one or two architectures).

It seems with this set of patches that we're going to bother all the arch maintainers several times if we handle these all completely independently (especially since each patch series has patches that depend on patches from the previous one). So, I was thinking perhaps we should proceed as follows:

(1) I send a patch series that does the architecture-independent macro additions as well as the changes for one architecture (say, x86) to use those macros so that they can be reviewed along with the actual usage.

Quoted 7 lines

(2) We get those reviewed and merge at least the architecture-independent patches

(3) I can send one patch series for each architecture that is just using the macros that have already been merged; then the patch series are nicely decoupled and each arch maintainer only has to ack a single set of changes to their architecture.

Yes - lets get the support stuff applied first and work out from there. I plan to apply your patches to kbuild-next during the weekend so we have them in a tree that hits -next.

Sam