All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Juraj Linkeš" <juraj.linkes@pantheon.tech>
To: Bruce Richardson <bruce.richardson@intel.com>,
	David Christensen <drc@linux.vnet.ibm.com>
Cc: "thomas@monjalon.net" <thomas@monjalon.net>,
	"Honnappa.Nagarahalli@arm.com" <Honnappa.Nagarahalli@arm.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [RFC PATCH v2] build: add platform meson option
Date: Fri, 19 Feb 2021 09:11:32 +0000	[thread overview]
Message-ID: <1ab99ff8a97e4341830f17cce45d47db@pantheon.tech> (raw)
In-Reply-To: <20210106144249.GB1969@bricha3-MOBL.ger.corp.intel.com>



> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Wednesday, January 6, 2021 3:43 PM
> To: David Christensen <drc@linux.vnet.ibm.com>
> Cc: Juraj Linkeš <juraj.linkes@pantheon.tech>; thomas@monjalon.net;
> Honnappa.Nagarahalli@arm.com; dev@dpdk.org
> Subject: Re: [RFC PATCH v2] build: add platform meson option
> 
> On Tue, Jan 05, 2021 at 02:17:44PM -0800, David Christensen wrote:
> > > > The current meson option 'machine' should only specify the ISA,
> > > > which is not sufficient for Arm, where setting ISA implies other setting as
> well.
> > > > Add a new meson option, 'platform', which differentiates the type
> > > > of the build
> > > > (native/generic) and sets machine accordingly, unless the user
> > > > chooses to override it.
> > > > The 'machine' option also doesn't describe very well what it sets,
> > > > so introduce a new option 'cpu_instruction_set', but keep
> > > > 'machine' for backward compatibility.
> > > > These two new variables, taken together, achieve what 'machine'
> > > > was setting per architecture - setting the ISA in x86 build and
> > > > setting native/default 'build type' in aarch64 build - is now
> > > > properly being set for all architectures in a uniform manner.
> > > >
> > > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > > > ---
> > > >   config/arm/meson.build        |  4 +--
> > > >   config/meson.build            | 47 +++++++++++++++++++++++++----------
> > > >   devtools/test-meson-builds.sh |  9 ++++---
> > > >   meson_options.txt             |  8 ++++--
> > > >   4 files changed, 47 insertions(+), 21 deletions(-)
> > > >
> > > > diff --git a/config/arm/meson.build b/config/arm/meson.build index
> > > > 42b4e43c7..6b09a74a7 100644
> > > > --- a/config/arm/meson.build
> > > > +++ b/config/arm/meson.build
> > > > @@ -3,10 +3,10 @@
> > > >   # Copyright(c) 2017 Cavium, Inc
> > > >
> > > >   # for checking defines we need to use the correct compiler flags
> > > > -march_opt = '-
> > > > march=@0@'.format(machine)
> > > > +march_opt = '-march=@0@'.format(cpu_instruction_set)
> > > >
> > > >   arm_force_native_march = false
> > > > -arm_force_default_march = (machine == 'default')
> > > > +arm_force_default_march = (platform == 'generic')
> > > >
> > > >   flags_common_default = [
> > > >   	# Accelarate rte_memcpy. Be sure to run unit test
> > > > (memcpy_perf_autotest) diff --git a/config/meson.build
> > > > b/config/meson.build index a3154e29c..647116513 100644
> > > > --- a/config/meson.build
> > > > +++ b/config/meson.build
> > > > @@ -63,42 +63,63 @@ if not is_windows
> > > >   			pmd_subdir_opt)
> > > >   endif
> > > >
> > > > -# set the machine type and cflags for it
> > > > +platform = get_option('platform')
> > > > +
> > > > +# set the cpu_instruction_set type and cflags for it
> > > >   if meson.is_cross_build()
> > > > -	machine = host_machine.cpu()
> > > > +	cpu_instruction_set = host_machine.cpu()
> > > >   else
> > > > -	machine = get_option('machine')
> > > > +	cpu_instruction_set = get_option('cpu_instruction_set')
> > > > +	if get_option('machine') != 'auto'
> > > > +		warning('The "machine" option is deprecated. ' +
> > > > +		        'Please use "cpu_instruction_set" instead.')
> > > > +		if cpu_instruction_set != 'auto'
> > > > +			error('Setting both "machine" and ' +
> > > > +			      '"cpu_instruction_set" is unsupported.')
> > > > +		endif
> > > > +		cpu_instruction_set = get_option('machine')
> > > > +	endif
> > > > +endif
> > > > +
> > > > +if platform == 'native'
> > > > +	if cpu_instruction_set == 'auto'
> > > > +		cpu_instruction_set = 'native'
> > > > +	endif
> > > > +elif platform == 'generic'
> > > > +	if cpu_instruction_set == 'auto'
> > > > +		cpu_instruction_set = 'default'
> > > > +	endif
> > > >   endif
> > > >
> > > > -# machine type 'default' is special, it defaults to the per arch
> > > > agreed common
> > > > +if cpu_instruction_set == 'default'
> > > > +# cpu_instruction_set 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'
> > > > +		cpu_instruction_set = 'corei7'
> > > >   	elif host_machine.cpu_family().startswith('arm')
> > > > -		machine = 'armv7-a'
> > > > +		cpu_instruction_set = 'armv7-a'
> > > >   	elif host_machine.cpu_family().startswith('aarch')
> > > >   		# arm64 manages defaults in config/arm/meson.build
> > > > -		machine = 'default'
> > > > +		cpu_instruction_set = 'default'
> > > >   	elif host_machine.cpu_family().startswith('ppc')
> > > > -		machine = 'power8'
> > > > +		cpu_instruction_set = 'power8'
> > > >   	endif
> > > >   endif
> >
> > This change forces the build on a P9 system to use the P8 instruction set.
> > Prior to this change the "native" machine type was used which resulted
> > in P9 instructions when built on a P9 system.  How do I force the
> > build to use the
> > power9 instruction set in this case?
> >
> > Dave
> 
> From looking at the patch, setting the "platform" to "native", or the
> instruction_set to "native" should do this.
> While I consider generic builds a good thing, I wonder if there is an expectation
> that "native" is always the default build type for DPDK builds?
> 
> /Bruce

