linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* add new code section for kernel code
@ 2006-04-06 12:45 saeed bishara
  2006-04-06 13:10 ` Paolo Ornati
  0 siblings, 1 reply; 13+ messages in thread
From: saeed bishara @ 2006-04-06 12:45 UTC (permalink / raw)
  To: linux-kernel

Hi,
 I'm developing linux kernel for ARM cpu with direct-mapped
instruction cache, sometimes I notice that the pefromance of the
kernel (for some test) is highly dependent on the code layout, in
order to fix that I added new code section, and for each kernel
function that highly invokerd I added compiler attribute so it will
allocated in that section (exactly as the __init section). but it
bothers me that I need to change the kernel source code, so is there
any way to do that externally (without touching C code)?

saeed

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

* Re: add new code section for kernel code
  2006-04-06 12:45 add new code section for kernel code saeed bishara
@ 2006-04-06 13:10 ` Paolo Ornati
  2006-04-06 15:27   ` saeed bishara
  2006-04-06 16:47   ` saeed bishara
  0 siblings, 2 replies; 13+ messages in thread
From: Paolo Ornati @ 2006-04-06 13:10 UTC (permalink / raw)
  To: saeed bishara; +Cc: linux-kernel

On Thu, 6 Apr 2006 15:45:47 +0300
"saeed bishara" <saeed.bishara@gmail.com> wrote:

>  I'm developing linux kernel for ARM cpu with direct-mapped
> instruction cache, sometimes I notice that the pefromance of the
> kernel (for some test) is highly dependent on the code layout, in
> order to fix that I added new code section, and for each kernel
> function that highly invokerd I added compiler attribute so it will
> allocated in that section (exactly as the __init section)

It's already done in 2.6.17-rc1 for x86_64:

Processor type and feature --> Function reordering

arch/x86_64/Kconfig:

config REORDER
        bool "Function reordering"
        default n
        help
         This option enables the toolchain to reorder functions for a more
         optimal TLB usage. If you have pretty much any version of binutils,
         this can increase your kernel build time by roughly one minute.

http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4bdc3b7f1b730c07f5a6ccca77ee68e044036ffc

-- 
	Paolo Ornati
	Linux 2.6.16.1 on x86_64

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

