Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[PATCH] move __attribute__((__cold__)) functions back into final .text section

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


jbeulich at novell

Jun 18, 2008, 4:36 AM

Post #1 of 6 (166 views)
Permalink
[PATCH] move __attribute__((__cold__)) functions back into final .text section

Due to the addition of __attribute__((__cold__)) to a few symbols
without adjusting the linker scripts, those symbols currently may end
up outside the [_stext,_etext) range, as they get placed in
.text.unlikely by (at least) gcc 4.3.0. This may confuse code not only
outside of the kernel, symbol_put_addr()'s BUG() could also trigger.
Hence we need to add .text.unlikely (and for future uses of
__attribute__((__hot__)) also .text.hot) to the TEXT_TEXT() macro.

Issue observed by Lukas Lipavsky.

Cc: Lukas Lipavsky <llipavsky[at]suse.cz>
Signed-off-by: Jan Beulich <jbeulich[at]novell.com>

---
include/asm-generic/vmlinux.lds.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

--- linux-2.6.26-rc6/include/asm-generic/vmlinux.lds.h 2008-04-17 04:49:44.000000000 +0200
+++ 2.6.26-rc6-hot-cold-text/include/asm-generic/vmlinux.lds.h 2008-06-18 12:19:22.000000000 +0200
@@ -204,6 +204,7 @@
* during second ld run in second ld pass when generating System.map */
#define TEXT_TEXT \
ALIGN_FUNCTION(); \
+ *(.text.hot) \
*(.text) \
*(.ref.text) \
*(.text.init.refok) \
@@ -213,7 +214,8 @@
CPU_KEEP(init.text) \
CPU_KEEP(exit.text) \
MEM_KEEP(init.text) \
- MEM_KEEP(exit.text)
+ MEM_KEEP(exit.text) \
+ *(.text.unlikely)


