* [PATCH 0/6] macros for section name cleanup
@ 2009-04-30 19:32 Tim Abbott
2009-04-30 19:32 ` [PATCH 1/6] Add new macros for page-aligned data and bss sections Tim Abbott
0 siblings, 1 reply; 10+ messages in thread
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
To: Sam Ravnborg
Cc: Anders Kaseorg, Waseem Daher, Denys Vlasenko, Jeff Arnold,
Benjamin Herrenschmidt, Bryan Wu, Chris Zankel, Cyrill Gorcunov,
David Howells, David S. Miller, dev-etrax, Geert Uytterhoeven,
Greg Ungerer, Haavard Skinnemoen, Heiko Carstens, Helge Deller,
Hirokazu Takata, H. Peter Anvin, Ingo Molnar, Jeff Dike,
Jesper Nilsson, Kyle McMartin, Linus Torvalds, linux-alpha
Here are the architecture-independent macro definitions needed for
to clean up the kernel's section names. The overall diffstat from
this section name cleanup project is:
96 files changed, 261 insertions(+), 503 deletions(-)
The decrease results from removing a lot of redundancy in the linker
scripts.
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 */
Sam Ravnborg proposed that rather than just renaming all the sections
outright, we should start by first getting more control over the
section names used in the kernel so that we can later rename sections
without touching too many files. These patch series implement that
cleanup. Later, there will be another patch series to actually rename
the sections.
I'm hoping we can get just these macro definitions into 2.6.30 so that
the arch maintainers don't have to grab the macro definitions for
their trees while reviewing the patches for 2.6.31.
Shortly, I'm going to send one patch series for each of the
architectures updating those architectures to use these new macros
(and otherwise cleaning up section names on those architectures).
-Tim Abbott
Tim Abbott (6):
Add new macros for page-aligned data and bss sections.
Add new NOSAVE_DATA linker script macro.
Add new CACHELINE_ALIGNED_DATA linker script macro.
Add new INIT_TASK_DATA() linker script macro.
Add new READ_MOSTLY_DATA(align) linker script macro.
Add support for __read_mostly to linux/cache.h
include/asm-generic/vmlinux.lds.h | 27 +++++++++++++++++++++++++++
include/linux/cache.h | 6 ++++++
include/linux/init_task.h | 3 +++
include/linux/linkage.h | 9 +++++++++
4 files changed, 45 insertions(+), 0 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/6] Add new macros for page-aligned data and bss sections.
2009-04-30 19:32 [PATCH 0/6] macros for section name cleanup Tim Abbott
@ 2009-04-30 19:32 ` Tim Abbott
2009-04-30 19:32 ` [PATCH 2/6] Add new NOSAVE_DATA linker script macro Tim Abbott
0 siblings, 1 reply; 10+ messages in thread
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
To: Sam Ravnborg
Cc: Anders Kaseorg, Waseem Daher, Denys Vlasenko, Jeff Arnold,
Benjamin Herrenschmidt, Bryan Wu, Chris Zankel, Cyrill Gorcunov,
David Howells, David S. Miller, dev-etrax, Geert Uytterhoeven,
Greg Ungerer, Haavard Skinnemoen, Heiko Carstens, Helge Deller,
Hirokazu Takata, H. Peter Anvin, Ingo Molnar, Jeff Dike,
Jesper Nilsson, Kyle McMartin, Linus Torvalds, linux-alpha
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 <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: David Howells <dhowells@redhat.com>
---
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..3d88c87 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
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 2/6] Add new NOSAVE_DATA linker script macro.
2009-04-30 19:32 ` [PATCH 1/6] Add new macros for page-aligned data and bss sections Tim Abbott
@ 2009-04-30 19:32 ` Tim Abbott
2009-04-30 19:32 ` [PATCH 3/6] Add new CACHELINE_ALIGNED_DATA " Tim Abbott
0 siblings, 1 reply; 10+ messages in thread
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
To: Sam Ravnborg
Cc: Anders Kaseorg, Waseem Daher, Denys Vlasenko, Jeff Arnold,
Benjamin Herrenschmidt, Bryan Wu, Chris Zankel, Cyrill Gorcunov,
David Howells, David S. Miller, dev-etrax, Geert Uytterhoeven,
Greg Ungerer, Haavard Skinnemoen, Heiko Carstens, Helge Deller,
Hirokazu Takata, H. Peter Anvin, Ingo Molnar, Jeff Dike,
Jesper Nilsson, Kyle McMartin, Linus Torvalds, linux-alpha
This patch is preparation for replacing most ".data.nosave" 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 <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
include/asm-generic/vmlinux.lds.h | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 3d88c87..f5ebd2b 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -124,6 +124,13 @@
. = ALIGN(PAGE_SIZE); \
*(.bss.page_aligned)
+#define NOSAVE_DATA \
+ . = ALIGN(PAGE_SIZE); \
+ __nosave_begin = .; \
+ *(.data.nosave) \
+ . = ALIGN(PAGE_SIZE); \
+ __nosave_end = .;
+
#define RO_DATA(align) \
. = ALIGN((align)); \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
--
1.6.2.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 3/6] Add new CACHELINE_ALIGNED_DATA linker script macro.
2009-04-30 19:32 ` [PATCH 2/6] Add new NOSAVE_DATA linker script macro Tim Abbott
@ 2009-04-30 19:32 ` Tim Abbott
2009-04-30 19:32 ` [PATCH 4/6] Add new INIT_TASK_DATA() " Tim Abbott
0 siblings, 1 reply; 10+ messages in thread
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
To: Sam Ravnborg
Cc: Anders Kaseorg, Waseem Daher, Denys Vlasenko, Jeff Arnold,
Benjamin Herrenschmidt, Bryan Wu, Chris Zankel, Cyrill Gorcunov,
David Howells, David S. Miller, dev-etrax, Geert Uytterhoeven,
Greg Ungerer, Haavard Skinnemoen, Heiko Carstens, Helge Deller,
Hirokazu Takata, H. Peter Anvin, Ingo Molnar, Jeff Dike,
Jesper Nilsson, Kyle McMartin, Linus Torvalds, linux-alpha
This patch is preparation for replacing most ".data.cacheline_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 <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
include/asm-generic/vmlinux.lds.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f5ebd2b..fa7801b 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -131,6 +131,10 @@
. = ALIGN(PAGE_SIZE); \
__nosave_end = .;
+#define CACHELINE_ALIGNED_DATA(alignment) \
+ . = ALIGN(alignment); \
+ *(.data.cacheline_aligned)
+
#define RO_DATA(align) \
. = ALIGN((align)); \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
--
1.6.2.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 4/6] Add new INIT_TASK_DATA() linker script macro.
2009-04-30 19:32 ` [PATCH 3/6] Add new CACHELINE_ALIGNED_DATA " Tim Abbott
@ 2009-04-30 19:32 ` Tim Abbott
2009-04-30 19:32 ` [PATCH 5/6] Add new READ_MOSTLY_DATA(align) " Tim Abbott
0 siblings, 1 reply; 10+ messages in thread
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
To: Sam Ravnborg
Cc: Anders Kaseorg, Waseem Daher, Denys Vlasenko, Jeff Arnold,
Benjamin Herrenschmidt, Bryan Wu, Chris Zankel, Cyrill Gorcunov,
David Howells, David S. Miller, dev-etrax, Geert Uytterhoeven,
Greg Ungerer, Haavard Skinnemoen, Heiko Carstens, Helge Deller,
Hirokazu Takata, H. Peter Anvin, Ingo Molnar, Jeff Dike,
Jesper Nilsson, Kyle McMartin, Linus Torvalds, linux-alpha
This patch is preparation for replacing most ".data.init_task" 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 <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
include/asm-generic/vmlinux.lds.h | 4 ++++
include/linux/init_task.h | 3 +++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index fa7801b..4b020e8 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -135,6 +135,10 @@
. = ALIGN(alignment); \
*(.data.cacheline_aligned)
+#define INIT_TASK_DATA(alignment) \
+ . = ALIGN(alignment); \
+ *(.data.init_task)
+
#define RO_DATA(align) \
. = ALIGN((align)); \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index d87247d..e555baa 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -184,5 +184,8 @@ extern struct cred init_cred;
LIST_HEAD_INIT(cpu_timers[2]), \
}
+/* Attach to the init_task data structure for proper alignment */
+#define __init_task_data __attribute__((__section__(".data.init_task")))
+
#endif
--
1.6.2.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 5/6] Add new READ_MOSTLY_DATA(align) linker script macro.
2009-04-30 19:32 ` [PATCH 4/6] Add new INIT_TASK_DATA() " Tim Abbott
@ 2009-04-30 19:32 ` Tim Abbott
2009-04-30 19:32 ` [PATCH 6/6] Add support for __read_mostly to linux/cache.h Tim Abbott
0 siblings, 1 reply; 10+ messages in thread
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
To: Sam Ravnborg
Cc: Anders Kaseorg, Waseem Daher, Denys Vlasenko, Jeff Arnold,
Benjamin Herrenschmidt, Bryan Wu, Chris Zankel, Cyrill Gorcunov,
David Howells, David S. Miller, dev-etrax, Geert Uytterhoeven,
Greg Ungerer, Haavard Skinnemoen, Heiko Carstens, Helge Deller,
Hirokazu Takata, H. Peter Anvin, Ingo Molnar, Jeff Dike,
Jesper Nilsson, Kyle McMartin, Linus Torvalds, linux-alpha
This patch is preparation for replacing most ".data.read_mostly" 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 <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
include/asm-generic/vmlinux.lds.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 4b020e8..a4b4f4a 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -139,6 +139,10 @@
. = ALIGN(alignment); \
*(.data.init_task)
+#define READ_MOSTLY_DATA(alignment) \
+ . = ALIGN(alignment); \
+ *(.data.read_mostly)
+
#define RO_DATA(align) \
. = ALIGN((align)); \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
--
1.6.2.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 6/6] Add support for __read_mostly to linux/cache.h
2009-04-30 19:32 ` [PATCH 5/6] Add new READ_MOSTLY_DATA(align) " Tim Abbott
@ 2009-04-30 19:32 ` Tim Abbott
2009-05-01 9:44 ` Sam Ravnborg
0 siblings, 1 reply; 10+ messages in thread
From: Tim Abbott @ 2009-04-30 19:32 UTC (permalink / raw)
To: Sam Ravnborg
Cc: Anders Kaseorg, Waseem Daher, Denys Vlasenko, Jeff Arnold,
Benjamin Herrenschmidt, Bryan Wu, Chris Zankel, Cyrill Gorcunov,
David Howells, David S. Miller, dev-etrax, Geert Uytterhoeven,
Greg Ungerer, Haavard Skinnemoen, Heiko Carstens, Helge Deller,
Hirokazu Takata, H. Peter Anvin, Ingo Molnar, Jeff Dike,
Jesper Nilsson, Kyle McMartin, Linus Torvalds, linux-alpha
Signed-off-by: Tim Abbott <tabbott@mit.edu>
---
include/linux/cache.h | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/include/linux/cache.h b/include/linux/cache.h
index 97e2488..99d8a6f 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -13,7 +13,13 @@
#endif
#ifndef __read_mostly
+#ifdef CONFIG_HAVE_READ_MOSTLY_DATA
+#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+#define __READ_MOSTLY .section ".data.read_mostly", "aw"
+#else
#define __read_mostly
+#define __READ_MOSTLY
+#endif /* CONFIG_HAVE_READ_MOSTLY_DATA */
#endif
#ifndef ____cacheline_aligned
--
1.6.2.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 6/6] Add support for __read_mostly to linux/cache.h
2009-04-30 19:32 ` [PATCH 6/6] Add support for __read_mostly to linux/cache.h Tim Abbott
@ 2009-05-01 9:44 ` Sam Ravnborg
[not found] ` <20090501094407.GD18326-QabhHTsIXMSnlFQ6Q1D1Y0B+6BGkLq7r@public.gmane.org>
0 siblings, 1 reply; 10+ messages in thread
From: Sam Ravnborg @ 2009-05-01 9:44 UTC (permalink / raw)
To: Tim Abbott, Christoph Lameter
Cc: Anders Kaseorg, Waseem Daher, Denys Vlasenko, Jeff Arnold,
Benjamin Herrenschmidt, Bryan Wu, Chris Zankel, Cyrill Gorcunov,
David Howells, David S. Miller, dev-etrax, Geert Uytterhoeven,
Greg Ungerer, Haavard Skinnemoen, Heiko Carstens, Helge Deller,
Hirokazu Takata, H. Peter Anvin, Ingo Molnar, Jeff Dike,
Jesper Nilsson, Kyle McMartin, Linus Torvalds, linux-alpha
On Thu, Apr 30, 2009 at 03:32:36PM -0400, Tim Abbott wrote:
> Signed-off-by: Tim Abbott <tabbott@mit.edu>
> ---
> include/linux/cache.h | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/cache.h b/include/linux/cache.h
> index 97e2488..99d8a6f 100644
> --- a/include/linux/cache.h
> +++ b/include/linux/cache.h
> @@ -13,7 +13,13 @@
> #endif
>
> #ifndef __read_mostly
> +#ifdef CONFIG_HAVE_READ_MOSTLY_DATA
> +#define __read_mostly __attribute__((__section__(".data.read_mostly")))
> +#define __READ_MOSTLY .section ".data.read_mostly", "aw"
> +#else
> #define __read_mostly
> +#define __READ_MOSTLY
> +#endif /* CONFIG_HAVE_READ_MOSTLY_DATA */
> #endif
Are there any specific reason why we do not support read_mostly on all
architectures?
read_mostly is about grouping rarely written data together
so what is needed is to introduce this section in the remaining
archtectures.
Christoph - git log says you did the inital implmentation.
Do you agree?
Sam
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-05-01 21:47 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-30 19:32 [PATCH 0/6] macros for section name cleanup Tim Abbott
2009-04-30 19:32 ` [PATCH 1/6] Add new macros for page-aligned data and bss sections Tim Abbott
2009-04-30 19:32 ` [PATCH 2/6] Add new NOSAVE_DATA linker script macro Tim Abbott
2009-04-30 19:32 ` [PATCH 3/6] Add new CACHELINE_ALIGNED_DATA " Tim Abbott
2009-04-30 19:32 ` [PATCH 4/6] Add new INIT_TASK_DATA() " Tim Abbott
2009-04-30 19:32 ` [PATCH 5/6] Add new READ_MOSTLY_DATA(align) " Tim Abbott
2009-04-30 19:32 ` [PATCH 6/6] Add support for __read_mostly to linux/cache.h Tim Abbott
2009-05-01 9:44 ` Sam Ravnborg
[not found] ` <20090501094407.GD18326-QabhHTsIXMSnlFQ6Q1D1Y0B+6BGkLq7r@public.gmane.org>
2009-05-01 13:52 ` Christoph Lameter
2009-05-01 21:47 ` [microblaze-uclinux] " Edgar E. Iglesias
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).