* Re: add new code section for kernel code
  2006-04-06 13:10 ` Paolo Ornati
@ 2006-04-06 15:27   ` saeed bishara
  2006-04-06 16:47   ` saeed bishara
  1 sibling, 0 replies; 13+ messages in thread
From: saeed bishara @ 2006-04-06 15:27 UTC (permalink / raw)
  To: Paolo Ornati; +Cc: linux-kernel

very cooooooooool!!
regarding the readprofile, I think it's recommended to mention that
functions called within spinlocks won't show up.


On 4/6/06, Paolo Ornati <ornati@fastwebnet.it> wrote:
> On Thu, 6 Apr 2006 15:45:47 +0300
> "saeed bishara" <saeed.bishara@gmail.com> wrote:
>
> >  I'm developing linux kernel for ARM cpu with direct-mapped
> > instruction cache, sometimes I notice that the pefromance of the
> > kernel (for some test) is highly dependent on the code layout, in
> > order to fix that I added new code section, and for each kernel
> > function that highly invokerd I added compiler attribute so it will
> > allocated in that section (exactly as the __init section)
>
> It's already done in 2.6.17-rc1 for x86_64:
>
> Processor type and feature --> Function reordering
>
> arch/x86_64/Kconfig:
>
> config REORDER
>         bool "Function reordering"
>         default n
>         help
>          This option enables the toolchain to reorder functions for a more
>          optimal TLB usage. If you have pretty much any version of binutils,
>          this can increase your kernel build time by roughly one minute.
>
> http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4bdc3b7f1b730c07f5a6ccca77ee68e044036ffc
>
> --
>         Paolo Ornati
>         Linux 2.6.16.1 on x86_64
>

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

* Re: add new code section for kernel code
  2006-04-06 13:10 ` Paolo Ornati
  2006-04-06 15:27   ` saeed bishara
@ 2006-04-06 16:47   ` saeed bishara
  2006-04-07 11:02     ` saeed bishara
  1 sibling, 1 reply; 13+ messages in thread
From: saeed bishara @ 2006-04-06 16:47 UTC (permalink / raw)
  To: Paolo Ornati; +Cc: linux-kernel, linux-arm-kernel, Linux-arm-toolchain

Hi,
    I've tried to port this to my kernel (2.6.12.6), but the kenel
fails to boot; it stops after Starting kernel ....
   I tried to add only the CFLAGS += -ffunction-sections to the
arch/arm/Makefile, and it still fails. my tool chains is "gcc version
3.4.4 (release) (CodeSourcery ARM 2005q3-2)"
any ideas?

saeed

On 4/6/06, Paolo Ornati <ornati@fastwebnet.it> wrote:
> On Thu, 6 Apr 2006 15:45:47 +0300
> "saeed bishara" <saeed.bishara@gmail.com> wrote:
>
> >  I'm developing linux kernel for ARM cpu with direct-mapped
> > instruction cache, sometimes I notice that the pefromance of the
> > kernel (for some test) is highly dependent on the code layout, in
> > order to fix that I added new code section, and for each kernel
> > function that highly invokerd I added compiler attribute so it will
> > allocated in that section (exactly as the __init section)
>
> It's already done in 2.6.17-rc1 for x86_64:
>
> Processor type and feature --> Function reordering
>
> arch/x86_64/Kconfig:
>
> config REORDER
>         bool "Function reordering"
>         default n
>         help
>          This option enables the toolchain to reorder functions for a more
>          optimal TLB usage. If you have pretty much any version of binutils,
>          this can increase your kernel build time by roughly one minute.
>
> http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4bdc3b7f1b730c07f5a6ccca77ee68e044036ffc
>
> --
>         Paolo Ornati
>         Linux 2.6.16.1 on x86_64
>

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

* Re: add new code section for kernel code
  2006-04-06 16:47   ` saeed bishara
@ 2006-04-07 11:02     ` saeed bishara
  2006-04-07 15:14       ` Arjan van de Ven
  0 siblings, 1 reply; 13+ messages in thread
From: saeed bishara @ 2006-04-07 11:02 UTC (permalink / raw)
  To: Paolo Ornati; +Cc: linux-kernel, linux-arm-kernel, Linux-arm-toolchain

I noticed the arch/arm/boot/compressed/ files compiled with
ffunction-sections switch, so I added the -fno-function-sections to
the EXTRA_CFLAGS of the compressed/Makefile. And this solved the
problem.



On 4/6/06, saeed bishara <saeed.bishara@gmail.com> wrote:
> Hi,
>     I've tried to port this to my kernel (2.6.12.6), but the kenel
> fails to boot; it stops after Starting kernel ....
>    I tried to add only the CFLAGS += -ffunction-sections to the
> arch/arm/Makefile, and it still fails. my tool chains is "gcc version
> 3.4.4 (release) (CodeSourcery ARM 2005q3-2)"
> any ideas?

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

* Re: add new code section for kernel code
  2006-04-07 11:02     ` saeed bishara
@ 2006-04-07 15:14       ` Arjan van de Ven
  2006-04-07 15:43         ` Russell King
  0 siblings, 1 reply; 13+ messages in thread
From: Arjan van de Ven @ 2006-04-07 15:14 UTC (permalink / raw)
  To: saeed bishara
  Cc: Paolo Ornati, linux-kernel, linux-arm-kernel, Linux-arm-toolchain

On Fri, 2006-04-07 at 14:02 +0300, saeed bishara wrote:
> I noticed the arch/arm/boot/compressed/ files compiled with
> ffunction-sections switch, so I added the -fno-function-sections to
> the EXTRA_CFLAGS of the compressed/Makefile. And this solved the
> problem.

can you send a patch for this to Russell ?


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

* Re: add new code section for kernel code
  2006-04-07 15:14       ` Arjan van de Ven
