From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CDDD9A0C50; Fri, 23 Jul 2021 18:50:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8DB9B4067B; Fri, 23 Jul 2021 18:50:28 +0200 (CEST) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by mails.dpdk.org (Postfix) with ESMTP id 69A3A4014D for ; Fri, 23 Jul 2021 18:50:26 +0200 (CEST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16NGYRRW074902; Fri, 23 Jul 2021 12:50:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=3IlL5lPbn8ilFBz+uDynipTreFtEngpZ+N1Ct+xRfqU=; b=pl91aUitIDAS0FP6gLSbUXFJGfIPtB/5G2pqL5Y9EAM19HkTAoS8jHI/nN2Tj8aKhj18 uZwxmUjPbS09PwSZN7h2ehnuO36sFV/rdADriqMkGFizUOtYC5G6m/rTwz/OrFM2iNCC F0BvSj5atxCiPJJf03CC34ANX3ojwwJyH/5wGgFI7FJMyfVBXu1DEkc5XuKwb0oKNti/ k6/BdKwI1Q/kYVn/D+IS7osjux6PuvQGd7+mGGgS1+rRFYn2SGo++F0eTZEn/s2Hyuzj eLC9I0I/IuOC3RXKhVnBOtZwiR9B6Y9e+ElC6uRqV1O+KAZwRLeJD+attYVhIgADr9Bw 5A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3a019h8j9t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Jul 2021 12:50:25 -0400 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 16NGa2nk079340; Fri, 23 Jul 2021 12:50:25 -0400 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0b-001b2d01.pphosted.com with ESMTP id 3a019h8j9j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Jul 2021 12:50:25 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16NGgq06018122; Fri, 23 Jul 2021 16:50:24 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma05wdc.us.ibm.com with ESMTP id 39upuejch4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Jul 2021 16:50:24 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16NGoNGd28901736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Jul 2021 16:50:23 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A768EC605D; Fri, 23 Jul 2021 16:50:23 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 174D2C6065; Fri, 23 Jul 2021 16:50:22 +0000 (GMT) Received: from [9.160.172.231] (unknown [9.160.172.231]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 23 Jul 2021 16:50:22 +0000 (GMT) To: David Marchand , David Christensen Cc: dev , Bruce Richardson References: <20210721211308.16644-1-thinhtr@linux.vnet.ibm.com> From: Thinh Tran Message-ID: Date: Fri, 23 Jul 2021 11:50:22 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: r3GvSGEY8Gak-cpQziTOsI4mo4DqN7Ug X-Proofpoint-GUID: -cmzrWMhfhPRtmREIiJQpXkbWvbZp90z X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-23_09:2021-07-23, 2021-07-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 impostorscore=0 mlxscore=0 clxscore=1011 mlxlogscore=999 adultscore=0 bulkscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107230100 Subject: Re: [dpdk-dev] [PATCH] build: enable to build on power10 or newer for ppc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Thanks David for reviewing. I'll fix the patch with cross compilation in mind. Regards, Thinh Tran On 7/22/2021 3:20 PM, David Marchand wrote: > On Wed, Jul 21, 2021 at 11:14 PM Thinh Tran wrote: >> >> A older version of complier would fail to generate code for new Power > > compiler > >> CPUs when it uses "-mcpu=native" argument. >> This patch will test if the compiler supports the current Power CPU type >> then proceeds with "-mcpu=native" argument, else it tries with older type. >> Limit to two older CPU type levels. > > Such a change seems a bit late for 21.08, and is broken (see below). > In any case, I would need a review from ppc maintainer. > > >> >> Signed-off-by: Thinh Tran >> --- >> config/ppc/check_cpu_platform.sh | 2 ++ >> config/ppc/meson.build | 40 +++++++++++++++++++++++++------- >> 2 files changed, 34 insertions(+), 8 deletions(-) >> create mode 100644 config/ppc/check_cpu_platform.sh >> >> diff --git a/config/ppc/check_cpu_platform.sh b/config/ppc/check_cpu_platform.sh >> new file mode 100644 >> index 0000000000..cdea24561b >> --- /dev/null >> +++ b/config/ppc/check_cpu_platform.sh >> @@ -0,0 +1,2 @@ >> +#! /bin/sh >> +LD_SHOW_AUXV=1 /bin/true | awk '/AT_PLATFORM/ {print $2}'|sed 's/\power//' >> diff --git a/config/ppc/meson.build b/config/ppc/meson.build >> index adf49e1f42..05aa860cfd 100644 >> --- a/config/ppc/meson.build >> +++ b/config/ppc/meson.build >> @@ -7,16 +7,40 @@ endif >> dpdk_conf.set('RTE_ARCH', 'ppc_64') >> dpdk_conf.set('RTE_ARCH_PPC_64', 1) >> >> -# RHEL 7.x uses gcc 4.8.X which doesn't generate code for Power 9 CPUs, >> -# though it will detect a Power 9 CPU when the "-mcpu=native" argument >> -# is used, resulting in a build failure. >> -power9_supported = cc.has_argument('-mcpu=power9') >> -if not power9_supported >> - cpu_instruction_set = 'power8' >> - machine_args = ['-mcpu=power8', '-mtune=power8'] >> - dpdk_conf.set('RTE_MACHINE','power8') >> +# Checking compiler for supporting Power CPU platform >> +# For newer Power(N) System that current gcc may not supoort it yet, >> +# it falls back and try N-1 and N-2 > > double space unneeded. > Plus, wording reads odd to me. > >> +check_cpu = find_program(join_paths(meson.current_source_dir(), >> + 'check_cpu_platform.sh')) > > Why do you need a separate script? > The value it returns is constant on a given system. > > > Looking at the script itself, this breaks cross compilation. > > Compiler for C supports arguments -Wno-missing-field-initializers > -Wmissing-field-initializers: YES (cached) > Program /home/dmarchan/dpdk/config/ppc/check_cpu_platform.sh found: YES > > ../../dpdk/config/ppc/meson.build:18:0: ERROR: String 'x86_64' cannot > be converted to int > > A full log can be found at > /home/dmarchan/builds/build-ppc64le-power8/meson-logs/meson-log.txt > FAILED: build.ninja > /usr/bin/meson --internal regenerate /home/dmarchan/dpdk > /home/dmarchan/builds/build-ppc64le-power8 --backend ninja > ninja: error: rebuilding 'build.ninja': subcommand failed > > > >> + >> +target_cpu = run_command(check_cpu.path()).stdout().strip() >> + >> +cpu_int = target_cpu.to_int() >> +cpu_flag = '-mcpu=power@0@' >> +tune_flag = '-mtune=power@0@' >> +machine_type = 'power@0@' >> +debug = 'configure the compiler to build DPDK for POWER@0@ platform' >> + >> +if cc.has_argument(cpu_flag.format(cpu_int)) >> + >> + # target system cpu is supported by the compiler, use '-mcpu=native' >> + message(debug.format(target_cpu+'_native')) >> + machine_args = ['-mcpu=native'] >> + dpdk_conf.set('RTE_MACHINE',machine_type.format(cpu_int)) >> +elif cc.has_argument(cpu_flag.format(cpu_int-1)) >> + message(debug.format(cpu_int-1)) >> + machine_args = [cpu_flag.format(cpu_int-1),tune_flag.format(cpu_int-1)] >> + dpdk_conf.set('RTE_MACHINE',machine_type.format(cpu_int-1)) >> +elif cc.has_argument(cpu_flag.format(cpu_int-2)) >> + message(debug.format(cpu_int-2)) >> + machine_args = [cpu_flag.format(cpu_int-2),tune_flag.format(cpu_int-2)] >> + dpdk_conf.set('RTE_MACHINE',machine_type.format(cpu_int-2)) >> +else >> + error('The compiler does not support POWER@0@ platform' .format(cpu_int)) >> endif >> >> + >> + > > One line is enough. > > > >> # Certain POWER9 systems can scale as high as 1536 LCORES, but setting such a >> # high value can waste memory, cause timeouts in time limited autotests, and is >> # unlikely to be used in many production situations. Similarly, keeping the >> -- >> 2.17.1 >> > >