[v3] build: establish an invariant machine type

Message ID 20181114143315.2695-1-christian.ehrhardt@canonical.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v3] build: establish an invariant machine type |

Checks

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

Commit Message

Christian Ehrhardt Nov. 14, 2018, 2:33 p.m. UTC
  Add the machine definition 'default' 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 'default'.

Changes in v2:
- fixed the non 64 bit arm default type
- changed baseline to default to match the old build system

Changes in v3:
- add acked-by's
- removed old wording from commit message
- adding Fixes line per request by Luca Boccassi

Fixes: 54d609a13876 ("build: add ppc64 meson build")

Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 config/meson.build | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
  

Comments

Christian Ehrhardt Nov. 14, 2018, 7:39 p.m. UTC | #1
On Wed, Nov 14, 2018 at 3:33 PM Christian Ehrhardt
<christian.ehrhardt@canonical.com> wrote:
>
> Add the machine definition 'default' 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 'default'.
>
> Changes in v2:
> - fixed the non 64 bit arm default type
> - changed baseline to default to match the old build system
>
> Changes in v3:
> - add acked-by's
> - removed old wording from commit message
> - adding Fixes line per request by Luca Boccassi

FYI: I'll drop the version update from the commit (I didn't have a
cover letter to add them instead).
Also I'll add the Acked-by of Luca to the other patch as well and move
the Fixes line as it was meant for the 1/2 of these.

Overall I think v4 will then be fine, all acks in place and hopefully
making it in before -rc4 is defined to fix more peoples builds.
Replying to this mail with both updated patches soon, let me know if
anything else is holding these back from being accepted.

> Fixes: 54d609a13876 ("build: add ppc64 meson build")
>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Luca Boccassi <bluca@debian.org>
> 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..db32499b3 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 'default' 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 == 'default'
> +       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 = 'armv7-a'
> +       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 = []
>
> --
> 2.17.1
>
  
Thomas Monjalon Nov. 18, 2018, 1:24 p.m. UTC | #2
14/11/2018 20:39, Christian Ehrhardt:
> On Wed, Nov 14, 2018 at 3:33 PM Christian Ehrhardt
> <christian.ehrhardt@canonical.com> wrote:
> >
> > Add the machine definition 'default' 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 'default'.
> >
> > Changes in v2:
> > - fixed the non 64 bit arm default type
> > - changed baseline to default to match the old build system
> >
> > Changes in v3:
> > - add acked-by's
> > - removed old wording from commit message
> > - adding Fixes line per request by Luca Boccassi
> 
> FYI: I'll drop the version update from the commit (I didn't have a
> cover letter to add them instead).

You don't need a cover letter for changelogs.
You can insert it after ---
Usually, I insert changelogs between two --- lines.
  

Patch

diff --git a/config/meson.build b/config/meson.build
index 1af305f46..db32499b3 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 'default' 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 == 'default'
+	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 = 'armv7-a'
+	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 = []