2009-05-01 00:20:34

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 0/4] section name cleanup for sparc

This patch series cleans up the section names on the sparc
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 (4):
sparc: use new macro for .data.cacheline_aligned section.
sparc: use new macros for .data.init_task.
sparc: use new macro for .data.read_mostly section.
sparc: convert to new generic read_mostly support.

arch/sparc/Kconfig | 3 +++
arch/sparc/include/asm/cache.h | 2 --
arch/sparc/kernel/init_task.c | 5 ++---
arch/sparc/kernel/vmlinux.lds.S | 16 +++-------------
4 files changed, 8 insertions(+), 18 deletions(-)


2009-05-01 00:08:49

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 2/4] sparc: 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: David S. Miller <[email protected]>
Cc: [email protected]
---
arch/sparc/kernel/init_task.c | 5 ++---
arch/sparc/kernel/vmlinux.lds.S | 6 +-----
2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/sparc/kernel/init_task.c b/arch/sparc/kernel/init_task.c
index f28cb82..7367984 100644
--- a/arch/sparc/kernel/init_task.c
+++ b/arch/sparc/kernel/init_task.c
@@ -21,6 +21,5 @@ EXPORT_SYMBOL(init_task);
* If this is not aligned on a 8k boundry, then you should change code
* in etrap.S which assumes it.
*/
-union thread_union init_thread_union
- __attribute__((section (".data.init_task")))
- = { INIT_THREAD_INFO(init_task) };
+union thread_union init_thread_union __init_task_data =
+ { INIT_THREAD_INFO(init_task) };
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 6587e03..3fbf650 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -52,6 +52,7 @@ SECTIONS

RO_DATA(PAGE_SIZE)
.data : {
+ INIT_TASK_DATA(THREAD_SIZE)
CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES)
DATA_DATA
CONSTRUCTORS
@@ -66,11 +67,6 @@ SECTIONS
/* End of data section */
_edata = .;

- /* init_task */
- . = ALIGN(THREAD_SIZE);
- .data.init_task : {
- *(.data.init_task)
- }
.fixup : {
__start___fixup = .;
*(.fixup)
--
1.6.2.1

2009-05-01 00:18:57

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 1/4] sparc: 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: David S. Miller <[email protected]>
Cc: [email protected]
---
arch/sparc/kernel/vmlinux.lds.S | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index fcbbd00..6587e03 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -52,6 +52,7 @@ SECTIONS

RO_DATA(PAGE_SIZE)
.data : {
+ CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES)
DATA_DATA
CONSTRUCTORS
}
@@ -59,10 +60,6 @@ SECTIONS
*(.data1)
}
. = ALIGN(SMP_CACHE_BYTES);
- .data.cacheline_aligned : {
- *(.data.cacheline_aligned)
- }
- . = ALIGN(SMP_CACHE_BYTES);
.data.read_mostly : {
*(.data.read_mostly)
}
--
1.6.2.1

2009-05-01 00:19:34

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 3/4] sparc: 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: David S. Miller <[email protected]>
Cc: [email protected]
---
arch/sparc/kernel/vmlinux.lds.S | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 3fbf650..4760796 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -54,16 +54,13 @@ SECTIONS
.data : {
INIT_TASK_DATA(THREAD_SIZE)
CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES)
+ READ_MOSTLY_DATA(SMP_CACHE_BYTES)
DATA_DATA
CONSTRUCTORS
}
.data1 : {
*(.data1)
}
- . = ALIGN(SMP_CACHE_BYTES);
- .data.read_mostly : {
- *(.data.read_mostly)
- }
/* End of data section */
_edata = .;

--
1.6.2.1

2009-05-01 00:19:56

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 4/4] sparc: convert to new generic read_mostly support.

Signed-off-by: Tim Abbott <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: [email protected]
---
arch/sparc/Kconfig | 3 +++
arch/sparc/include/asm/cache.h | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index cc12cd4..fbdeded 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -127,6 +127,9 @@ config OF
config ARCH_SUPPORTS_DEBUG_PAGEALLOC
def_bool y if SPARC64

+config HAVE_READ_MOSTLY_DATA
+ def_bool y
+
source "init/Kconfig"

source "kernel/Kconfig.freezer"
diff --git a/arch/sparc/include/asm/cache.h b/arch/sparc/include/asm/cache.h
index 41f85ae..e614736 100644
--- a/arch/sparc/include/asm/cache.h
+++ b/arch/sparc/include/asm/cache.h
@@ -19,8 +19,6 @@

#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT)

-#define __read_mostly __attribute__((__section__(".data.read_mostly")))
-
#ifdef CONFIG_SPARC32
#include <asm/asi.h>

--
1.6.2.1