public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] section name cleanup for mn10300
@ 2009-04-30 23:54 Tim Abbott
  2009-04-30 23:54 ` [PATCH 1/6] mn10300: Use macros for .bss.page_aligned section Tim Abbott
  2009-05-01 14:35 ` [PATCH 0/6] section name cleanup for mn10300 David Howells
  0 siblings, 2 replies; 13+ messages in thread
From: Tim Abbott @ 2009-04-30 23:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Linux kernel mailing list, Anders Kaseorg, Waseem Daher,
	Denys Vlasenko, Jeff Arnold, David Howells, Tim Abbott

This patch series cleans up the section names on the mn10300
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):
  mn10300: Use macros for .bss.page_aligned section.
  mn10300: Drop unused .data.idt section.
  mn10300: use NOSAVE_DATA macro for .data.nosave section.
  mn10300: use new macro for .data.cacheline_aligned section.
  mn10300: use new macros for .data.init_task.
  mn10300: use new macro for .data.read_mostly section.

 arch/mn10300/kernel/init_task.c   |    3 +--
 arch/mn10300/kernel/vmlinux.lds.S |   29 ++++++-----------------------
 2 files changed, 7 insertions(+), 25 deletions(-)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/6] mn10300: Use macros for .bss.page_aligned section.
  2009-04-30 23:54 [PATCH 0/6] section name cleanup for mn10300 Tim Abbott
@ 2009-04-30 23:54 ` Tim Abbott
  2009-04-30 23:54   ` [PATCH 2/6] mn10300: Drop unused .data.idt section Tim Abbott
  2009-05-01 14:35 ` [PATCH 0/6] section name cleanup for mn10300 David Howells
  1 sibling, 1 reply; 13+ messages in thread
From: Tim Abbott @ 2009-04-30 23:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Linux kernel mailing list, Anders Kaseorg, Waseem Daher,
	Denys Vlasenko, Jeff Arnold, David Howells, Tim Abbott

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Acked-by: David Howells <dhowells@redhat.com>
---
 arch/mn10300/kernel/vmlinux.lds.S |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/mn10300/kernel/vmlinux.lds.S b/arch/mn10300/kernel/vmlinux.lds.S
index 24de6b9..6ad0fa8 100644
--- a/arch/mn10300/kernel/vmlinux.lds.S
+++ b/arch/mn10300/kernel/vmlinux.lds.S
@@ -131,7 +131,7 @@ SECTIONS
 
   __bss_start = .;		/* BSS */
   .bss : {
-	*(.bss.page_aligned)
+	PAGE_ALIGNED_BSS
 	*(.bss)
   }
   . = ALIGN(4);
-- 
1.6.2.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/6] mn10300: Drop unused .data.idt section.
  2009-04-30 23:54 ` [PATCH 1/6] mn10300: Use macros for .bss.page_aligned section Tim Abbott
@ 2009-04-30 23:54   ` Tim Abbott
  2009-04-30 23:54     ` [PATCH 3/6] mn10300: use NOSAVE_DATA macro for .data.nosave section Tim Abbott
  0 siblings, 1 reply; 13+ messages in thread
From: Tim Abbott @ 2009-04-30 23:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Linux kernel mailing list, Anders Kaseorg, Waseem Daher,
	Denys Vlasenko, Jeff Arnold, David Howells, Tim Abbott,
	Sam Ravnborg

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.

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 arch/mn10300/kernel/vmlinux.lds.S |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/mn10300/kernel/vmlinux.lds.S b/arch/mn10300/kernel/vmlinux.lds.S
index 6ad0fa8..364250f 100644
--- a/arch/mn10300/kernel/vmlinux.lds.S
+++ b/arch/mn10300/kernel/vmlinux.lds.S
@@ -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) }
 
-- 
1.6.2.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/6] mn10300: use NOSAVE_DATA macro for .data.nosave section.
  2009-04-30 23:54   ` [PATCH 2/6] mn10300: Drop unused .data.idt section Tim Abbott
@ 2009-04-30 23:54     ` Tim Abbott
  2009-04-30 23:54       ` [PATCH 4/6] mn10300: use new macro for .data.cacheline_aligned section Tim Abbott
  0 siblings, 1 reply; 13+ messages in thread
From: Tim Abbott @ 2009-04-30 23:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Linux kernel mailing list, Anders Kaseorg, Waseem Daher,
	Denys Vlasenko, Jeff Arnold, David Howells, Tim Abbott

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

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: David Howells <dhowells@redhat.com>
---
 arch/mn10300/kernel/vmlinux.lds.S |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/arch/mn10300/kernel/vmlinux.lds.S b/arch/mn10300/kernel/vmlinux.lds.S
index 364250f..5e825e8 100644
--- a/arch/mn10300/kernel/vmlinux.lds.S
+++ b/arch/mn10300/kernel/vmlinux.lds.S
@@ -49,16 +49,11 @@ SECTIONS
 
   /* writeable */
   .data : {			/* Data */
+	NOSAVE_DATA
 	DATA_DATA
 	CONSTRUCTORS
 	}
 
-  . = ALIGN(PAGE_SIZE);
-  __nosave_begin = .;
-  .data_nosave : { *(.data.nosave) }
-  . = ALIGN(PAGE_SIZE);
-  __nosave_end = .;
-
   . = ALIGN(32);
   .data.cacheline_aligned : { *(.data.cacheline_aligned) }
 
-- 
1.6.2.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/6] mn10300: use new macro for .data.cacheline_aligned section.
  2009-04-30 23:54     ` [PATCH 3/6] mn10300: use NOSAVE_DATA macro for .data.nosave section Tim Abbott
