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 2A7FDA0A0C; Thu, 22 Jul 2021 22:20:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AADFA4014D; Thu, 22 Jul 2021 22:20:48 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id B65D640040 for ; Thu, 22 Jul 2021 22:20:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626985245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yiixvZZxbrIBHT8vuUYrGZIbI63Az25agB5fT+TZXmg=; b=FboUtKiDWAa2uByTEA8Y+FdU5foQg1lBO5YDF3a4+eDspRtZ8OsR25zTqoz2a3FxpWp+gY PyLV1qjx1GNE8kSo+9g0hHB4SlIApQm0XHYIH317j7d8mk6UHMkHcY4e3LaOOz482RrRd/ i9e7V4e4JxINbyPit7sXWkIzJLWku3M= Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com [209.85.217.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-545-2F0WqSKgOPGHaAxrcwAKtg-1; Thu, 22 Jul 2021 16:20:44 -0400 X-MC-Unique: 2F0WqSKgOPGHaAxrcwAKtg-1 Received: by mail-vs1-f70.google.com with SMTP id c18-20020a0561023a52b029029965ab3623so1801708vsu.1 for ; Thu, 22 Jul 2021 13:20:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yiixvZZxbrIBHT8vuUYrGZIbI63Az25agB5fT+TZXmg=; b=hMDD8L8yT3/df3T+mPP5UHNRu3iNlTwe5X62pwkKV5tSIi1sOV6pfnS8G0mLeftaJp 4SuIUxWd6vTEQL94PxYFxyM9jICQdQu2ItbmwqhhjLn/OT7SzhllFpD4V+YAFBecIPDL 5OJEI9Glc7xKYTBXmvIyv7HdFxU5hxmo1wEWjX/ph/VSiU432MgMJ5Vj+hgustaTdQ9S RnQSsZkGckllUUSsdhfJudDSYrVPJyJRmJPjEXYTpc8pvWZNFN6RpWbIzLRNWZXD1bb+ 5rZ9H47lpxB6dT2V4uw1RWelAKbgkbOgX5Sri4+txHXJBXfCgks7s2eWcuqWu8XGHI6t ldCA== X-Gm-Message-State: AOAM531io46P6WkT88MFgJ5HEoHC9MSQEYWsEpknRUapRImyvjp0c75n XIw7A1KwQw11jjdAauokcU1m8hXypwbeZZNaLUo3oRu3eObdZZBe32HeM63lOMxB9rinnnMFpiC OsfSFKDmFaw9+P5VKWrs= X-Received: by 2002:a67:f78a:: with SMTP id j10mr1985112vso.10.1626985243746; Thu, 22 Jul 2021 13:20:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTRszwqJvPurPEfhdqRXyHo82qCBlgDq6y4sO4qXuW2qcmWlX4X9e2eA9as1rIjxi+gXHt8TAVHK7URXQqItE= X-Received: by 2002:a67:f78a:: with SMTP id j10mr1985095vso.10.1626985243547; Thu, 22 Jul 2021 13:20:43 -0700 (PDT) MIME-Version: 1.0 References: <20210721211308.16644-1-thinhtr@linux.vnet.ibm.com> In-Reply-To: <20210721211308.16644-1-thinhtr@linux.vnet.ibm.com> From: David Marchand Date: Thu, 22 Jul 2021 22:20:32 +0200 Message-ID: To: Thinh Tran , David Christensen Cc: dev , Bruce Richardson Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" 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" 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 > -- David Marchand