[2/2] build: establish an invariant machine type

Message ID 20181114113453.24852-2-christian.ehrhardt@canonical.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [1/2] build: avoid non supported -march on ppc (meson) |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Christian Ehrhardt Nov. 14, 2018, 11:34 a.m. UTC
  Add the machine definition 'baseline' which is special compared
to 'native' (most optimized for current system) or any explicit
type (external entity has to decide on the type).

It defaults to the per arch agreed common minimal baseline
needed for DPDK to reasonable work.

That might not be the most optimized, but the most portable
version while still being able to support the CPU features
required for DPDK.

Going forward this can be bumped up by the DPDK project, but it
can never be an invariant like 'native'.

Distributions and other needing portable code are expected to
define the machine as 'baseline'.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 config/meson.build | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
  

Comments

Luca Boccassi Nov. 14, 2018, 11:40 a.m. UTC | #1
On Wed, 2018-11-14 at 12:34 +0100, Christian Ehrhardt wrote:
> Add the machine definition 'baseline' which is special compared
> to 'native' (most optimized for current system) or any explicit
> type (external entity has to decide on the type).
> 
> It defaults to the per arch agreed common minimal baseline
> needed for DPDK to reasonable work.
> 
> That might not be the most optimized, but the most portable
> version while still being able to support the CPU features
> required for DPDK.
> 
> Going forward this can be bumped up by the DPDK project, but it
> can never be an invariant like 'native'.
> 
> Distributions and other needing portable code are expected to
> define the machine as 'baseline'.
> 
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---
>  config/meson.build | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/config/meson.build b/config/meson.build
> index 1af305f46..23f612457 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -7,6 +7,27 @@ if meson.is_cross_build()
>  else
>  	machine = get_option('machine')
>  endif
> +
> +# machine type 'baseline' is special, it defaults to the per arch
> agreed common
> +# minimal baseline needed for DPDK.
> +# That might not be the most optimized, but the most portable
> version while
> +# still being able to support the CPU features required for DPDK.
> +# This can be bumped up by the DPDK project, but it can never be an
> +# invariant like 'native'
> +if machine == 'baseline'
> +	if host_machine.cpu_family().startswith('x86')
> +		# matches the old pre-meson build systems default
> +		machine = 'corei7'
> +	elif host_machine.cpu_family().startswith('arm')
> +		machine = 'armv7a'
> +	elif host_machine.cpu_family().startswith('aarch')
> +		# arm64 manages defaults in config/arm/meson.build
> +		machine = 'default'
> +	elif host_machine.cpu_family().startswith('ppc')
> +		machine = 'power8'
> +	endif
> +endif
> +
>  dpdk_conf.set('RTE_MACHINE', machine)
>  machine_args = []

Acked-by: Luca Boccassi <bluca@debian.org>
  
Bruce Richardson Nov. 14, 2018, 11:52 a.m. UTC | #2
On Wed, Nov 14, 2018 at 11:40:11AM +0000, Luca Boccassi wrote:
> On Wed, 2018-11-14 at 12:34 +0100, Christian Ehrhardt wrote:
> > Add the machine definition 'baseline' which is special compared
> > to 'native' (most optimized for current system) or any explicit
> > type (external entity has to decide on the type).
> > 
> > It defaults to the per arch agreed common minimal baseline
> > needed for DPDK to reasonable work.
> > 
> > That might not be the most optimized, but the most portable
> > version while still being able to support the CPU features
> > required for DPDK.
> > 
> > Going forward this can be bumped up by the DPDK project, but it
> > can never be an invariant like 'native'.
> > 
> > Distributions and other needing portable code are expected to
> > define the machine as 'baseline'.
> > 
> > Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> > ---
> >  config/meson.build | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> > 
> > diff --git a/config/meson.build b/config/meson.build
> > index 1af305f46..23f612457 100644
> > --- a/config/meson.build
> > +++ b/config/meson.build
> > @@ -7,6 +7,27 @@ if meson.is_cross_build()
> >  else
> >  	machine = get_option('machine')
> >  endif
> > +
> > +# machine type 'baseline' is special, it defaults to the per arch
> > agreed common
> > +# minimal baseline needed for DPDK.
> > +# That might not be the most optimized, but the most portable
> > version while
> > +# still being able to support the CPU features required for DPDK.
> > +# This can be bumped up by the DPDK project, but it can never be an
> > +# invariant like 'native'
> > +if machine == 'baseline'
> > +	if host_machine.cpu_family().startswith('x86')
> > +		# matches the old pre-meson build systems default
> > +		machine = 'corei7'
> > +	elif host_machine.cpu_family().startswith('arm')
> > +		machine = 'armv7a'
> > +	elif host_machine.cpu_family().startswith('aarch')
> > +		# arm64 manages defaults in config/arm/meson.build
> > +		machine = 'default'
> > +	elif host_machine.cpu_family().startswith('ppc')
> > +		machine = 'power8'
> > +	endif
> > +endif
> > +
> >  dpdk_conf.set('RTE_MACHINE', machine)
> >  machine_args = []
> 
> Acked-by: Luca Boccassi <bluca@debian.org>
> 
No objection in principle, but, for alignment with make build system, do we
want to call this "default" instead? Given a clean slate, "baseline" is more
descriptive, but make already uses "default" for this. Perhaps support
both?

