Tim Abbott | 1 May 01:59 2009
Picon

[PATCH] um: use new macros for .data.init_task.

Signed-off-by: Tim Abbott <tabbott <at> mit.edu>
Cc: Jeff Dike <jdike <at> addtoit.com>
Cc: user-mode-linux-devel <at> lists.sourceforge.net
---
 arch/um/kernel/dyn.lds.S   |    3 +--
 arch/um/kernel/init_task.c |    3 +--
 arch/um/kernel/uml.lds.S   |    3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 9975e1a..901f703 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
 <at>  <at>  -96,8 +96,7  <at>  <at>  SECTIONS
   .init_array     : { *(.init_array) }
   .fini_array     : { *(.fini_array) }
   .data           : {
-    . = ALIGN(KERNEL_STACK_SIZE);		/* init_task */
-    *(.data.init_task)
+    INIT_TASK_DATA(KERNEL_STACK_SIZE)
     . = ALIGN(KERNEL_STACK_SIZE);
     *(.data.init_irqstack)
     DATA_DATA
diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c
index 806d381..0d4657f 100644
--- a/arch/um/kernel/init_task.c
+++ b/arch/um/kernel/init_task.c
 <at>  <at>  -33,8 +33,7  <at>  <at>  EXPORT_SYMBOL(init_task);
  * "init_task" linker map entry..
  */
(Continue reading)

Tim Abbott | 1 May 01:59 2009
Picon

[PATCH] section name cleanup for um

This patch series cleans up the section names on the um
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 (1):
  um: use new macros for .data.init_task.

 arch/um/kernel/dyn.lds.S   |    3 +--
 arch/um/kernel/init_task.c |    3 +--
 arch/um/kernel/uml.lds.S   |    3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

------------------------------------------------------------------------------
(Continue reading)

Sam Ravnborg | 1 May 11:04 2009

Re: [PATCH v2 0/6] macros for section name cleanup

On Thu, Apr 30, 2009 at 03:54:07PM -0400, Tim Abbott wrote:
> (this patch series differs from v1 only in the CC list; some of the
> architecture lists I sent the previous one to are moderated against
> non-members; all replies should go to this version).
> 
> 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.
> 
(Continue reading)

Sam Ravnborg | 1 May 11:18 2009

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

On Thu, Apr 30, 2009 at 03:54:08PM -0400, Tim Abbott wrote:
> 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 <at> mit.edu>
> Cc: Sam Ravnborg <sam <at> ravnborg.org>
> Acked-by: David Howells <dhowells <at> 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
>  <at>  <at>  -116,6 +116,14  <at>  <at> 
>  	FTRACE_EVENTS()							\
>  	TRACE_SYSCALLS()
>  
> +#define PAGE_ALIGNED_DATA						\
> +	. = ALIGN(PAGE_SIZE);						\
> +	*(.data.page_aligned)
(Continue reading)

Sam Ravnborg | 1 May 11:21 2009

Re: [PATCH v2 2/6] Add new NOSAVE_DATA linker script macro.

On Thu, Apr 30, 2009 at 03:54:09PM -0400, Tim Abbott wrote:
> 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 <at> mit.edu>
> Cc: Sam Ravnborg <sam <at> 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
>  <at>  <at>  -124,6 +124,13  <at>  <at> 
>  	. = ALIGN(PAGE_SIZE);						\
>  	*(.bss.page_aligned)
>  
> +#define NOSAVE_DATA							\
> +	. = ALIGN(PAGE_SIZE);						\
> +	__nosave_begin = .;						\
> +	*(.data.nosave)							\
> +	. = ALIGN(PAGE_SIZE);						\
> +	__nosave_end = .;
(Continue reading)

Sam Ravnborg | 1 May 11:44 2009

Re: [PATCH 6/6] Add support for __read_mostly to linux/cache.h

On Thu, Apr 30, 2009 at 03:32:36PM -0400, Tim Abbott wrote:
> Signed-off-by: Tim Abbott <tabbott <at> 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
>  <at>  <at>  -13,7 +13,13  <at>  <at> 
>  #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.

(Continue reading)

Tim Abbott | 1 May 15:54 2009
Picon

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

On Fri, 1 May 2009, Sam Ravnborg wrote:

> On Thu, Apr 30, 2009 at 03:54:08PM -0400, Tim Abbott wrote:
> > +#define __PAGE_ALIGNED_DATA	.section ".data.page_aligned", "aw",  <at> progbits
> > +#define __PAGE_ALIGNED_BSS	.section ".bss.page_aligned", "aw",  <at> nobits
> 
> It is my understanding that the linker will automatically
> assume nobits for section names starting with .bss and likewise
> progbits for section names starting with .data - so we can leave them out?

I believe that is correct.

	-Tim Abbott

Sam Ravnborg | 1 May 16:21 2009

Re: [PATCH v2 0/6] macros for section name cleanup

On Thu, Apr 30, 2009 at 03:54:07PM -0400, Tim Abbott wrote:
> (this patch series differs from v1 only in the CC list; some of the
> architecture lists I sent the previous one to are moderated against
> non-members; all replies should go to this version).
> 
> 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.
> 
(Continue reading)

Christoph Lameter | 1 May 15:52 2009
Picon

Re: [PATCH 6/6] Add support for __read_mostly to linux/cache.h

On Fri, 1 May 2009, Sam Ravnborg wrote:

> Are there any specific reason why we do not support read_mostly on all
> architectures?

Not that I know of.

> 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?

Yes.

There is some concern that __read_mostly is needlessly applied to
numerous variables that are not used in hot code paths. This may make
__read_mostly ineffective and actually increase the cache footprint of a
function since global variables are no longer in the same cacheline. If
such a function is called and the caches are cold then two cacheline
fetches have to be done instead of one.

H. Peter Anvin | 1 May 18:33 2009

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

Tim Abbott wrote:
> On Fri, 1 May 2009, Sam Ravnborg wrote:
> 
>> On Thu, Apr 30, 2009 at 03:54:08PM -0400, Tim Abbott wrote:
>>> +#define __PAGE_ALIGNED_DATA	.section ".data.page_aligned", "aw",  <at> progbits
>>> +#define __PAGE_ALIGNED_BSS	.section ".bss.page_aligned", "aw",  <at> nobits
>> It is my understanding that the linker will automatically
>> assume nobits for section names starting with .bss and likewise
>> progbits for section names starting with .data - so we can leave them out?
> 
> I believe that is correct.
> 

... but that doesn't mean it's the right thing to do.

It's better to be fully explicit when macroizing this kind of stuff.
This is part of why macroizing it is good: it means we end up with *one*
place that determines this stuff, not some magic heuristics in the linker.

	-hpa

--

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


Gmane