@ 2009-04-30 23:54       ` Tim Abbott
  2009-04-30 23:54         ` [PATCH 5/6] mn10300: use new macros for .data.init_task Tim Abbott
  0 siblings, 1 reply; 13+ messages in thread
From: Tim Abbott @ 2009-04-30 23:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Linux kernel mailing list, Anders Kaseorg, Waseem Daher,
	Denys Vlasenko, Jeff Arnold, David Howells, Tim Abbott

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

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: David Howells <dhowells@redhat.com>
---
 arch/mn10300/kernel/vmlinux.lds.S |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/mn10300/kernel/vmlinux.lds.S b/arch/mn10300/kernel/vmlinux.lds.S
index 5e825e8..cb43406 100644
--- a/arch/mn10300/kernel/vmlinux.lds.S
+++ b/arch/mn10300/kernel/vmlinux.lds.S
@@ -50,13 +50,11 @@ SECTIONS
   /* writeable */
   .data : {			/* Data */
 	NOSAVE_DATA
+	CACHELINE_ALIGNED_DATA(32)
 	DATA_DATA
 	CONSTRUCTORS
 	}
 
-  . = ALIGN(32);
-  .data.cacheline_aligned : { *(.data.cacheline_aligned) }
-
   /* rarely changed data like cpu maps */
   . = ALIGN(32);
   .data.read_mostly : AT(ADDR(.data.read_mostly)) {
-- 
1.6.2.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/6] mn10300: use new macros for .data.init_task.
  2009-04-30 23:54       ` [PATCH 4/6] mn10300: use new macro for .data.cacheline_aligned section Tim Abbott
@ 2009-04-30 23:54         ` Tim Abbott
  2009-04-30 23:54           ` [PATCH 6/6] mn10300: use new macro for .data.read_mostly section Tim Abbott
  2009-05-01 14:46           ` [PATCH 5/6] mn10300: use new macros for .data.init_task David Howells
  0 siblings, 2 replies; 13+ messages in thread
From: Tim Abbott @ 2009-04-30 23:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Linux kernel mailing list, Anders Kaseorg, Waseem Daher,
	Denys Vlasenko, Jeff Arnold, David Howells, Tim Abbott

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

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: David Howells <dhowells@redhat.com>
---
 arch/mn10300/kernel/init_task.c   |    3 +--
 arch/mn10300/kernel/vmlinux.lds.S |    4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/mn10300/kernel/init_task.c b/arch/mn10300/kernel/init_task.c
index 5ac3566..7a89fc3 100644
--- a/arch/mn10300/kernel/init_task.c
+++ b/arch/mn10300/kernel/init_task.c
@@ -30,8 +30,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/mn10300/kernel/vmlinux.lds.S b/arch/mn10300/kernel/vmlinux.lds.S
index cb43406..4dc63e6 100644
--- a/arch/mn10300/kernel/vmlinux.lds.S
+++ b/arch/mn10300/kernel/vmlinux.lds.S
@@ -49,6 +49,7 @@ SECTIONS
 
   /* writeable */
   .data : {			/* Data */
+	INIT_TASK_DATA(THREAD_SIZE)
 	NOSAVE_DATA
 	CACHELINE_ALIGNED_DATA(32)
 	DATA_DATA
@@ -62,9 +63,6 @@ SECTIONS
 	_edata = .;		/* End of data section */
   }
 
-  . = ALIGN(THREAD_SIZE);	/* init_task */
-  .data.init_task : { *(.data.init_task) }
-
   /* might get freed after init */
   . = ALIGN(PAGE_SIZE);
   .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