/Bruce
  
Luca Boccassi Nov. 14, 2018, 12:05 p.m. UTC | #3
On Wed, 2018-11-14 at 11:52 +0000, Bruce Richardson wrote:
> On Wed, Nov 14, 2018 at 11:40:11AM +0000, Luca Boccassi wrote:
> > On Wed, 2018-11-14 at 12:34 +0100, Christian Ehrhardt wrote:
> > > Add the machine definition 'baseline' which is special compared
> > > to 'native' (most optimized for current system) or any explicit
> > > type (external entity has to decide on the type).
> > > 
> > > It defaults to the per arch agreed common minimal baseline
> > > needed for DPDK to reasonable work.
> > > 
> > > That might not be the most optimized, but the most portable
> > > version while still being able to support the CPU features
> > > required for DPDK.
> > > 
> > > Going forward this can be bumped up by the DPDK project, but it
> > > can never be an invariant like 'native'.
> > > 
> > > Distributions and other needing portable code are expected to
> > > define the machine as 'baseline'.
> > > 
> > > Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.c
> > > om>
> > > ---
> > >  config/meson.build | 21 +++++++++++++++++++++
> > >  1 file changed, 21 insertions(+)
> > > 
> > > diff --git a/config/meson.build b/config/meson.build
> > > index 1af305f46..23f612457 100644
> > > --- a/config/meson.build
> > > +++ b/config/meson.build
> > > @@ -7,6 +7,27 @@ if meson.is_cross_build()
> > >  else
> > >  	machine = get_option('machine')
> > >  endif
> > > +
> > > +# machine type 'baseline' is special, it defaults to the per
> > > arch
> > > agreed common
> > > +# minimal baseline needed for DPDK.
> > > +# That might not be the most optimized, but the most portable
> > > version while
> > > +# still being able to support the CPU features required for
> > > DPDK.
> > > +# This can be bumped up by the DPDK project, but it can never be
> > > an
> > > +# invariant like 'native'
> > > +if machine == 'baseline'
> > > +	if host_machine.cpu_family().startswith('x86')
> > > +		# matches the old pre-meson build systems
> > > default
> > > +		machine = 'corei7'
> > > +	elif host_machine.cpu_family().startswith('arm')
> > > +		machine = 'armv7a'
> > > +	elif host_machine.cpu_family().startswith('aarch')
> > > +		# arm64 manages defaults in
> > > config/arm/meson.build
> > > +		machine = 'default'
> > > +	elif host_machine.cpu_family().startswith('ppc')
> > > +		machine = 'power8'
> > > +	endif
> > > +endif
> > > +
> > >  dpdk_conf.set('RTE_MACHINE', machine)
> > >  machine_args = []
> > 
> > Acked-by: Luca Boccassi <bluca@debian.org>
> > 
> 
> No objection in principle, but, for alignment with make build system,
> do we
> want to call this "default" instead? Given a clean slate, "baseline"
> is more
> descriptive, but make already uses "default" for this. Perhaps
> support
> both?
> 
> /Bruce

I'm fine with both - but if make already has default, it makes sense to
keep it consistent.
  
