DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Juraj Linkeš" <juraj.linkes@pantheon.tech>
To: Dharmik Thakkar <Dharmik.Thakkar@arm.com>
Cc: "thomas@monjalon.net" <thomas@monjalon.net>,
	"dev@dpdk.org" <dev@dpdk.org>, nd <nd@arm.com>
Subject: Re: [dpdk-dev] [PATCH 1/2] config/arm: avoid variable reuse
Date: Fri, 18 Sep 2020 08:40:54 +0000	[thread overview]
Message-ID: <ccbe3bfe7c54452197d7220f06db38be@pantheon.tech> (raw)
In-Reply-To: <652E81A3-01BD-4C8E-AE8F-C3C1B895CFD8@arm.com>



> -----Original Message-----
> From: Dharmik Thakkar <Dharmik.Thakkar@arm.com>
> Sent: Friday, September 18, 2020 7:27 AM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Cc: thomas@monjalon.net; dev@dpdk.org; nd <nd@arm.com>
> Subject: Re: [dpdk-dev] [PATCH 1/2] config/arm: avoid variable reuse
> 
> 
> 
> > On Sep 17, 2020, at 4:33 AM, Juraj Linkeš <juraj.linkes@pantheon.tech> wrote:
> >
> >
> >
> >> -----Original Message-----
> >> From: dev <dev-bounces@dpdk.org> On Behalf Of Dharmik Thakkar
> >> Sent: Tuesday, August 25, 2020 11:13 PM
> >> To: Thomas Monjalon <thomas@monjalon.net>
> >> Cc: dev@dpdk.org; nd@arm.com; Dharmik Thakkar
> >> <dharmik.thakkar@arm.com>
> >> Subject: [dpdk-dev] [PATCH 1/2] config/arm: avoid variable reuse
> >>
> >> Rename 'machine' to 'machine_properties' in config/arm/meson.build
> >> since 'machine' is previously being used in config/meson.build
> >>
> >
> > Wasn't the same variable name used by design? That is update the variable
> according to what's in config/arm/meson.build so that the new updated variable
> would be used in config/meson.build after that?
> >
> 
> The variable ‘machine’ within config/arm/meson.build is essentially machine +
> properties, so I think it makes sense to use a different variable name.
> Also, since, ‘machine’ is a configuration option, IMO it is incorrect to update it.
> 

It is a configuration option defined by us and only used in the config folder, so I guess the original author didn't think much of overwriting. It is actually used in the same manner in both config/meson.build and config/arm/meson.build and that is to set RTE_MACHINE, so I'd say it makes sense to use the same variable name from this point of view.

Also, I see that it's being overwritten in the code (although only for a special case):
if machine == 'default'
	if host_machine.cpu_family().startswith('x86')
		# matches the old pre-meson build systems default
		machine = 'corei7'

But it is only being overwritten in this special case and I think there is value in preserving the original configuration value. That leads me to the conclusion that using the same name was not a deliberate design choice (which was my original question). So, +1 from me.

> >> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> >> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> >> ---
> >> config/arm/meson.build | 18 +++++++++---------
> >> 1 file changed, 9 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/config/arm/meson.build b/config/arm/meson.build index
> >> 8728051d5e38..e89ecdc4ccd2 100644
> >> --- a/config/arm/meson.build
> >> +++ b/config/arm/meson.build
> >> @@ -141,12 +141,12 @@ else
> >> 	dpdk_conf.set('RTE_CACHE_LINE_SIZE', 128)
> >> 	dpdk_conf.set('RTE_ARCH_ARM64', 1)
> >>
> >> -	machine = []
> >> +	machine_properties = []
> >> 	cmd_generic = ['generic', '', '', 'default', '']
> >> 	cmd_output = cmd_generic # Set generic by default
> >> 	machine_args = [] # Clear previous machine args
> >> 	if arm_force_default_march and not meson.is_cross_build()
> >> -		machine = impl_generic
> >> +		machine_properties = impl_generic
> >> 		impl_pn = 'default'
> >> 	elif not meson.is_cross_build()
> >> 		# The script returns ['Implementer', 'Variant', 'Architecture', @@
> >> -158,9 +158,9 @@ else
> >> 			cmd_output = cmd.stdout().to_lower().strip().split(' ')
> >> 		endif
> >> 		# Set to generic if variable is not found
> >> -		machine = get_variable('impl_' + cmd_output[0], ['generic'])
> >> -		if machine[0] == 'generic'
> >> -			machine = impl_generic
> >> +		machine_properties = get_variable('impl_' + cmd_output[0],
> >> ['generic'])
> >> +		if machine_properties[0] == 'generic'
> >> +			machine_properties = impl_generic
> >> 			cmd_output = cmd_generic
> >> 		endif
> >> 		impl_pn = cmd_output[3]
> >> @@ -170,7 +170,7 @@ else
> >> 	else
> >> 		impl_id = meson.get_cross_property('implementor_id',
> >> 'generic')
> >> 		impl_pn = meson.get_cross_property('implementor_pn',
> >> 'default')
> >> -		machine = get_variable('impl_' + impl_id)
> >> +		machine_properties = get_variable('impl_' + impl_id)
> >> 	endif
> >>
> >> 	# Apply Common Defaults. These settings may be overwritten by
> >> machine @@ -181,14 +181,14 @@ else
> >> 		endif
> >> 	endforeach
> >>
> >> -	message('Implementer : ' + machine[0])
> >> -	foreach flag: machine[1]
> >> +	message('Implementer : ' + machine_properties[0])
> >> +	foreach flag: machine_properties[1]
> >> 		if flag.length() > 0
> >> 			dpdk_conf.set(flag[0], flag[1])
> >> 		endif
> >> 	endforeach
> >>
> >> -	foreach marg: machine[2]
> >> +	foreach marg: machine_properties[2]
> >> 		if marg[0] == impl_pn
> >> 			foreach flag: marg[1]
> >> 				if cc.has_argument(flag)
> >> --
> >> 2.17.1
> >>
> >
> >

Reviewed-by: Juraj Linkeš <juraj.linkes@pantheon.tech>

      reply	other threads:[~2020-09-18  8:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25 21:13 Dharmik Thakkar
2020-08-25 21:13 ` [dpdk-dev] [PATCH 2/2] build: find max lcore programmatically Dharmik Thakkar
2020-08-26  4:47   ` Jerin Jacob
2020-08-26  4:55     ` Dharmik Thakkar
2020-09-03  6:20       ` Juraj Linkeš
2020-09-03 22:52         ` Stephen Hemminger
2020-09-04  5:43           ` Dharmik Thakkar
2020-09-17  9:56             ` Juraj Linkeš
2020-09-18  5:47               ` Dharmik Thakkar
2020-10-13 14:31                 ` Thomas Monjalon
2020-10-13 14:58                   ` Juraj Linkeš
2020-10-13 15:14                     ` Dharmik Thakkar
2020-10-14  6:53                       ` Juraj Linkeš
2020-10-14 13:28                         ` Dharmik Thakkar
2020-09-04  5:26         ` Dharmik Thakkar
2020-09-17  9:33 ` [dpdk-dev] [PATCH 1/2] config/arm: avoid variable reuse Juraj Linkeš
2020-09-18  5:26   ` Dharmik Thakkar
2020-09-18  8:40     ` Juraj Linkeš [this message]

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=ccbe3bfe7c54452197d7220f06db38be@pantheon.tech \
    --to=juraj.linkes@pantheon.tech \
    --cc=Dharmik.Thakkar@arm.com \
    --cc=dev@dpdk.org \
    --cc=nd@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).