@ 2006-04-07 15:43         ` Russell King
  2006-04-09  9:53           ` saeed bishara
  0 siblings, 1 reply; 13+ messages in thread
From: Russell King @ 2006-04-07 15:43 UTC (permalink / raw)
  To: Arjan van de Ven
  Cc: saeed bishara, Paolo Ornati, linux-kernel, linux-arm-kernel,
	Linux-arm-toolchain

On Fri, Apr 07, 2006 at 05:14:24PM +0200, Arjan van de Ven wrote:
> On Fri, 2006-04-07 at 14:02 +0300, saeed bishara wrote:
> > I noticed the arch/arm/boot/compressed/ files compiled with
> > ffunction-sections switch, so I added the -fno-function-sections to
> > the EXTRA_CFLAGS of the compressed/Makefile. And this solved the
> > problem.
> 
> can you send a patch for this to Russell ?

I'd prefer not to paper over such bugs.  Maybe the following patch will
fix the decompressor for saeed?

diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
--- a/arch/arm/boot/compressed/vmlinux.lds.in
+++ b/arch/arm/boot/compressed/vmlinux.lds.in
@@ -18,6 +18,7 @@ SECTIONS
     _start = .;
     *(.start)
     *(.text)
+    *(.text.*)
     *(.fixup)
     *(.gnu.warning)
     *(.rodata)


-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

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

* Re: add new code section for kernel code
  2006-04-07 15:43         ` Russell King
@ 2006-04-09  9:53           ` saeed bishara
  2006-04-09 20:30             ` Russell King
  0 siblings, 1 reply; 13+ messages in thread
From: saeed bishara @ 2006-04-09  9:53 UTC (permalink / raw)
  To: Arjan van de Ven, saeed bishara, Paolo Ornati, linux-kernel,
	linux-arm-kernel, Linux-arm-toolchain

> I'd prefer not to paper over such bugs.  Maybe the following patch will
> fix the decompressor for saeed?

yes, this patch fixed the problem.

>
> diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
> --- a/arch/arm/boot/compressed/vmlinux.lds.in
> +++ b/arch/arm/boot/compressed/vmlinux.lds.in
> @@ -18,6 +18,7 @@ SECTIONS
>      _start = .;
>      *(.start)
>      *(.text)
> +    *(.text.*)
>      *(.fixup)
>      *(.gnu.warning)
>      *(.rodata)
>
>
> --
> Russell King
>  Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
>  maintainer of:  2.6 Serial core
>

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

* Re: add new code section for kernel code
  2006-04-09  9:53           ` saeed bishara
@ 2006-04-09 20:30             ` Russell King
  2006-04-10  7:11               ` saeed bishara
  2006-04-10  9:12               ` Dimitry Andric
  0 siblings, 2 replies; 13+ messages in thread
From: Russell King @ 2006-04-09 20:30 UTC (permalink / raw)
  To: saeed bishara
  Cc: Arjan van de Ven, Paolo Ornati, linux-kernel, linux-arm-kernel,
	Linux-arm-toolchain

On Sun, Apr 09, 2006 at 12:53:56PM +0300, saeed bishara wrote:
> > I'd prefer not to paper over such bugs.  Maybe the following patch will
> > fix the decompressor for saeed?
> 
> yes, this patch fixed the problem.

Thanks for testing; I've applied this patch so 2.6.17-rc2 onwards will
have this fixed.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

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

* Re: add new code section for kernel code
  2006-04-09 20:30             ` Russell King
@ 2006-04-10  7:11               ` saeed bishara
  2006-04-10  9:12               ` Dimitry Andric
  1 sibling, 0 replies; 13+ messages in thread
From: saeed bishara @ 2006-04-10  7:11 UTC (permalink / raw)
  To: saeed bishara, Arjan van de Ven, Paolo Ornati, linux-kernel,
	linux-arm-kernel, Linux-arm-toolchain

I just want to say that this code reordering reduced the I cache
misses of my system that includes direct mapped caches,  and the
perforamance of a the optimezed tests increased up to 10% and in some
case it improved by 20%.

saeed