Luca Boccassi Nov. 14, 2018, 1:06 p.m. UTC | #4
On Wed, 2018-11-14 at 12:34 +0100, Christian Ehrhardt wrote:
> Add the machine definition 'baseline' which is special compared
> to 'native' (most optimized for current system) or any explicit
> type (external entity has to decide on the type).
> 
> It defaults to the per arch agreed common minimal baseline
> needed for DPDK to reasonable work.
> 
> That might not be the most optimized, but the most portable
> version while still being able to support the CPU features
> required for DPDK.
> 
> Going forward this can be bumped up by the DPDK project, but it
> can never be an invariant like 'native'.
> 
> Distributions and other needing portable code are expected to
> define the machine as 'baseline'.
> 
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---
>  config/meson.build | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/config/meson.build b/config/meson.build
> index 1af305f46..23f612457 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -7,6 +7,27 @@ if meson.is_cross_build()
>  else
>  	machine = get_option('machine')
>  endif
> +
> +# machine type 'baseline' is special, it defaults to the per arch
> agreed common
> +# minimal baseline needed for DPDK.
> +# That might not be the most optimized, but the most portable
> version while
> +# still being able to support the CPU features required for DPDK.
> +# This can be bumped up by the DPDK project, but it can never be an
> +# invariant like 'native'
> +if machine == 'baseline'
> +	if host_machine.cpu_family().startswith('x86')
> +		# matches the old pre-meson build systems default
> +		machine = 'corei7'
> +	elif host_machine.cpu_family().startswith('arm')
> +		machine = 'armv7a'

gcc complains, it wants armv7-a instead (tried on a native armhf
machine, with the change the meson configure passes and ninja is now
_slowly_ building its way through)

> +	elif host_machine.cpu_family().startswith('aarch')
> +		# arm64 manages defaults in config/arm/meson.build
> +		machine = 'default'
> +	elif host_machine.cpu_family().startswith('ppc')
> +		machine = 'power8'
> +	endif
> +endif
> +
>  dpdk_conf.set('RTE_MACHINE', machine)
>  machine_args = []
>
  
Christian Ehrhardt Nov. 14, 2018, 1:08 p.m. UTC | #5
On Wed, Nov 14, 2018 at 2:06 PM Luca Boccassi <bluca@debian.org> wrote:
>
> On Wed, 2018-11-14 at 12:34 +0100, Christian Ehrhardt wrote:
> > Add the machine definition 'baseline' which is special compared
> > to 'native' (most optimized for current system) or any explicit
> > type (external entity has to decide on the type).
> >
> > It defaults to the per arch agreed common minimal baseline
> > needed for DPDK to reasonable work.
> >
> > That might not be the most optimized, but the most portable
> > version while still being able to support the CPU features
> > required for DPDK.
> >
> > Going forward this can be bumped up by the DPDK project, but it
> > can never be an invariant like 'native'.
> >
> > Distributions and other needing portable code are expected to
> > define the machine as 'baseline'.
> >
> > Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> > ---
> >  config/meson.build | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> >
> > diff --git a/config/meson.build b/config/meson.build
> > index 1af305f46..23f612457 100644
> > --- a/config/meson.build
> > +++ b/config/meson.build
> > @@ -7,6 +7,27 @@ if meson.is_cross_build()
> >  else
> >       machine = get_option('machine')
> >  endif
> > +
> > +# machine type 'baseline' is special, it defaults to the per arch
> > agreed common
> > +# minimal baseline needed for DPDK.
> > +# That might not be the most optimized, but the most portable
> > version while
> > +# still being able to support the CPU features required for DPDK.
> > +# This can be bumped up by the DPDK project, but it can never be an
> > +# invariant like 'native'
> > +if machine == 'baseline'
> > +     if host_machine.cpu_family().startswith('x86')
> > +             # matches the old pre-meson build systems default
> > +             machine = 'corei7'
> > +     elif host_machine.cpu_family().startswith('arm')
> > +             machine = 'armv7a'
>
> gcc complains, it wants armv7-a instead (tried on a native armhf
> machine, with the change the meson configure passes and ninja is now
> _slowly_ building its way through)

Thanks will update that in a v2

>
> > +     elif host_machine.cpu_family().startswith('aarch')
> > +             # arm64 manages defaults in config/arm/meson.build
> > +             machine = 'default'
> > +     elif host_machine.cpu_family().startswith('ppc')
> > +             machine = 'power8'
> > +     endif
> > +endif
> > +
> >  dpdk_conf.set('RTE_MACHINE', machine)
> >  machine_args = []
> >
>
> --
> Kind regards,
> Luca Boccassi
  
