build: add -moutline-atomics to default Arm build

Message ID 1601533194-2295-1-git-send-email-juraj.linkes@pantheon.tech (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series build: add -moutline-atomics to default Arm build |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/travis-robot warning Travis build: failed

Commit Message

Juraj Linkeš Oct. 1, 2020, 6:19 a.m. UTC
  -moutline-atomics allows LSE instructions to be used if available when
compiling for ARMv8.0 instruction set. It's enabled by default on newer
compilers, such as gcc-10.1. Enable the option so that earlier compiler
versions that support it but don't enable it by default build with it.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 config/arm/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon Oct. 6, 2020, 8:14 p.m. UTC | #1
01/10/2020 08:19, Juraj Linkeš:
> -moutline-atomics allows LSE instructions to be used if available when
> compiling for ARMv8.0 instruction set. It's enabled by default on newer
> compilers, such as gcc-10.1. Enable the option so that earlier compiler
> versions that support it but don't enable it by default build with it.
> 
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> ---
>  machine_args_generic = [
> -	['default', ['-march=armv8-a+crc']],
> +	['default', ['-march=armv8-a+crc', '-moutline-atomics']],
>  	['native', ['-march=native']],
>  	['0xd03', ['-mcpu=cortex-a53']],
>  	['0xd04', ['-mcpu=cortex-a35']],

Why is it added only to the target "default"?
  
Ruifeng Wang Oct. 9, 2020, 5:29 a.m. UTC | #2
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, October 7, 2020 4:14 AM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Cc: bruce.richardson@intel.com; dev@dpdk.org; jerinj@marvell.com;
> Ruifeng Wang <Ruifeng.Wang@arm.com>; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>
> Subject: Re: [dpdk-dev] [PATCH] build: add -moutline-atomics to default Arm
> build
> 
> 01/10/2020 08:19, Juraj Linkeš:
> > -moutline-atomics allows LSE instructions to be used if available when
> > compiling for ARMv8.0 instruction set. It's enabled by default on
> > newer compilers, such as gcc-10.1. Enable the option so that earlier
> > compiler versions that support it but don't enable it by default build with it.
> >
> > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > ---
> >  machine_args_generic = [
> > -	['default', ['-march=armv8-a+crc']],
> > +	['default', ['-march=armv8-a+crc', '-moutline-atomics']],
> >  	['native', ['-march=native']],
> >  	['0xd03', ['-mcpu=cortex-a53']],
> >  	['0xd04', ['-mcpu=cortex-a35']],
> 
> Why is it added only to the target "default"?
> 
Because 'default' target generates Armv8.0 instruction set which doesn't include LSE extension. 
The flag enables LSE instructions when code runs on platforms that implements LSE extension.

For other targets, machine specific 'mcpu' or 'march' flags are used. LSE extension availability can be inferred from the given flags.
So there is not need to add '-moutline-atomics' to them.
  
Thomas Monjalon Oct. 9, 2020, 6:52 a.m. UTC | #3
09/10/2020 07:29, Ruifeng Wang:
> From: Thomas Monjalon <thomas@monjalon.net>
> > 01/10/2020 08:19, Juraj Linkeš:
> > > -moutline-atomics allows LSE instructions to be used if available when
> > > compiling for ARMv8.0 instruction set. It's enabled by default on
> > > newer compilers, such as gcc-10.1. Enable the option so that earlier
> > > compiler versions that support it but don't enable it by default build with it.
> > >
> > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > > ---
> > >  machine_args_generic = [
> > > -	['default', ['-march=armv8-a+crc']],
> > > +	['default', ['-march=armv8-a+crc', '-moutline-atomics']],
> > >  	['native', ['-march=native']],
> > >  	['0xd03', ['-mcpu=cortex-a53']],
> > >  	['0xd04', ['-mcpu=cortex-a35']],
> > 
> > Why is it added only to the target "default"?
> > 
> Because 'default' target generates Armv8.0 instruction set which doesn't include LSE extension. 
> The flag enables LSE instructions when code runs on platforms that implements LSE extension.
> 
> For other targets, machine specific 'mcpu' or 'march' flags are used. LSE extension availability can be inferred from the given flags.
> So there is not need to add '-moutline-atomics' to them. 

OK
It's not obvious that the -mcpu flags implicitly include it.
What do you think adding such explanation in a v2?
  
Ruifeng Wang Oct. 9, 2020, 7:07 a.m. UTC | #4
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Friday, October 9, 2020 2:53 PM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>; Ruifeng Wang
> <Ruifeng.Wang@arm.com>
> Cc: bruce.richardson@intel.com; dev@dpdk.org; jerinj@marvell.com;
> Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; nd <nd@arm.com>
> Subject: Re: [dpdk-dev] [PATCH] build: add -moutline-atomics to default Arm
> build
> 
> 09/10/2020 07:29, Ruifeng Wang:
> > From: Thomas Monjalon <thomas@monjalon.net>
> > > 01/10/2020 08:19, Juraj Linkeš:
> > > > -moutline-atomics allows LSE instructions to be used if available
> > > > when compiling for ARMv8.0 instruction set. It's enabled by
> > > > default on newer compilers, such as gcc-10.1. Enable the option so
> > > > that earlier compiler versions that support it but don't enable it by
> default build with it.
> > > >
> > > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > > > ---
> > > >  machine_args_generic = [
> > > > -	['default', ['-march=armv8-a+crc']],
> > > > +	['default', ['-march=armv8-a+crc', '-moutline-atomics']],
> > > >  	['native', ['-march=native']],
> > > >  	['0xd03', ['-mcpu=cortex-a53']],
> > > >  	['0xd04', ['-mcpu=cortex-a35']],
> > >
> > > Why is it added only to the target "default"?
> > >
> > Because 'default' target generates Armv8.0 instruction set which doesn't
> include LSE extension.
> > The flag enables LSE instructions when code runs on platforms that
> implements LSE extension.
> >
> > For other targets, machine specific 'mcpu' or 'march' flags are used. LSE
> extension availability can be inferred from the given flags.
> > So there is not need to add '-moutline-atomics' to them.
> 
> OK
> It's not obvious that the -mcpu flags implicitly include it.
> What do you think adding such explanation in a v2?
> 
Agree. Better to add explanation that this flag benefits distribution build which uses Armv8.0-a as baseline.
More information refer to: https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/making-the-most-of-the-arm-architecture-in-gcc-10
  

Patch

diff --git a/config/arm/meson.build b/config/arm/meson.build
index 8728051d5..b195ec850 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -88,7 +88,7 @@  flags_octeontx2_extra = [
 	['RTE_USE_C11_MEM_MODEL', true]]
 
 machine_args_generic = [
-	['default', ['-march=armv8-a+crc']],
+	['default', ['-march=armv8-a+crc', '-moutline-atomics']],
 	['native', ['-march=native']],
 	['0xd03', ['-mcpu=cortex-a53']],
 	['0xd04', ['-mcpu=cortex-a35']],