> Thanks for testing; I've applied this patch so 2.6.17-rc2 onwards will
> have this fixed.
>

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

* Re: add new code section for kernel code
  2006-04-09 20:30             ` Russell King
  2006-04-10  7:11               ` saeed bishara
@ 2006-04-10  9:12               ` Dimitry Andric
  2006-04-11 14:49                 ` saeed bishara
  1 sibling, 1 reply; 13+ messages in thread
From: Dimitry Andric @ 2006-04-10  9:12 UTC (permalink / raw)
  To: saeed bishara, Arjan van de Ven, Paolo Ornati, linux-kernel,
	linux-arm-kernel, Linux-arm-toolchain

Russell King wrote:
> Thanks for testing; I've applied this patch so 2.6.17-rc2 onwards will
> have this fixed.

Maybe this can also be applied to the data sections, for people who
compile with -fdata-sections?  As in the following patch (note that the
.rodata sections are already wildcarded):

diff -urNd a/arch/arm/boot/compressed/vmlinux.lds.in
b/arch/arm/boot/compressed/vmlinux.lds.in
--- a/arch/arm/boot/compressed/vmlinux.lds.in	2006-03-20
06:53:29.000000000 +0100
+++ b/arch/arm/boot/compressed/vmlinux.lds.in	2006-04-10
11:06:03.000000000 +0200
@@ -34,7 +35,7 @@
   .got			: { *(.got) }
   _got_end = .;
   .got.plt		: { *(.got.plt) }
-  .data			: { *(.data) }
+  .data			: { *(.data) *(.data.*) }
   _edata = .;

   . = BSS_START;

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

* Re: add new code section for kernel code
  2006-04-10  9:12               ` Dimitry Andric
@ 2006-04-11 14:49                 ` saeed bishara
  2006-04-12  5:34                   ` Arjan van de Ven
  0 siblings, 1 reply; 13+ messages in thread
From: saeed bishara @ 2006-04-11 14:49 UTC (permalink / raw)
  To: Dimitry Andric
  Cc: Arjan van de Ven, Paolo Ornati, linux-kernel, linux-arm-kernel,
	Linux-arm-toolchain

inorder to reduce image size of the kenrel I added the --gc-secions
 flag to the LDFALGS_vmlinux, the image size reduced by 120KB (out of
1.8M), but the kernel failed to boot ( after the uncompression stage).
any idea?
I see that the fvr arch aleady using those flags.

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

* Re: add new code section for kernel code
  2006-04-11 14:49                 ` saeed bishara
@ 2006-04-12  5:34                   ` Arjan van de Ven
  0 siblings, 0 replies; 13+ messages in thread
From: Arjan van de Ven @ 2006-04-12  5:34 UTC (permalink / raw)
  To: saeed bishara
  Cc: Dimitry Andric, Paolo Ornati, linux-kernel, linux-arm-kernel,
	Linux-arm-toolchain

On Tue, 2006-04-11 at 17:49 +0300, saeed bishara wrote:
> inorder to reduce image size of the kenrel I added the --gc-secions
>  flag to the LDFALGS_vmlinux, the image size reduced by 120KB (out of
> 1.8M), but the kernel failed to boot ( after the uncompression stage).
> any idea?
> I see that the fvr arch aleady using those flags.

there are some known binutils "issues" (or better "interactions") that
make this not yet practical.



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

end of thread, other threads:[~2006-04-12  5:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-06 12:45 add new code section for kernel code saeed bishara
2006-04-06 13:10 ` Paolo Ornati
2006-04-06 15:27   ` saeed bishara
2006-04-06 16:47   ` saeed bishara
2006-04-07 11:02     ` saeed bishara
2006-04-07 15:14       ` Arjan van de Ven
2006-04-07 15:43         ` Russell King
2006-04-09  9:53           ` saeed bishara
2006-04-09 20:30             ` Russell King
2006-04-10  7:11               ` saeed bishara
2006-04-10  9:12               ` Dimitry Andric
2006-04-11 14:49                 ` saeed bishara
2006-04-12  5:34                   ` Arjan van de Ven

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).