I left this patch alone so that people could chime in, but noone did, so let's try to find some agreeable solution.

My current thoughts are as such:
The platform parameter specifies a set of DPDK options that will be used. This is what arm uses for its builds, x86 and ppc don't use this.
The cpu_instruction_set sets just one configuration among the "platform" configuration set.
We want the build to work on most machines of the machine architecture. That implies platform=generic (as in use config options that will work on everything of that architecture) and cpu_instruction_set=generic (as in use ISA that will work on all cpus of the build machine architecture).
Setting cpu_instruction_set=generic changes the build without cmdline options for ppc. Thus, the expectation may be that cpu_instruction_set should be native by default.

For arm, cpu_instruction_set is ignored (and thus the value doen't matter), since we can't use that without other config options (e.g. DPDK config for an SoC (such as RTE_ARM_FEATURE_ATOMICS) used with an invalid cpu_instuction_set). That means the only relevant parameter for Arm is platform and if we want to have a build usable on most machines of the build type, we have to use platform=generic.

For x86 and ppc, there's no difference between native and generic platform (as it's a new argument, the purpose of which is to differentiate DPDK config across platforms, which doesn't exist for x86 and ppc - DPDK config is the same (correct me if I'm wrong)).

So it basically boils down to what should be the default value of cpu_instruction_set when platform=generic (for platform=native, it's obviously native):
1. cpu_instruction_set=native, this would preserve the current behavior, but we won't use the 'auto' default. I think we can fall back to this if we don't agree on anything better.
2. cpu_instruction_set=auto, the same as cpu_instruction_set=generic,
3. cpu_instruction_set=generic, this changes behavior for ppc builds, but we may be able to remedy this:
Similarly to arm (arm is using platform for this, but the idea is the same), if cpu_instruction_set is generic, we can do some discovery for pcc and set the ISA accordingly (either power8 or power9). If I understand it correctly, power8 is a different architecture from power9 (I could be wrong on this), so this is desirable. There's some logic in config/ppc/meson.build, but it doesn't seem sufficient as a discovery mechanism between power8/power9.

I like 3 if we can find a way to discover power8/power9 ppc (that way we would be able to use cpu_instruction_set=auto), if not, we should probably go with 1 (in which case we can't use cpu_instruction_set=auto).

Or maybe we're overthingking this and we really should go with 1. What's (or should be) the difference between cpu_instruction_set=generic and cpu_instruction_set=native for x86 and ppc?

  reply	other threads:[~2021-02-19  9:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 15:47 [dpdk-dev] [RFC PATCH v1] build: add platform meson option Juraj Linkeš
2020-11-26 16:02 ` Bruce Richardson
2020-11-27  8:31   ` Juraj Linkeš
2020-11-27 14:07     ` Bruce Richardson
2020-12-23 11:23       ` Juraj Linkeš
2021-01-04 11:52 ` [dpdk-dev] [RFC PATCH v2] " Juraj Linkeš
2021-01-04 11:59   ` Juraj Linkeš
2021-01-05 22:17     ` David Christensen
2021-01-06 14:42       ` Bruce Richardson
2021-02-19  9:11         ` Juraj Linkeš [this message]
2021-02-22 21:25           ` David Christensen
2021-02-23  8:45             ` Juraj Linkeš
2021-02-23  9:43               ` Bruce Richardson
2021-02-25 12:51                 ` Juraj Linkeš
2021-02-25 12:54                   ` Bruce Richardson
2021-02-25 12:57                     ` Juraj Linkeš
2021-03-29 11:03   ` [dpdk-dev] [PATCH v3] " Juraj Linkeš
2021-03-29 12:50     ` [dpdk-dev] [PATCH v4] " Juraj Linkeš
2021-03-31 12:16       ` Juraj Linkeš
2021-03-31 12:19         ` Juraj Linkeš
2021-03-31 12:39         ` Bruce Richardson
2021-04-15 13:32           ` Juraj Linkeš
2021-04-15 13:51             ` Bruce Richardson
2021-04-20  8:08       ` [dpdk-dev] [PATCH v5] build: use platform option for generic and native Juraj Linkeš
2021-04-20  8:16         ` Juraj Linkeš
2021-04-20  8:36           ` Thomas Monjalon
2021-04-21  8:37             ` Juraj Linkeš
2021-04-22  8:34               ` Wang, Yinan
2021-06-30 13:09         ` [dpdk-dev] [PATCH v6] build: use platform for generic and native builds Juraj Linkeš
2021-07-06  9:44           ` [dpdk-dev] [PATCH v7] " Juraj Linkeš
2021-07-07 13:59             ` Bruce Richardson
2021-07-09 12:30               ` Thomas Monjalon
2021-07-09 13:55                 ` Juraj Linkeš

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ab99ff8a97e4341830f17cce45d47db@pantheon.tech \
    --to=juraj.linkes@pantheon.tech \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=drc@linux.vnet.ibm.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.