From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0078.outbound.protection.outlook.com [104.47.32.78]) by dpdk.org (Postfix) with ESMTP id 1B7231AEF6 for ; Wed, 10 Jan 2018 09:21:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6sYekA+cY4jykphSLC6HBpWobst0+hoAiV/apaM/6/0=; b=XeZZl9iVpBdXTwEpDgDp7oe4vMr+FgNSqE7/dr+BqQwNO2GRdf7b6TCLLf8cJhG/bgi7fn0fUN6XZajqNLN+RBk130KLHnKreN5VVc/aFXFGk7TqhvAaMsErXG+FlKLB8iD9OpeWHg48DxoXVvboiRrBPzSJrlrUbe8l2XVAE+Q= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from Pavan-LT (111.93.218.67) by CY4PR07MB3461.namprd07.prod.outlook.com (10.171.252.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Wed, 10 Jan 2018 08:21:36 +0000 Date: Wed, 10 Jan 2018 13:51:30 +0530 From: Pavan Nikhilesh To: Bruce Richardson , bluca@debian.org, harry.van.haaren@intel.com, jerin.jacob@caviumnetworks.com, herbert.guan@arm.com Cc: dev@dpdk.org Message-ID: <20180110082129.ag5t3qihwgqioghi@Pavan-LT> References: <20171230163754.20356-1-pbhagavatula@caviumnetworks.com> <20180108170547.GA7960@bricha3-MOBL3.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180108170547.GA7960@bricha3-MOBL3.ger.corp.intel.com> User-Agent: NeoMutt/20170609 (1.8.3) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MWHPR2201CA0004.namprd22.prod.outlook.com (10.174.164.17) To CY4PR07MB3461.namprd07.prod.outlook.com (10.171.252.142) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2b6dd208-c91e-4dc8-615a-08d558032bb8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:CY4PR07MB3461; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 3:/dy78kc8y4FDXCRI4WtpNIYzHhtQ8c/w4+yPl3f0+viMY2EEv5ukCc4nOCV+iJl1WHaESHED7kQEAVZzAFiAIJnmPlAHXVjO3/WWlWcdQCk1mKKVSTMa8373FaF/Mg5EJ4MNDFmFYVDzDJNorujPdX4iEW1Wo/vZbWYTFwu8e080XbZNS+Rfndh883bD+ADenKpSzgmZDd/ucVnzr+VapQNUCpy9E7lBKtx61QjuEbQzqjfWF6UfAl49AE8HMW2d; 25:TFRn7Xb9yar889pQq9TSQ4dil3j1Sgfxs25RSrD54ahG4qesYLpa9DpPpv+HHYQqIrRLWhy3u+1llxNo0d74b4eLOqUtoSk9FHJTMHmvNMMYXzgZttIk08Ijnxnkl+MAwlCA4WZcOBml0fe97o80evFNxKdeG7D06gAmxPmpw7gYUP7amYbec8OgJQF2sqBU4YDlUh7ZZES3853KV9YuRjYTdkJQRI4opj7n+AEnSsZ1bix8m7jdnHsOrikXSkBTmn3BPQURk/r3cIo0ZdgTpIsPfxwLO2YlrLUIjsPlrZwyW8FqCpBC4qXmK+dzxKL9CrDYn1fkLIEgygJfFF0R6g==; 31:VrOjBLIp2ZfWDJqI1272EhBFrl7li9PEWgMOaqSjN47zEAdiUHnpmPsMuKUfTx+b+lbbdMtL+4GjGQiZsRBKqtb6VY630qoets3ZDAhfP0DKCHwHRwscwW7K4sdijUVVREyd7HvGkx0syHe3px/skXj1A7oCTFEj7u0A9ZPxcsTEpGAUD+bIMIftxUi28OY1ndvpA5Bi04H4lV5IqkcuRN5VjD0/ktSeJ99OSN/QE48= X-MS-TrafficTypeDiagnostic: CY4PR07MB3461: X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 20:pb2ca+E0pAbgP9cy21OL0zNmkwtjNxG+0vcMnQ16AVvF/Ygm2xetHCrnukEuUmEvQYHldJU2UPq6QBXrxQO4VFfsqlbldSyBfnxR+cObEQf7k+3SdDX7lC5fjVfbPi5EeOtKAiv3KhPCMWT4cUkyyGpG0RUpZ2+RVEFHsidfblL73R+qhnOrj/8rYDu4DC7Zs4wAyBTcDv4n4BuRal4DjOrQLlZuLQ6gVYKTPeYnu2ED5YJ+MHttLboi2psvj4sJxZCSQWp5ysi/BZKVLKGy3emNFfOYwYVfKEGv0WknbuWZEVMnmrHivBpkwODeWeiwGQ8y9rMy4UPVuegG//MExkXAuqCovPc5JGzWrWGWFWlNy9+ftR5wLFl50+arLYKIbdXhiCEabT+IBx9NkenuC1uoPJDZms7zyvGaOYhlodruLtKBKc4CRw9lIQTRS/dA6fi/94yWzl1duWX9ykEkri+61XW6RmiFbtVnIACBo/EDCwOg0KerCl8i5UR1wX2XNZzxDzEUy3fGdOD3mOKMUZ7zE4vdGWKZrzsrE89RdRLCIvtvPrbZFBRkS2BrFX15VLrd+xZ0H4cOeeOMp8VPspA8yxJ3LAeSIYWMgD9+PE0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(22074186197030)(183786458502308); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(10201501046)(3002001)(3231023)(944501075)(6041268)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:CY4PR07MB3461; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY4PR07MB3461; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 4:cNiL1yH1JiGpGyXH4xluaya4uNyQxcOLiHbOCBZRBQ2mvSi3YMt/JPE6/CWrlCQ2BKPtAtt2EPN3l2vlxebPMLxGp3QKE/AJCUQ7T5cdbZ6TMtG9CboF+NPCVSOknlVWytWNDSirOZCXBqxA53annQb1chbdQtfYacY1v/K3mru7G3WnLr8P6xaS2c1e3eeZKegnRJojDk7pdxikEW4wt1DSvsODiEdVZaOzORA8s2XMMwys0e5M8IdnCXierroPRBBU/ln77US9yC473KGFjezhd7NcNvSEr58fGGSuw8nToo5i3WEvveFg8gtuPGX+AneYkDw9kg9Y0KtcxI9Lp9zNVUCTISxXZdReVF3Z//3dSrzVQCr8CSdmcQal+KM9 X-Forefront-PRVS: 0548586081 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39380400002)(376002)(366004)(346002)(39860400002)(24454002)(199004)(189003)(305945005)(3846002)(2906002)(52116002)(25786009)(6496006)(58126008)(33896004)(4326008)(105586002)(966005)(66066001)(1076002)(97736004)(55016002)(76176011)(386003)(59450400001)(316002)(6116002)(5009440100003)(7736002)(16586007)(33716001)(23726003)(106356001)(6246003)(72206003)(5660300001)(53936002)(53376002)(6666003)(81156014)(478600001)(2950100002)(42882006)(8676002)(50466002)(229853002)(9686003)(68736007)(16526018)(83506002)(6306002)(8936002)(81166006)(47776003)(107986001)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3461; H:Pavan-LT; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR07MB3461; 23:Bg1k6/g/GPczZqMIhfTZjU00eaegqbhaE6qCTUaz2?= =?us-ascii?Q?8mdxNVIHFgsrbO2XKMIkac4501d8nxdShlPtVhV5Rt+dRez8fzTNSkmPjJip?= =?us-ascii?Q?/iFOupB8DAvfpDQ1zo/Jl5MH094B5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czbqFRiQExtFDICQRVDlL70=; 7:XKsUDqG5WmEXwnpcTCy+GHulE0M8bKJZwKuvxSbcG6IVjaO8aT+BkoxhrboTkVpmvu7xXe4zjtXLOWRHKSzQzMBrlHpweyUdiofHKIUXDqU6baUb5slphQhk1hhLvmKLZAGshcS5qwx+ysV+eP74y0xUMnmtMym834MEDZ7H48IpgxCwsBaeY6poBzUm7uXRT/RISOf4/UHbqKh2mrzq8IMkWnlaqcsyqLADMFm5lpltKp/Ng6dxOJ2RaBYe5pSs SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 08:21:36.3036 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2b6dd208-c91e-4dc8-615a-08d558032bb8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3461 Subject: Re: [dpdk-dev] [PATCH] build: add support for detecting march on ARM X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 08:21:41 -0000 On Mon, Jan 08, 2018 at 05:05:47PM +0000, Bruce Richardson wrote: > On Sat, Dec 30, 2017 at 10:07:54PM +0530, Pavan Nikhilesh wrote: > > Added support for detecting march and mcpu by reading midr_el1 register. > > The implementer, primary part number values read can be used to figure > > out the underlying arm cpu. > > > > Signed-off-by: Pavan Nikhilesh > > --- > > > > The current method used for reading MIDR_EL1 form userspace might not be > > reliable and can be easily modified by updating config/arm/machine.py. > > > > More info on midr_el1 can be found at > > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0500g/BABFEABI.html > > > > This patch depends on http://dpdk.org/dev/patchwork/patch/32410/ > > > > I had intended that patch to just be a prototype to start adding ARM > support - have you considered taking that and rolling in these changes > into that as a part of a set? Agreed, I will merge the patches as a patchset in v2. > > > config/arm/machine.py | 18 ++++++++++++++++++ > > config/arm/meson.build | 20 ++++++++++++++++++++ > > config/meson.build | 3 ++- > > drivers/meson.build | 2 +- > > examples/meson.build | 2 +- > > lib/meson.build | 2 +- > > meson.build | 2 +- > > 7 files changed, 44 insertions(+), 5 deletions(-) > > create mode 100755 config/arm/machine.py > > > > diff --git a/config/arm/machine.py b/config/arm/machine.py > > new file mode 100755 > > index 000000000..3c6e7b6a7 > > --- /dev/null > > +++ b/config/arm/machine.py > > @@ -0,0 +1,18 @@ > > +#!/usr/bin/python > > +import pprint > > +pp = pprint > > + > > +ident = [] > > +fname = '/sys/devices/system/cpu/cpu0/regs/identification/midr_el1' > > +with open(fname) as f: > > + content = f.read() > > + > > +midr_el1 = (int(content.rstrip('\n'), 16)) > > + > > +ident.append(hex((midr_el1 >> 24) & 0xFF)) # Implementer > > +ident.append(hex((midr_el1 >> 20) & 0xF)) # Variant > > +ident.append(hex((midr_el1 >> 16) & 0XF)) # Architecture > > +ident.append(hex((midr_el1 >> 4) & 0xFFF)) # Primary Part number > > +ident.append(hex(midr_el1 & 0xF)) # Revision > > + > > +print(' '.join(ident)) > > diff --git a/config/arm/meson.build b/config/arm/meson.build > > index 250958415..f6ae69c21 100644 > > --- a/config/arm/meson.build > > +++ b/config/arm/meson.build > > @@ -41,3 +41,23 @@ else > > endif > > dpdk_conf.set('RTE_CACHE_LINE_SIZE', 128) > > dpdk_conf.set('RTE_FORCE_INTRINSICS', 1) > > + > > +detect_vendor = find_program(join_paths(meson.current_source_dir(), > > + 'machine.py')) > > +cmd = run_command(detect_vendor.path()) > > +if cmd.returncode() != 0 > > + message('Unable to read midr_el1') > > +else > > + cmd_output = cmd.stdout().strip().split(' ') > > + message('midr_el1 output: \n' + 'Implementor ' + cmd_output[0] + > > + ' Variant ' + cmd_output[1] + ' Architecture ' + > > + cmd_output[2] + ' Primary Part number ' + cmd_output[3] > > + + ' Revision ' + cmd_output[4]) > > + if cmd_output[0] == '0x43' > > + message('Implementor : Cavium') > > + dpdk_conf.set('RTE_MACHINE', 'thunderx') > > + machine_arg = [] > > + machine_arg += '-march=' + 'armv8-a+crc+crypto' > > + machine_arg += '-mcpu=' + 'thunderx' > > + endif > > +endif > > Should the call to the script and return code not be dependent on the > current value of machine i.e. only if it's "native"? If the user has > specified a "machine" type as part of the meson configuration > parameters, you should not override it. Similarly in the cross-build > case, the machine type is taken from the cross-build file itself. > Yes, only in native build scenario the script and result should be used I will modify that in v2. > > diff --git a/config/meson.build b/config/meson.build > > index 86e978fb1..fe8104676 100644 > > --- a/config/meson.build > > +++ b/config/meson.build > > @@ -8,7 +8,8 @@ else > > machine = get_option('machine') > > endif > > dpdk_conf.set('RTE_MACHINE', machine) > > -machine_arg = '-march=' + machine > > +machine_arg = [] > > +machine_arg += '-march=' + machine > > > > I was confused initially as to why this change, but now I realise it's > due to the fact that for the thunderx build you need both an -march and > an -mcpu flag. I think it might be better to make this change as a > separate patch and rename the variable from "machine_arg" to > "machine_args" to make it clearer it's an array. I was thinking of having a dpdk_machine_args in base meson.build parallel to dpdk_extra_ldflags and friends. > Alternatively, we can have separate variables for march flag and mcpu > flag. [Does cpu-type need to be a configuration parameter for ARM > platforms, in the non-cross-build case?] > Initially while experimenting with meson I did try out splitting the march and mcpu flags but that resulted in extra overhead i.e. filtering out mcpu when it's unused in case of x86 builds. In case of x86 the mcpu flag is deprecated where as in arm it provides extra hint to the compiler to do silicon specific optimizations as the implementation of core is vendor specific. In case of gcc7[1] the mcpu can be furthur tuned to be core specific by basing it around the primary part number (thunderxt81(0xA2), thunderxt83(0xA3), thunderxt88(0xA1)) detected via reading midr_el1. [1] https://gcc.gnu.org/gcc-7/changes.html > /Bruce > Thanks, Pavan.