-- 
1.6.2.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/6] mn10300: use new macro for .data.read_mostly section.
  2009-04-30 23:54         ` [PATCH 5/6] mn10300: use new macros for .data.init_task Tim Abbott
@ 2009-04-30 23:54           ` Tim Abbott
  2009-05-01 14:46           ` [PATCH 5/6] mn10300: use new macros for .data.init_task David Howells
  1 sibling, 0 replies; 13+ messages in thread
From: Tim Abbott @ 2009-04-30 23:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Linux kernel mailing list, Anders Kaseorg, Waseem Daher,
	Denys Vlasenko, Jeff Arnold, David Howells, Tim Abbott

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

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: David Howells <dhowells@redhat.com>
---
 arch/mn10300/kernel/vmlinux.lds.S |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/mn10300/kernel/vmlinux.lds.S b/arch/mn10300/kernel/vmlinux.lds.S
index 4dc63e6..3da48d5 100644
--- a/arch/mn10300/kernel/vmlinux.lds.S
+++ b/arch/mn10300/kernel/vmlinux.lds.S
@@ -52,16 +52,11 @@ SECTIONS
 	INIT_TASK_DATA(THREAD_SIZE)
 	NOSAVE_DATA
 	CACHELINE_ALIGNED_DATA(32)
+	READ_MOSTLY_DATA(32)
 	DATA_DATA
 	CONSTRUCTORS
-	}
-
-  /* rarely changed data like cpu maps */
-  . = ALIGN(32);
-  .data.read_mostly : AT(ADDR(.data.read_mostly)) {
-	*(.data.read_mostly)
 	_edata = .;		/* End of data section */
-  }
+	}
 
   /* might get freed after init */
   . = ALIGN(PAGE_SIZE);
-- 
1.6.2.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] section name cleanup for mn10300
  2009-04-30 23:54 [PATCH 0/6] section name cleanup for mn10300 Tim Abbott
  2009-04-30 23:54 ` [PATCH 1/6] mn10300: Use macros for .bss.page_aligned section Tim Abbott
@ 2009-05-01 14:35 ` David Howells
  2009-05-01 14:48   ` Sam Ravnborg
  1 sibling, 1 reply; 13+ messages in thread
From: David Howells @ 2009-05-01 14:35 UTC (permalink / raw)
  To: Tim Abbott
  Cc: dhowells, Sam Ravnborg, Linux kernel mailing list, Anders Kaseorg,
	Waseem Daher, Denys Vlasenko, Jeff Arnold

Tim Abbott <tabbott@MIT.EDU> wrote:

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

Interesting...  Whilst it compiles and links with no problems, this cleanup
has the following detrimental effects:

None of these patches applied

	   text    data     bss     dec     hex filename
	1879329   82980  321772 2284081  22da31 vmlinux

All of these patches applied:

	   text    data     bss     dec     hex filename
	1879329   87076  321772 2288177  22ea31 vmlinux

Somewhere it eats an extra page.

David

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 5/6] mn10300: use new macros for .data.init_task.
  2009-04-30 23:54         ` [PATCH 5/6] mn10300: use new macros for .data.init_task Tim Abbott
  2009-04-30 23:54           ` [PATCH 6/6] mn10300: use new macro for .data.read_mostly section Tim Abbott
@ 2009-05-01 14:46           ` David Howells
  2009-05-01 15:00             ` Tim Abbott
  1 sibling, 1 reply; 13+ messages in thread
From: David Howells @ 2009-05-01 14:46 UTC (permalink / raw)
  To: Tim Abbott
  Cc: dhowells, Sam Ravnborg, Linux kernel mailing list, Anders Kaseorg,
	Waseem Daher, Denys Vlasenko, Jeff Arnold

Tim Abbott <tabbott@MIT.EDU> wrote:

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

Hmmm...  This causes the kernel I'm building to make an extra page of RAM into
dead space.

David

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] section name cleanup for mn10300
  2009-05-01 14:35 ` [PATCH 0/6] section name cleanup for mn10300 David Howells
@ 2009-05-01 14:48   ` Sam Ravnborg
  2009-05-01 15:03     ` David Howells
  0 siblings, 1 reply; 13+ messages in thread
From: Sam Ravnborg @ 2009-05-01 14:48 UTC (permalink / raw)
  To: David Howells
  Cc: Tim Abbott, Linux kernel mailing list, Anders Kaseorg,
	Waseem Daher, Denys Vlasenko, Jeff Arnold

On Fri, May 01, 2009 at 03:35:19PM +0100, David Howells wrote:
> Tim Abbott <tabbott@MIT.EDU> wrote:
> 
> > This patch series cleans up the section names on the mn10300
> > architecture.  It requires the architecture-independent macro
> > definitions from this patch series:
> 
> Interesting...  Whilst it compiles and links with no problems, this cleanup
> has the following detrimental effects:
> 
> None of these patches applied
> 
> 	   text    data     bss     dec     hex filename
> 	1879329   82980  321772 2284081  22da31 vmlinux
> 
> All of these patches applied:
> 
> 	   text    data     bss     dec     hex filename
> 	1879329   87076  321772 2288177  22ea31 vmlinux
> 
> Somewhere it eats an extra page.

This is likely due to moving around the sections and
we have got them in less perfect order.

I also thing 5/6 is wrong as it moves
init_task befoe _edata.

Could you try to back out them one by one
to see which one causes the extra memory waste.

	Sam

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 5/6] mn10300: use new macros for .data.init_task.
  2009-05-01 14:46           ` [PATCH 5/6] mn10300: use new macros for .data.init_task David Howells
