All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: makefile: add tuning options for Armada 370/XP
@ 2013-04-06 19:29 Willy Tarreau
  2013-04-06 21:48 ` Gregory CLEMENT
  2013-04-08 15:20 ` Russell King - ARM Linux
  0 siblings, 2 replies; 4+ messages in thread
From: Willy Tarreau @ 2013-04-06 19:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

A patch from Marvell was merged in GCC 4.8 to add support for their
PJ4 CPU core used in Armada370 and XP. I noticed a steady 2% network
performance increase using -mcpu=marvell-pj4 and around 1% when using
-mtune=xscale instead. I have no idea whether it provides anything to
the Dove platform and I don't have one to test, so I didn't touch it.

Now that 4.8 is released, it would be nice to have this option used
when supported.

Regards,
Willy

>From b5b34f87e753fbd756f3c23536e731bb1aa6bf7f Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w@1wt.eu>
Date: Sun, 3 Mar 2013 23:26:41 +0100
Subject: [PATCH] ARM: makefile: add tuning options for Armada 370/XP

Let's pass -mcpu=marvell-pj4 and fall back to -mtune=xscale for Armada370
and ArmadaXP. Both settings have shown an improvement over the default
setting on these chips using gcc-4.7 with and without the Marvell patch
(typically 2% on network traffic).

Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/arm/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 15747d9..7dd5418 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -93,6 +93,7 @@ tune-$(CONFIG_CPU_XSC3)		:=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -
 tune-$(CONFIG_CPU_FEROCEON)	:=$(call cc-option,-mtune=marvell-f,-mtune=xscale)
 tune-$(CONFIG_CPU_V6)		:=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
 tune-$(CONFIG_CPU_V6K)		:=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
+tune-$(CONFIG_MACH_ARMADA_370_XP)	:=$(call cc-option,-mcpu=marvell-pj4,-mtune=xscale)
 
 ifeq ($(CONFIG_AEABI),y)
 CFLAGS_ABI	:=-mabi=aapcs-linux -mno-thumb-interwork
-- 
1.7.12.2.21.g234cd45.dirty

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

* [PATCH] ARM: makefile: add tuning options for Armada 370/XP
  2013-04-06 19:29 [PATCH] ARM: makefile: add tuning options for Armada 370/XP Willy Tarreau
@ 2013-04-06 21:48 ` Gregory CLEMENT
  2013-04-06 21:54   ` Willy Tarreau
  2013-04-08 15:20 ` Russell King - ARM Linux
  1 sibling, 1 reply; 4+ messages in thread
From: Gregory CLEMENT @ 2013-04-06 21:48 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Willy,

On 04/06/2013 09:29 PM, Willy Tarreau wrote:
> Hi,
> 
> A patch from Marvell was merged in GCC 4.8 to add support for their
> PJ4 CPU core used in Armada370 and XP. I noticed a steady 2% network
> performance increase using -mcpu=marvell-pj4 and around 1% when using
> -mtune=xscale instead. I have no idea whether it provides anything to
> the Dove platform and I don't have one to test, so I didn't touch it.
> 
> Now that 4.8 is released, it would be nice to have this option used
> when supported.

Sure it will be very nice! But what happens when the kernel is built
in multiarch?
It seems to me that in this case gcc will tune the code for PJ4 whereas
the kernel built can also be run on a Cortex-A, a Scorpion or a Krait.

Regards,
> 
> Regards,
> Willy
> 
> From b5b34f87e753fbd756f3c23536e731bb1aa6bf7f Mon Sep 17 00:00:00 2001
> From: Willy Tarreau <w@1wt.eu>
> Date: Sun, 3 Mar 2013 23:26:41 +0100
> Subject: [PATCH] ARM: makefile: add tuning options for Armada 370/XP
> 
> Let's pass -mcpu=marvell-pj4 and fall back to -mtune=xscale for Armada370
> and ArmadaXP. Both settings have shown an improvement over the default
> setting on these chips using gcc-4.7 with and without the Marvell patch
> (typically 2% on network traffic).
> 
> Signed-off-by: Willy Tarreau <w@1wt.eu>
> ---
>  arch/arm/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 15747d9..7dd5418 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -93,6 +93,7 @@ tune-$(CONFIG_CPU_XSC3)		:=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -
>  tune-$(CONFIG_CPU_FEROCEON)	:=$(call cc-option,-mtune=marvell-f,-mtune=xscale)
>  tune-$(CONFIG_CPU_V6)		:=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
>  tune-$(CONFIG_CPU_V6K)		:=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
> +tune-$(CONFIG_MACH_ARMADA_370_XP)	:=$(call cc-option,-mcpu=marvell-pj4,-mtune=xscale)
>  
>  ifeq ($(CONFIG_AEABI),y)
>  CFLAGS_ABI	:=-mabi=aapcs-linux -mno-thumb-interwork
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [PATCH] ARM: makefile: add tuning options for Armada 370/XP
  2013-04-06 21:48 ` Gregory CLEMENT
