2009-05-01 00:10:35

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 0/6] section name cleanup for s390

This patch series cleans up the section names on the s390
architecture. It requires the architecture-independent macro
definitions from this patch series:

<http://www.spinics.net/lists/mips/msg33499.html>

The long-term goal here is to add support for building the kernel with
-ffunction-sections -fdata-sections. This requires renaming all the
magic section names in the kernel of the form .text.foo, .data.foo,
.bss.foo, and .rodata.foo to not have collisions with sections
generated for code like:

static int nosave = 0; /* -fdata-sections places in .data.nosave */
static void head(); /* -ffunction-sections places in .text.head */

Note that these patches have not been boot-tested (aside from testing
the analogous changes on x86), since I don't have access to the
appropriate hardware.

-Tim Abbott


Tim Abbott (6):
s390: Use macros for .data.page_aligned.
s390: use NOSAVE_DATA macro for .data.nosave section.
s390: use new macro for .data.cacheline_aligned section.
s390: use new macros for .data.init_task.
s390: use new macro for .data.read_mostly section.
s390: convert to new generic read_mostly support.

arch/s390/Kconfig | 3 ++
arch/s390/include/asm/cache.h | 2 -
arch/s390/kernel/init_task.c | 3 +-
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 | 33 ++++-------------------------
7 files changed, 14 insertions(+), 35 deletions(-)


2009-05-01 00:09:13

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 3/6] s390: use new macro for .data.cacheline_aligned section.

.data.cacheline_aligned should not need a separate output section;
this change moves it into the .data section.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: [email protected]
---
arch/s390/kernel/vmlinux.lds.S | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index 8900f98..c828398 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -61,16 +61,12 @@ SECTIONS
.data : { /* Data */
PAGE_ALIGNED_DATA
NOSAVE_DATA
+ CACHELINE_ALIGNED_DATA(0x100)
DATA_DATA
CONSTRUCTORS
}

. = ALIGN(0x100);
- .data.cacheline_aligned : {
- *(.data.cacheline_aligned)
- }
-
- . = ALIGN(0x100);
.data.read_mostly : {
*(.data.read_mostly)
}
--
1.6.2.1

2009-05-01 00:09:37

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 5/6] s390: use new macro for .data.read_mostly section.

.data.read_mostly should not need a separate output section; this
change moves it into the .data section.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: [email protected]
---
arch/s390/kernel/vmlinux.lds.S | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index b10a950..7e83e99 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -63,14 +63,10 @@ SECTIONS
PAGE_ALIGNED_DATA
NOSAVE_DATA
CACHELINE_ALIGNED_DATA(0x100)
+ READ_MOSTLY_DATA(0x100)
DATA_DATA
CONSTRUCTORS
}
-
- . = ALIGN(0x100);
- .data.read_mostly : {
- *(.data.read_mostly)
- }
_edata = .; /* End of data section */

/* will be freed after init */
--
1.6.2.1

2009-05-01 00:26:04

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 2/6] s390: use NOSAVE_DATA macro for .data.nosave section.

.data.nosave should not need a separate output section; this change
moves it into the .data section.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: [email protected]
---
arch/s390/kernel/vmlinux.lds.S | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index d552089..8900f98 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -60,18 +60,11 @@ SECTIONS

.data : { /* Data */
PAGE_ALIGNED_DATA
+ NOSAVE_DATA
DATA_DATA
CONSTRUCTORS
}

- . = ALIGN(PAGE_SIZE);
- .data_nosave : {
- __nosave_begin = .;
- *(.data.nosave)
- }
- . = ALIGN(PAGE_SIZE);
- __nosave_end = .;
-
. = ALIGN(0x100);
.data.cacheline_aligned : {
*(.data.cacheline_aligned)
--
1.6.2.1

2009-05-01 00:26:54

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 6/6] s390: convert to new generic read_mostly support.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: [email protected]
---
arch/s390/Kconfig | 3 +++
arch/s390/include/asm/cache.h | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 2eca5fe..bf6f4fb 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -75,6 +75,9 @@ config VIRT_CPU_ACCOUNTING
config ARCH_SUPPORTS_DEBUG_PAGEALLOC
def_bool y

+config HAVE_READ_MOSTLY_DATA
+ def_bool y
+
mainmenu "Linux Kernel Configuration"

config S390
diff --git a/arch/s390/include/asm/cache.h b/arch/s390/include/asm/cache.h
index 9b86681..ae5338e 100644
--- a/arch/s390/include/asm/cache.h
+++ b/arch/s390/include/asm/cache.h
@@ -14,6 +14,4 @@
#define L1_CACHE_BYTES 256
#define L1_CACHE_SHIFT 8

-#define __read_mostly __attribute__((__section__(".data.read_mostly")))
-
#endif
--
1.6.2.1

2009-05-01 00:29:06

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 4/6] s390: use new macros for .data.init_task.

.data.init_task should not need a separate output section; this change
moves it into the .data section.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: [email protected]
---
arch/s390/kernel/init_task.c | 3 +--
arch/s390/kernel/vmlinux.lds.S | 6 +-----
2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/s390/kernel/init_task.c b/arch/s390/kernel/init_task.c
index 7db95c0..e5a68f6 100644
--- a/arch/s390/kernel/init_task.c
+++ b/arch/s390/kernel/init_task.c
@@ -29,8 +29,7 @@ EXPORT_SYMBOL(init_mm);
* way process stacks are handled. This is done by having a special
* "init_task" linker map entry..
*/
-union thread_union init_thread_union
- __attribute__((__section__(".data.init_task"))) =
+union thread_union init_thread_union __init_task_data =
{ INIT_THREAD_INFO(init_task) };

/*
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index c828398..b10a950 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -59,6 +59,7 @@ SECTIONS
} :data

.data : { /* Data */
+ INIT_TASK_DATA(THREAD_SIZE)
PAGE_ALIGNED_DATA
NOSAVE_DATA
CACHELINE_ALIGNED_DATA(0x100)
@@ -72,11 +73,6 @@ SECTIONS
}
_edata = .; /* End of data section */

- . = ALIGN(THREAD_SIZE); /* init_task */
- .data.init_task : {
- *(.data.init_task)
- }
-
/* will be freed after init */
. = ALIGN(PAGE_SIZE); /* Init code and data */
__init_begin = .;
--
1.6.2.1

2009-05-01 00:31:46

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 1/6] 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.

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..5d7e703 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