@ 2009-05-01 15:00             ` Tim Abbott
  2009-05-01 15:11               ` Sam Ravnborg
  0 siblings, 1 reply; 13+ messages in thread
From: Tim Abbott @ 2009-05-01 15:00 UTC (permalink / raw)
  To: David Howells
  Cc: Sam Ravnborg, Linux kernel mailing list, Anders Kaseorg,
	Waseem Daher, Denys Vlasenko, Jeff Arnold

On Fri, 1 May 2009, David Howells wrote:

> Tim Abbott <tabbott@MIT.EDU> wrote:
> 
> > .data.init_task should not need a separate output section; this change
> > moves it into the .data section.
> 
> Hmmm...  This causes the kernel I'm building to make an extra page of RAM into
> dead space.

I would try reversing the order of the things inside the .data output 
section, since the stuff after .data at the end of this patch series is 
page-aligned, while the stuff before .data isn't.

	-Tim Abbott



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] section name cleanup for mn10300
  2009-05-01 14:48   ` Sam Ravnborg
@ 2009-05-01 15:03     ` David Howells
  0 siblings, 0 replies; 13+ messages in thread
From: David Howells @ 2009-05-01 15:03 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: dhowells, Tim Abbott, Linux kernel mailing list, Anders Kaseorg,
	Waseem Daher, Denys Vlasenko, Jeff Arnold

Sam Ravnborg <sam@ravnborg.org> wrote:

> I also thing 5/6 is wrong as it moves
> init_task befoe _edata.
> 
> Could you try to back out them one by one
> to see which one causes the extra memory waste.

Moving init_task around is the culprit.

I guess the extra page has a 50% chance of being leaked anyway, as it depends
on the alignment of the previous section.

I can probably make the kernel reclaim it by sticking a label either side of
the alignment and if they're more than a page apart, reclaim the page that
ends at the second label.

David

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 5/6] mn10300: use new macros for .data.init_task.
  2009-05-01 15:00             ` Tim Abbott
@ 2009-05-01 15:11               ` Sam Ravnborg
  0 siblings, 0 replies; 13+ messages in thread
From: Sam Ravnborg @ 2009-05-01 15:11 UTC (permalink / raw)
  To: Tim Abbott
  Cc: David Howells, Linux kernel mailing list, Anders Kaseorg,
	Waseem Daher, Denys Vlasenko, Jeff Arnold

On Fri, May 01, 2009 at 11:00:12AM -0400, Tim Abbott wrote:
> On Fri, 1 May 2009, David Howells wrote:
> 
> > Tim Abbott <tabbott@MIT.EDU> wrote:
> > 
> > > .data.init_task should not need a separate output section; this change
> > > moves it into the .data section.
> > 
> > Hmmm...  This causes the kernel I'm building to make an extra page of RAM into
> > dead space.
> 
> I would try reversing the order of the things inside the .data output 
> section, since the stuff after .data at the end of this patch series is 
> page-aligned, while the stuff before .data isn't.

I'm looking into creating a WRDATA macro like we have RODATA today.
If that flys then we will hide a lot in that section,
including the correct order.

But it will take a few hours before I'm ready.

	Sam

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-05-01 15:09 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-30 23:54 [PATCH 0/6] section name cleanup for mn10300 Tim Abbott
2009-04-30 23:54 ` [PATCH 1/6] mn10300: Use macros for .bss.page_aligned section Tim Abbott
2009-04-30 23:54   ` [PATCH 2/6] mn10300: Drop unused .data.idt section Tim Abbott
2009-04-30 23:54     ` [PATCH 3/6] mn10300: use NOSAVE_DATA macro for .data.nosave section Tim Abbott
2009-04-30 23:54       ` [PATCH 4/6] mn10300: use new macro for .data.cacheline_aligned section Tim Abbott
2009-04-30 23:54         ` [PATCH 5/6] mn10300: use new macros for .data.init_task Tim Abbott
2009-04-30 23:54           ` [PATCH 6/6] mn10300: use new macro for .data.read_mostly section Tim Abbott
2009-05-01 14:46           ` [PATCH 5/6] mn10300: use new macros for .data.init_task David Howells
2009-05-01 15:00             ` Tim Abbott
2009-05-01 15:11               ` Sam Ravnborg
2009-05-01 14:35 ` [PATCH 0/6] section name cleanup for mn10300 David Howells
2009-05-01 14:48   ` Sam Ravnborg
2009-05-01 15:03     ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox