From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yskoh@mellanox.com>
Received: from EUR03-VE1-obe.outbound.protection.outlook.com
 (mail-eopbgr50060.outbound.protection.outlook.com [40.107.5.60])
 by dpdk.org (Postfix) with ESMTP id AA2D05F62;
 Fri,  2 Nov 2018 21:59:40 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=CB/qrevjuzSLuevKm1H0kh0WrYJSPyCUpOAIuKDJliQ=;
 b=iJwThykpkEp9xRifQZSzkz8gerIFRf8/1c4K7E8QsP+skt4hYQ92R7WQyfBKgNTM2rWeUfFTnjaLTKVZxW62ev+HPaE1VxnilPNZXv6C9OYf/Ce3U4wqpK2jIGbyaRc0pOj+4th38+ab9+dmm0F2bY3maV/COAPmv5kRs4qiIKc=
Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by
 DB3PR0502MB3946.eurprd05.prod.outlook.com (52.134.71.23) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.1294.26; Fri, 2 Nov 2018 20:59:38 +0000
Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com
 ([fe80::f8a1:fcab:94f0:97cc]) by DB3PR0502MB3980.eurprd05.prod.outlook.com
 ([fe80::f8a1:fcab:94f0:97cc%4]) with mapi id 15.20.1273.030; Fri, 2 Nov 2018
 20:59:38 +0000
From: Yongseok Koh <yskoh@mellanox.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
CC: Thomas Monjalon <thomas@monjalon.net>, "bruce.richardson@intel.com"
 <bruce.richardson@intel.com>, "dev@dpdk.org" <dev@dpdk.org>, Shahaf Shuler
 <shahafs@mellanox.com>, "stable@dpdk.org" <stable@dpdk.org>, Konstantin
 Ananyev <konstantin.ananyev@intel.com>, Anatoly Burakov
 <anatoly.burakov@intel.com>
Thread-Topic: [dpdk-stable] [PATCH] build: disable compiler AVX512F support
Thread-Index: AQHUaxajIqJF1GRaIEuSbF5cO+4UK6U8fNqAgAASW4CAAHh/gA==
Date: Fri, 2 Nov 2018 20:59:37 +0000
Message-ID: <20181102205926.GA15737@mtidpdk.mti.labs.mlnx>
References: <20181023212318.43082-1-yskoh@mellanox.com>
 <df9a31b9-435a-faf0-5693-93589441ccfa@intel.com>
 <3a34ea82-fbdf-2ebd-c6d9-9713bfadefb8@intel.com>
In-Reply-To: <3a34ea82-fbdf-2ebd-c6d9-9713bfadefb8@intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-clientproxiedby: BYAPR05CA0096.namprd05.prod.outlook.com
 (2603:10b6:a03:e0::37) To DB3PR0502MB3980.eurprd05.prod.outlook.com
 (2603:10a6:8:10::27)
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=yskoh@mellanox.com; 
x-ms-exchange-messagesentrepresentingtype: 1
x-originating-ip: [209.116.155.178]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3946;
 6:6zJcTE1e59JaSLlHkFhMYztF7agp+p6GzJUfrxvZi4I8SvR9MqC847XweSyLwsEG9fLZXdikgD5hBTPYRTtrtDbhBYDsDqiMX4AfmZ8J+UmJ27lcj0zd1NgWKfXR4H15Q88VStbCkLBXvKiovP4JzvzNuYvCqsFbAA9D6a5/krBgVY6LJaAbOIJTPuGzhu09Le1ix3rIGaeE912HkuNHK10whNoocaQjP9+d8nBbmAi0cLIg/cpax45svgeI15YrDz8HbG2WhMIPQMlNIUDvqyQnTXTI+ePyldrTRrqPr3sjdA3rpj9kIunl7vNByAdHDcmbHvpFQoUGYqgSOaWQ9IrVFJc7NcLIMRR+AvppX0gZ+8/nOedIPs8aovQPiBx6rq418aFA+oXbr8LzP9bOJJF0cEkNJxh7cjZ2iDvs++SDjgCgaw5zKNcQDxXER4fb5hk9pSQ/1cYK+6fShALv+w==;
 5:tNiCFzQo92oe3+UksAMQSPr1WWdDtjkYkQBqpA3l1LsrDJ/f7ZA0A52hVXw7FVwLhRAqJPKZ9uWmpq+rzdAxJYDzfyKhStX6LU3/ui4D4aTfgZhKlQg0vKwaY4kcrUmpNV+lAe3Lcnk19fJE79lCWGuXRrYkE/VeHW6ahS/TXHs=;
 7:5HcPZzBZfgaOWjp2eSOi3Y0mrrP4tkHIOgztgfwO77vtyFNk445G4fOXT+jMROUETiev+aVWA5Eggag8FHcBWz6jMxH6ic9poX7fEAcJ+ckJ2EVRiiP+/o49UE43C1CyqbVF+Y6BY+OmYyUt2W+wvQ==
x-ms-office365-filtering-correlation-id: 7c73bf17-f4d9-4cc7-2118-08d64106199e
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);
 SRVR:DB3PR0502MB3946; 
x-ms-traffictypediagnostic: DB3PR0502MB3946:
x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr
x-microsoft-antispam-prvs: <DB3PR0502MB3946DD635F8491A54CE1E3FAC3CF0@DB3PR0502MB3946.eurprd05.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:;
x-ms-exchange-senderadcheck: 1
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0;
 RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231382)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201708071742011)(7699051)(76991095);
 SRVR:DB3PR0502MB3946; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3946; 
x-forefront-prvs: 08444C7C87
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(136003)(396003)(39860400002)(376002)(366004)(346002)(199004)(189003)(6246003)(1076002)(2900100001)(3846002)(6116002)(4326008)(14454004)(6916009)(7736002)(305945005)(14444005)(446003)(486006)(11346002)(5660300001)(575784001)(186003)(478600001)(86362001)(256004)(476003)(2906002)(26005)(105586002)(106356001)(6506007)(386003)(102836004)(33896004)(81166006)(33656002)(68736007)(6436002)(97736004)(229853002)(99286004)(25786009)(71200400001)(71190400001)(66066001)(53936002)(8936002)(53546011)(76176011)(81156014)(52116002)(6486002)(9686003)(6512007)(8676002)(316002)(54906003);
 DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3946;
 H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; A:1; MX:1; 
received-spf: None (protection.outlook.com: mellanox.com does not designate
 permitted sender hosts)
x-microsoft-antispam-message-info: we5JwYFrFP0pqytwJsWra+Si20I+F9NP5/h7JnetWUSq/lmxWijkizOBcX24idPNnn1Poavp8G3EOkWQZpfWP6uyQwb7Gs/t1cQBQ5JsCndg/GxVOFpAflo2LJlmbqLzYF9KjVoG1ySJjvOtidwK+C3+dBOZhKuUYLCksTYtDTvDzDJz3Jg82LsrNLt7HuYnnNvaGsDY0q1chsN+4g/w2qsonUk2PIVye/58GJN7x2TPPZ2GVcoxs0agQt8yzqJiWlLhUX80Or4QW9Gj7VL+bHcetw2YLVnzXdyiuEQqh6x4f+pe3PnGeD75g5S+6pgrh8tA303qA8DX0+2Ooyy0eDrOlGAwZuqBKBoTlAN3nTA=
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: text/plain; charset="us-ascii"
Content-ID: <DB5FE88321A7894AA4960AE4EBF1BB2E@eurprd05.prod.outlook.com>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: Mellanox.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 7c73bf17-f4d9-4cc7-2118-08d64106199e
X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2018 20:59:37.9499 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3946
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] build: disable compiler
	AVX512F support
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Nov 2018 20:59:40 -0000

On Fri, Nov 02, 2018 at 01:48:11PM +0000, Ferruh Yigit wrote:
> On 11/2/2018 12:42 PM, Ferruh Yigit wrote:
> > On 10/23/2018 10:23 PM, Yongseok Koh wrote:
> >> This is a workaround to prevent a crash, which might be caused by
> >> optimization of newer gcc (7.3.0) on Intel Skylake.
> >>
> >> Bugzilla ID: 97
> >=20
> > After checking the defect description again, this is the issue observed=
 in
> > rte_memcpy() implementation for AVX2, compiler uses AVX512F instruction=
s while
> > compiling it which causes the failure, so this may be a compiler defect=
 but we
> > don't know the root cause yet.
>=20
> Is the issue only with gcc, and only with specific version of gcc?
> If so can we reduce the disabling avx512 only to that gcc version?
>=20
> >=20
> > I think best solution is to find the root cause and fix either avx2
> > implementation or compiler, but this seems won't be soon, at least for =
rc2.
> >=20
> > What this patch does is to prevent compiler to use avx512f instruction =
when
> > "CONFIG_RTE_ENABLE_AVX512=3Dn".
> >=20
> > Concern is this will affect all DPDK generated code for x86, but since
> > rte_memcpy() in header file there is no way to disable using avx512f
> > instructions locally for rte_memcpy().
> > I can't think of any other solution for now, so OK to go with this patc=
h for
> > now. Please find below comment.
> >=20
> >>
> >> Cc: stable@dpdk.org
> >>
> >> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> >> ---
> >>  config/x86/meson.build | 5 +++++
> >>  mk/rte.cpuflags.mk     | 5 +++++
> >>  2 files changed, 10 insertions(+)
> >>
> >> diff --git a/config/x86/meson.build b/config/x86/meson.build
> >> index 33efb5e547..e10ba872ac 100644
> >> --- a/config/x86/meson.build
> >> +++ b/config/x86/meson.build
> >> @@ -47,6 +47,11 @@ endif
> >>  if cc.get_define('__AVX512F__', args: march_opt) !=3D ''
> >>  	dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX512F', 1)
> >>  	compile_time_cpuflags +=3D ['RTE_CPUFLAG_AVX512F']
> >> +else
> >> +# disable compiler's AVX512F support as a workaround for Bug 97
> >> +	if cc.has_argument('-mavx512f')
> >> +		machine_args +=3D '-mno-avx512f'
> >> +	endif
> >>  endif
> >> =20
> >>  dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)
> >> diff --git a/mk/rte.cpuflags.mk b/mk/rte.cpuflags.mk
> >> index 43ed84155b..8fdb0cc2c3 100644
> >> --- a/mk/rte.cpuflags.mk
> >> +++ b/mk/rte.cpuflags.mk
> >> @@ -68,6 +68,11 @@ endif
> >>  ifneq ($(filter $(AUTO_CPUFLAGS),__AVX512F__),)
> >>  ifeq ($(CONFIG_RTE_ENABLE_AVX512),y)
> >>  CPUFLAGS +=3D AVX512F
> >> +else
> >> +# disable compiler's AVX512F support as a workaround for Bug 97
> >> +ifeq ($(shell $(CC) --target-help | grep -q mavx512f && echo 1), 1)
> >=20
> > This will not work for ICC, and do we need this? AUTO_CPUFLAGS already =
should
> > have what you are looking for, so I think this check can be removed.

This is different from AUTO_CPUFLAGS as it tries to check compiler flag sup=
port.
And per your question, I have only tested it with gcc, so I agree on applyi=
ng it
only for gcc. Will submit v2. But, I don't think we need to check gcc versi=
on as
there's no fix reported yet in a newer gcc version and this patch would hav=
e
very limited impact. avx512f support is quite new and kinda experimental so
far. Dropping a bit of performance would be better than crash. :-)

Thanks for your review,
Yongseok

> >> +MACHINE_CFLAGS +=3D -mno-avx512f
> >> +endif
> >>  endif
> >>  endif
> >> =20
> >>
> >=20
>=20