From patchwork Thu Jun 18 16:53:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Van Haaren, Harry" X-Patchwork-Id: 1312324 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49np1Y5VMCz9sRR for ; Fri, 19 Jun 2020 02:54:09 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 215B987D13; Thu, 18 Jun 2020 16:54:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 71u6PlBc-Snj; Thu, 18 Jun 2020 16:54:06 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6615387C64; Thu, 18 Jun 2020 16:54:03 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 427A8C08A8; Thu, 18 Jun 2020 16:54:03 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4DCF8C016E for ; Thu, 18 Jun 2020 16:54:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 32FC688B04 for ; Thu, 18 Jun 2020 16:54:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7UN6ogdqjOyP for ; Thu, 18 Jun 2020 16:53:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by whitealder.osuosl.org (Postfix) with ESMTPS id 33C1288B06 for ; Thu, 18 Jun 2020 16:53:54 +0000 (UTC) IronPort-SDR: v6Yo6YUYfukRK4zle0DuuV6yr3Ecie+CJrOqrGx2JyHCtvBwYXIXwoYhGbWFA6pMtexGe1MY6u 5RZoOhgAtvpA== X-IronPort-AV: E=McAfee;i="6000,8403,9656"; a="141724119" X-IronPort-AV: E=Sophos;i="5.75,251,1589266800"; d="scan'208";a="141724119" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2020 09:53:54 -0700 IronPort-SDR: Ft+0wgV9vqO2uEACN7XtdNEf0/FAycvJbLV4Vck7Qp/LFiuzOkyTWsZ/WSnvs5E6x7gRFK0SYx szS2f1MiOKhQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,251,1589266800"; d="scan'208";a="299760762" Received: from silpixa00399779.ir.intel.com (HELO silpixa00399779.ger.corp.intel.com) ([10.237.222.209]) by fmsmga004.fm.intel.com with ESMTP; 18 Jun 2020 09:53:52 -0700 From: Harry van Haaren To: ovs-dev@openvswitch.org Date: Thu, 18 Jun 2020 17:53:53 +0100 Message-Id: <20200618165354.87787-7-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200618165354.87787-1-harry.van.haaren@intel.com> References: <20200610104839.54608-1-harry.van.haaren@intel.com> <20200618165354.87787-1-harry.van.haaren@intel.com> Cc: i.maximets@ovn.org Subject: [ovs-dev] [PATCH v4 6/7] configure/m4: binutils avx512 configure time check. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This commit checks at configure time if the assembling in use has a known bug in assembling AVX512 code. If this bug is present, all AVX512 code is disabled. Checking the version string of the binutils or assembler is not a good method to detect the issue, as backported fixes would not be reflected. The method used here is also proposed for DPDK: http://patches.dpdk.org/patch/71723/ Signed-off-by: Harry van Haaren --- v4: - This patch is left seperate to ease reviews, as this is a logically seperate check. In v5 this code change will be merged with the commit that introduces the AVX512 code itself to ensure build consistency. --- configure.ac | 1 + lib/dpif-netdev-lookup.c | 2 ++ m4/openvswitch.m4 | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac index 1367c868b..76d6de4e8 100644 --- a/configure.ac +++ b/configure.ac @@ -184,6 +184,7 @@ OVS_ENABLE_WERROR OVS_ENABLE_SPARSE OVS_CTAGS_IDENTIFIERS OVS_CHECK_DPCLS_AUTOVALIDATOR +OVS_CHECK_BINUTILS_AVX512 AC_ARG_VAR(KARCH, [Kernel Architecture String]) AC_SUBST(KARCH) diff --git a/lib/dpif-netdev-lookup.c b/lib/dpif-netdev-lookup.c index 2c740399b..2a77814f2 100644 --- a/lib/dpif-netdev-lookup.c +++ b/lib/dpif-netdev-lookup.c @@ -45,6 +45,7 @@ static struct dpcls_subtable_lookup_info_t subtable_lookups[] = { #ifdef __x86_64__ #if HAVE_AVX512F +#if HAVE_LD_AVX512_GOOD #ifdef __SSE4_2__ /* Only available on x86_64 bit builds with SSE 4.2 used for OVS core. */ { .prio = 0, @@ -59,6 +60,7 @@ static struct dpcls_subtable_lookup_info_t subtable_lookups[] = { #endif #endif #endif +#endif }; int32_t diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index add3aabcc..442cf4cb0 100644 --- a/m4/openvswitch.m4 +++ b/m4/openvswitch.m4 @@ -404,6 +404,30 @@ AC_DEFUN([OVS_CHECK_SPHINX], AC_ARG_VAR([SPHINXBUILD]) AM_CONDITIONAL([HAVE_SPHINX], [test "$SPHINXBUILD" != none])]) +dnl Checks for binutils/assembler known issue with AVX512. +dnl Due to backports, we probe assembling a reproducer instaed of checking +dnl binutils version string. More details, including ASM dumps and debug here: +dnl GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028 +dnl The checking of binutils funcationality instead of LD version is similar +dnl to as how DPDK proposes to solve this issue: +dnl http://patches.dpdk.org/patch/71723/ +AC_DEFUN([OVS_CHECK_BINUTILS_AVX512], + [AC_CACHE_CHECK( + [binutils avx512 assembler checks passing], + [ovs_cv_binutils_avx512_good], + [dnl Assemble a short snippet to test for issue in "build-aux" dir: + OBJFILE=build-aux/binutils_avx512_check.o + GATHER_PARAMS='0x8(,%ymm1,1),%ymm0{%k2}' + echo "vpgatherqq $GATHER_PARAMS" | as --64 -o $OBJFILE - + if (objdump -d --no-show-raw-insn $OBJFILE | grep -q $GATHER_PARAMS) >/dev/null 2>&1; then + ovs_cv_binutils_avx512_good=yes + CFLAGS="$CFLAGS -DHAVE_LD_AVX512_GOOD" + else + ovs_cv_binutils_avx512_good=no + fi]) + AM_CONDITIONAL([HAVE_LD_AVX512_GOOD], + [test "$ovs_cv_binutils_avx512_good" = yes])]) + dnl Checks for dot. AC_DEFUN([OVS_CHECK_DOT], [AC_CACHE_CHECK(