Christian Ehrhardt Nov. 14, 2018, 1:09 p.m. UTC | #6
On Wed, Nov 14, 2018 at 1:05 PM Luca Boccassi <bluca@debian.org> wrote:
>
> On Wed, 2018-11-14 at 11:52 +0000, Bruce Richardson wrote:
> > On Wed, Nov 14, 2018 at 11:40:11AM +0000, Luca Boccassi wrote:
> > > On Wed, 2018-11-14 at 12:34 +0100, Christian Ehrhardt wrote:
> > > > Add the machine definition 'baseline' which is special compared
> > > > to 'native' (most optimized for current system) or any explicit
> > > > type (external entity has to decide on the type).
> > > >
> > > > It defaults to the per arch agreed common minimal baseline
> > > > needed for DPDK to reasonable work.
> > > >
> > > > That might not be the most optimized, but the most portable
> > > > version while still being able to support the CPU features
> > > > required for DPDK.
> > > >
> > > > Going forward this can be bumped up by the DPDK project, but it
> > > > can never be an invariant like 'native'.
> > > >
> > > > Distributions and other needing portable code are expected to
> > > > define the machine as 'baseline'.
> > > >
> > > > Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.c
> > > > om>
> > > > ---
> > > >  config/meson.build | 21 +++++++++++++++++++++
> > > >  1 file changed, 21 insertions(+)
> > > >
> > > > diff --git a/config/meson.build b/config/meson.build
> > > > index 1af305f46..23f612457 100644
> > > > --- a/config/meson.build
> > > > +++ b/config/meson.build
> > > > @@ -7,6 +7,27 @@ if meson.is_cross_build()
> > > >  else
> > > >   machine = get_option('machine')
> > > >  endif
> > > > +
> > > > +# machine type 'baseline' is special, it defaults to the per
> > > > arch
> > > > agreed common
> > > > +# minimal baseline needed for DPDK.
> > > > +# That might not be the most optimized, but the most portable
> > > > version while
> > > > +# still being able to support the CPU features required for
> > > > DPDK.
> > > > +# This can be bumped up by the DPDK project, but it can never be
> > > > an
> > > > +# invariant like 'native'
> > > > +if machine == 'baseline'
> > > > + if host_machine.cpu_family().startswith('x86')
> > > > +         # matches the old pre-meson build systems
> > > > default
> > > > +         machine = 'corei7'
> > > > + elif host_machine.cpu_family().startswith('arm')
> > > > +         machine = 'armv7a'
> > > > + elif host_machine.cpu_family().startswith('aarch')
> > > > +         # arm64 manages defaults in
> > > > config/arm/meson.build
> > > > +         machine = 'default'
> > > > + elif host_machine.cpu_family().startswith('ppc')
> > > > +         machine = 'power8'
> > > > + endif
> > > > +endif
> > > > +
> > > >  dpdk_conf.set('RTE_MACHINE', machine)
> > > >  machine_args = []
> > >
> > > Acked-by: Luca Boccassi <bluca@debian.org>
> > >
> >
> > No objection in principle, but, for alignment with make build system,
> > do we
> > want to call this "default" instead? Given a clean slate, "baseline"
> > is more
> > descriptive, but make already uses "default" for this. Perhaps
> > support
> > both?
> >
> > /Bruce
>
> I'm fine with both - but if make already has default, it makes sense to
> keep it consistent.

Yeah I agree for consistency, I just need to check for a v2 if none of
them will misuse default to become native again

> --
> Kind regards,
> Luca Boccassi
  

Patch

diff --git a/config/meson.build b/config/meson.build
index 1af305f46..23f612457 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -7,6 +7,27 @@  if meson.is_cross_build()
 else
 	machine = get_option('machine')
 endif
+
+# machine type 'baseline' is special, it defaults to the per arch agreed common
+# minimal baseline needed for DPDK.
+# That might not be the most optimized, but the most portable version while
+# still being able to support the CPU features required for DPDK.
+# This can be bumped up by the DPDK project, but it can never be an
+# invariant like 'native'
+if machine == 'baseline'
+	if host_machine.cpu_family().startswith('x86')
+		# matches the old pre-meson build systems default
+		machine = 'corei7'
+	elif host_machine.cpu_family().startswith('arm')
+		machine = 'armv7a'
+	elif host_machine.cpu_family().startswith('aarch')
+		# arm64 manages defaults in config/arm/meson.build
+		machine = 'default'
+	elif host_machine.cpu_family().startswith('ppc')
+		machine = 'power8'
+	endif
+endif
+
 dpdk_conf.set('RTE_MACHINE', machine)
 machine_args = []