/* sched.text is aling to function alignment to secure we have same



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


llipavsky at suse

Jun 20, 2008, 2:06 AM

Post #2 of 6 (151 views)
Permalink
Re: [PATCH] move __attribute__((__cold__)) functions back into final .text section [In reply to]

Jan Beulich píše v St 18. 06. 2008 v 12:36 +0100:
> Due to the addition of __attribute__((__cold__)) to a few symbols
> without adjusting the linker scripts, those symbols currently may end
> up outside the [_stext,_etext) range, as they get placed in
> .text.unlikely by (at least) gcc 4.3.0. This may confuse code not only
> outside of the kernel, symbol_put_addr()'s BUG() could also trigger.
> Hence we need to add .text.unlikely (and for future uses of
> __attribute__((__hot__)) also .text.hot) to the TEXT_TEXT() macro.
> Cc: Lukas Lipavsky <llipavsky[at]suse.cz>
> Signed-off-by: Jan Beulich <jbeulich[at]novell.com>

Tested-by: Lukas Lipavsky <llipavsky[at]suse.cz>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


sam at ravnborg

Jun 27, 2008, 2:03 PM

Post #3 of 6 (133 views)
Permalink
Re: [PATCH] move __attribute__((__cold__)) functions back into final .text section [In reply to]

On Wed, Jun 18, 2008 at 12:36:01PM +0100, Jan Beulich wrote:
> Due to the addition of __attribute__((__cold__)) to a few symbols
> without adjusting the linker scripts, those symbols currently may end
> up outside the [_stext,_etext) range, as they get placed in
> .text.unlikely by (at least) gcc 4.3.0. This may confuse code not only
> outside of the kernel, symbol_put_addr()'s BUG() could also trigger.
> Hence we need to add .text.unlikely (and for future uses of
> __attribute__((__hot__)) also .text.hot) to the TEXT_TEXT() macro.
>
> Issue observed by Lukas Lipavsky.
>
> Cc: Lukas Lipavsky <llipavsky[at]suse.cz>
> Signed-off-by: Jan Beulich <jbeulich[at]novell.com>

Applied.

Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


akpm at linux-foundation

Jul 1, 2008, 11:17 PM

Post #4 of 6 (129 views)
Permalink
Re: [PATCH] move __attribute__((__cold__)) functions back into final .text section [In reply to]

On Wed, 18 Jun 2008 12:36:01 +0100 "Jan Beulich" <jbeulich[at]novell.com> wrote:

> Due to the addition of __attribute__((__cold__)) to a few symbols
> without adjusting the linker scripts, those symbols currently may end
> up outside the [_stext,_etext) range, as they get placed in
> .text.unlikely by (at least) gcc 4.3.0. This may confuse code not only
> outside of the kernel, symbol_put_addr()'s BUG() could also trigger.
> Hence we need to add .text.unlikely (and for future uses of
> __attribute__((__hot__)) also .text.hot) to the TEXT_TEXT() macro.
>
> Issue observed by Lukas Lipavsky.
>
> Cc: Lukas Lipavsky <llipavsky[at]suse.cz>
> Signed-off-by: Jan Beulich <jbeulich[at]novell.com>
>
> ---
> include/asm-generic/vmlinux.lds.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> --- linux-2.6.26-rc6/include/asm-generic/vmlinux.lds.h 2008-04-17 04:49:44.000000000 +0200
> +++ 2.6.26-rc6-hot-cold-text/include/asm-generic/vmlinux.lds.h 2008-06-18 12:19:22.000000000 +0200
> @@ -204,6 +204,7 @@
> * during second ld run in second ld pass when generating System.map */
> #define TEXT_TEXT \
> ALIGN_FUNCTION(); \
> + *(.text.hot) \
> *(.text) \
> *(.ref.text) \
> *(.text.init.refok) \
> @@ -213,7 +214,8 @@
> CPU_KEEP(init.text) \
> CPU_KEEP(exit.text) \
> MEM_KEEP(init.text) \
> - MEM_KEEP(exit.text)
> + MEM_KEEP(exit.text) \
> + *(.text.unlikely)
>
>
> /* sched.text is aling to function alignment to secure we have same
>

So this is now in Sam's
git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next.git.
But it is not in the present linux-next. Either because Sam added it
after Stephen pulled Sam's tree, or because something screwed up.

So I'll now be dropping it. Sam, please ensure that it gets into
2.6.26 and 2.6.25.x (IMO).

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


sfr at canb

Jul 1, 2008, 11:29 PM

Post #5 of 6 (129 views)
Permalink
Re: [PATCH] move __attribute__((__cold__)) functions back into final .text section [In reply to]

Hi Andrew,

On Tue, 1 Jul 2008 23:17:17 -0700 Andrew Morton <akpm[at]linux-foundation.org> wrote:
>
> So this is now in Sam's
> git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next.git.
> But it is not in the present linux-next. Either because Sam added it
> after Stephen pulled Sam's tree, or because something screwed up.

Its in the linux-next tree I have just (in the last 30 minutes) published
(but not yet announced) (tag next-20080702).

--
Cheers,
Stephen Rothwell sfr[at]canb.auug.org.au
http://www.canb.auug.org.au/~sfr/


sam at ravnborg

Jul 6, 2008, 2:12 PM

Post #6 of 6 (116 views)
Permalink
Re: [PATCH] move __attribute__((__cold__)) functions back into final .text section [In reply to]

On Tue, Jul 01, 2008 at 11:17:17PM -0700, Andrew Morton wrote:
> On Wed, 18 Jun 2008 12:36:01 +0100 "Jan Beulich" <jbeulich[at]novell.com> wrote:
>
> > Due to the addition of __attribute__((__cold__)) to a few symbols
> > without adjusting the linker scripts, those symbols currently may end
> > up outside the [_stext,_etext) range, as they get placed in
> > .text.unlikely by (at least) gcc 4.3.0. This may confuse code not only
> > outside of the kernel, symbol_put_addr()'s BUG() could also trigger.
> > Hence we need to add .text.unlikely (and for future uses of
> > __attribute__((__hot__)) also .text.hot) to the TEXT_TEXT() macro.
> >
> > Issue observed by Lukas Lipavsky.
> >
> > Cc: Lukas Lipavsky <llipavsky[at]suse.cz>
> > Signed-off-by: Jan Beulich <jbeulich[at]novell.com>
> >
> > ---
> > include/asm-generic/vmlinux.lds.h | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > --- linux-2.6.26-rc6/include/asm-generic/vmlinux.lds.h 2008-04-17 04:49:44.000000000 +0200
> > +++ 2.6.26-rc6-hot-cold-text/include/asm-generic/vmlinux.lds.h 2008-06-18 12:19:22.000000000 +0200
> > @@ -204,6 +204,7 @@
> > * during second ld run in second ld pass when generating System.map */
> > #define TEXT_TEXT \
> > ALIGN_FUNCTION(); \
> > + *(.text.hot) \
> > *(.text) \
> > *(.ref.text) \
> > *(.text.init.refok) \
> > @@ -213,7 +214,8 @@
> > CPU_KEEP(init.text) \
> > CPU_KEEP(exit.text) \
> > MEM_KEEP(init.text) \
> > - MEM_KEEP(exit.text)
> > + MEM_KEEP(exit.text) \
> > + *(.text.unlikely)
> >
> >
> > /* sched.text is aling to function alignment to secure we have same
> >
>
> So this is now in Sam's
> git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next.git.
> But it is not in the present linux-next. Either because Sam added it
> after Stephen pulled Sam's tree, or because something screwed up.
>
> So I'll now be dropping it. Sam, please ensure that it gets into
> 2.6.26 and 2.6.25.x (IMO).

I have added a Cc: <stable[at]kernel.org> so the stable team should pick
it when applied to -linus.

Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo[at]vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.