@ 2013-04-06 21:54   ` Willy Tarreau
  0 siblings, 0 replies; 4+ messages in thread
From: Willy Tarreau @ 2013-04-06 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Gr?gory,

On Sat, Apr 06, 2013 at 11:48:28PM +0200, Gregory CLEMENT wrote:
> Hi Willy,
> 
> On 04/06/2013 09:29 PM, Willy Tarreau wrote:
> > Hi,
> > 
> > A patch from Marvell was merged in GCC 4.8 to add support for their
> > PJ4 CPU core used in Armada370 and XP. I noticed a steady 2% network
> > performance increase using -mcpu=marvell-pj4 and around 1% when using
> > -mtune=xscale instead. I have no idea whether it provides anything to
> > the Dove platform and I don't have one to test, so I didn't touch it.
> > 
> > Now that 4.8 is released, it would be nice to have this option used
> > when supported.
> 
> Sure it will be very nice! But what happens when the kernel is built
> in multiarch?
> It seems to me that in this case gcc will tune the code for PJ4 whereas
> the kernel built can also be run on a Cortex-A, a Scorpion or a Krait.

I have not thought about that. Maybe we're already reaching the limits of
the multiarch mode ? After all, pj4 is not a cortex-a, which probably is
the reason that justifies having specific gcc optimizations that are
different from cortex-a.

So in the end, I'm starting to wonder whether it makes sense to permit
non-100% compatible armv7 chips to coexist in the same kernel :-/

Otherwise we could do what already exists on x86, which is to let the
user select which chip he wants to optimize for. I have no idea on the
subject to be honnest.

Best regards,
Willy

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

* [PATCH] ARM: makefile: add tuning options for Armada 370/XP
  2013-04-06 19:29 [PATCH] ARM: makefile: add tuning options for Armada 370/XP Willy Tarreau
  2013-04-06 21:48 ` Gregory CLEMENT
@ 2013-04-08 15:20 ` Russell King - ARM Linux
  1 sibling, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux @ 2013-04-08 15:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Apr 06, 2013 at 09:29:57PM +0200, Willy Tarreau wrote:
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 15747d9..7dd5418 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -93,6 +93,7 @@ tune-$(CONFIG_CPU_XSC3)		:=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -
>  tune-$(CONFIG_CPU_FEROCEON)	:=$(call cc-option,-mtune=marvell-f,-mtune=xscale)
>  tune-$(CONFIG_CPU_V6)		:=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
>  tune-$(CONFIG_CPU_V6K)		:=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
> +tune-$(CONFIG_MACH_ARMADA_370_XP)	:=$(call cc-option,-mcpu=marvell-pj4,-mtune=xscale)

Do not do this.  This is not how these options work.  Look at all the
above - they all use -mtune=.

The reason for this is that we want to control which instructions are
used (-march=) independently of how the instructions are scheduled
(-mtune=).

Using -mcpu= influences both of those in an adverse way - it can enable
instructions which are not present on other CPUs in the same kernel.

So, the use of -mcpu= is not permitted in the kernel.  Instead, use
-march= and -mtune= in an appropriate manner to achieve your goal.

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

end of thread, other threads:[~2013-04-08 15:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-06 19:29 [PATCH] ARM: makefile: add tuning options for Armada 370/XP Willy Tarreau
2013-04-06 21:48 ` Gregory CLEMENT
2013-04-06 21:54   ` Willy Tarreau
2013-04-08 15:20 ` Russell King - ARM Linux

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.