From patchwork Wed Jul 29 10:59:32 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: 1338253 X-Patchwork-Delegate: ian.stokes@intel.com 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.133; helo=hemlock.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 hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGrBR0PcSz9sSd for ; Wed, 29 Jul 2020 20:58:38 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5720788383; Wed, 29 Jul 2020 10:58:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ETsJeUUatAxn; Wed, 29 Jul 2020 10:58:35 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id A785E8838E; Wed, 29 Jul 2020 10:58:35 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 89041C004F; Wed, 29 Jul 2020 10:58:35 +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 3B780C004D for ; Wed, 29 Jul 2020 10:58:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 229CD87C17 for ; Wed, 29 Jul 2020 10:58:34 +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 rTGoLDPH6oeC for ; Wed, 29 Jul 2020 10:58:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by whitealder.osuosl.org (Postfix) with ESMTPS id 6B03587896 for ; Wed, 29 Jul 2020 10:58:33 +0000 (UTC) IronPort-SDR: 7/tN0zgwZbRdE+sx6YLWCAZy9QmzBqZwfrIiMbu4Rc0IFmuYXFfkywFBlIX48TGgQNkBzqQMxk XtR6FGIbDdCg== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="130951337" X-IronPort-AV: E=Sophos;i="5.75,410,1589266800"; d="scan'208";a="130951337" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2020 03:58:32 -0700 IronPort-SDR: Mux2RNA2P02Bh1DWWHVc+JvIdLAJ1XR5tvsKPOjsUelRgwbnaPyLDVYESzaGmlNuS/RLqlozAS p2CIh3Hay4rA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,410,1589266800"; d="scan'208";a="290498184" Received: from silpixa00399779.ir.intel.com (HELO silpixa00399779.ger.corp.intel.com) ([10.237.222.209]) by orsmga006.jf.intel.com with ESMTP; 29 Jul 2020 03:58:31 -0700 From: Harry van Haaren To: ovs-dev@openvswitch.org Date: Wed, 29 Jul 2020 11:59:32 +0100 Message-Id: <20200729105934.32606-1-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200727111402.14786-1-harry.van.haaren@intel.com> References: <20200727111402.14786-1-harry.van.haaren@intel.com> Cc: i.maximets@ovn.org Subject: [ovs-dev] [PATCH v2 1/3] dpif-netdev/avx512: avoid compiling avx512 code if binutils check fails 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 avoids compiling and linking of avx512 code into the vswitch_la library if the binutils check fails. This avoids compiling code into OVS that will not be executed due to binutils issue. Signed-off-by: Harry van Haaren --- v3: - Reword commit title & description --- lib/automake.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/automake.mk b/lib/automake.mk index 920c958e3..218dc7313 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -22,6 +22,7 @@ lib_libopenvswitch_la_LDFLAGS = \ $(AM_LDFLAGS) if HAVE_AVX512F +if HAVE_LD_AVX512_GOOD # Build library of avx512 code with CPU ISA CFLAGS enabled. This allows the # compiler to use the ISA features required for the ISA optimized code-paths. # Use LDFLAGS to compile only static library of this code, as it should be @@ -39,6 +40,7 @@ lib_libopenvswitchavx512_la_SOURCES = \ lib_libopenvswitchavx512_la_LDFLAGS = \ -static endif +endif # Build core vswitch libraries as before lib_libopenvswitch_la_SOURCES = \ From patchwork Wed Jul 29 10:59:33 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: 1338254 X-Patchwork-Delegate: ian.stokes@intel.com 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.133; helo=hemlock.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 hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGrBS3Kskz9sSd for ; Wed, 29 Jul 2020 20:58:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8D6E088493; Wed, 29 Jul 2020 10:58:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TQkMZXT1sShh; Wed, 29 Jul 2020 10:58:38 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id E944588442; Wed, 29 Jul 2020 10:58:37 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C8E7EC004F; Wed, 29 Jul 2020 10:58:37 +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 0462CC004D for ; Wed, 29 Jul 2020 10:58:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 0060F87C17 for ; Wed, 29 Jul 2020 10:58:35 +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 MMLFXBOYu3em for ; Wed, 29 Jul 2020 10:58:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by whitealder.osuosl.org (Postfix) with ESMTPS id 90EE187896 for ; Wed, 29 Jul 2020 10:58:34 +0000 (UTC) IronPort-SDR: EGTpLijvoqHGwivu44NsNB28BmGB4iRyCnmPLlAbWSwvE1KjdLtwMLCGPQFeUMl29JkWIa4e5C 1J0EZArrZZLA== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="130951339" X-IronPort-AV: E=Sophos;i="5.75,410,1589266800"; d="scan'208";a="130951339" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2020 03:58:34 -0700 IronPort-SDR: uYgksH1Eq5pvQZv5EWiw+MA70R0Y/9LSJqcgwNwnnWrC+EzXD0qboolcQJHQ7VDAuOM1xaBOTI pF/tnlGaxLXQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,410,1589266800"; d="scan'208";a="290498192" Received: from silpixa00399779.ir.intel.com (HELO silpixa00399779.ger.corp.intel.com) ([10.237.222.209]) by orsmga006.jf.intel.com with ESMTP; 29 Jul 2020 03:58:32 -0700 From: Harry van Haaren To: ovs-dev@openvswitch.org Date: Wed, 29 Jul 2020 11:59:33 +0100 Message-Id: <20200729105934.32606-2-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200729105934.32606-1-harry.van.haaren@intel.com> References: <20200727111402.14786-1-harry.van.haaren@intel.com> <20200729105934.32606-1-harry.van.haaren@intel.com> Cc: i.maximets@ovn.org Subject: [ovs-dev] [PATCH v2 2/3] dpif-netdev/avx512: add -fPIC flag to enable shared builds 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" In certain scenarios with OVS built with --enable-shared and DPDK enabled as shared build too, Position Independant Code is required to link the avx512.a file into the relocatable .so that it must be linked into. Signed-off-by: Harry van Haaren --- v3: - Note this patch fixes a potential build issue that is only exposed with future DPDK Meson integration, and not an issue today. Ensuring OVS 2.14 release is compatible with DPDK Meson builds will ease the future porting to meson, so is worth including now. --- lib/automake.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/automake.mk b/lib/automake.mk index 218dc7313..380a67228 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -34,6 +34,7 @@ lib_libopenvswitchavx512_la_CFLAGS = \ -mavx512bw \ -mavx512dq \ -mbmi2 \ + -fPIC \ $(AM_CFLAGS) lib_libopenvswitchavx512_la_SOURCES = \ lib/dpif-netdev-lookup-avx512-gather.c From patchwork Wed Jul 29 10:59:34 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: 1338255 X-Patchwork-Delegate: ian.stokes@intel.com 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.133; helo=hemlock.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 hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGrBV1ls1z9sSd for ; Wed, 29 Jul 2020 20:58:42 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A9AC0884D2; Wed, 29 Jul 2020 10:58:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KD2PgrDRoRdb; Wed, 29 Jul 2020 10:58:40 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 1C10A884BB; Wed, 29 Jul 2020 10:58:40 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C0B9AC004F; Wed, 29 Jul 2020 10:58:39 +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 76078C004F for ; Wed, 29 Jul 2020 10:58:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6F88387F49 for ; Wed, 29 Jul 2020 10:58:37 +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 qA2Rkjr31tZ5 for ; Wed, 29 Jul 2020 10:58:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by whitealder.osuosl.org (Postfix) with ESMTPS id A01C487C17 for ; Wed, 29 Jul 2020 10:58:35 +0000 (UTC) IronPort-SDR: O8EulWmzXWq6NwOxZrGUiXSipjKE38Mo54rrEZwwlv6akpFaFJxfOVXrNpjNS4ecKzhAWLtC/h kzbqEbD5WUPg== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="130951342" X-IronPort-AV: E=Sophos;i="5.75,410,1589266800"; d="scan'208";a="130951342" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2020 03:58:35 -0700 IronPort-SDR: dts6uowBHg8bk8J/4Q0DJeARPHFWnf6P8UAwls7+LaAHGzqFedpiFX4gkZAXswPQ2knydFCyCA 4AdzZ9lnOj/Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,410,1589266800"; d="scan'208";a="290498200" Received: from silpixa00399779.ir.intel.com (HELO silpixa00399779.ger.corp.intel.com) ([10.237.222.209]) by orsmga006.jf.intel.com with ESMTP; 29 Jul 2020 03:58:34 -0700 From: Harry van Haaren To: ovs-dev@openvswitch.org Date: Wed, 29 Jul 2020 11:59:34 +0100 Message-Id: <20200729105934.32606-3-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200729105934.32606-1-harry.van.haaren@intel.com> References: <20200727111402.14786-1-harry.van.haaren@intel.com> <20200729105934.32606-1-harry.van.haaren@intel.com> Cc: i.maximets@ovn.org Subject: [ovs-dev] [PATCH v2 3/3] configure: explicitly disable avx512 if bintuils check fails 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 explicitly disables avx512f if the binutils assembler check fails to correctly assemble its input. Without this fix, there is a possibility that users can see undefined behaviour when compiling with -march=native on a CPU which supports avx512 and with a buggy binutils version (v2.30 and 2.31), without a backported fix, if the compiler's vectorizing optimizations convert scalar code to avx512 instructions. Signed-off-by: Harry van Haaren --- Note that the compiler autovectorization with binutils bug could be present in previous releases, and was not introduced with the 2.14 dpcls avx512 optimizations. The explict adding of dpcls avx512 opts added the binutils checks to easily modify CFLAGS to fix the issue. --- m4/openvswitch.m4 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index 7c9a507e5..6fe79297e 100644 --- a/m4/openvswitch.m4 +++ b/m4/openvswitch.m4 @@ -426,8 +426,12 @@ AC_DEFUN([OVS_CHECK_BINUTILS_AVX512], CFLAGS="$CFLAGS -DHAVE_LD_AVX512_GOOD" else ovs_cv_binutils_avx512_good=no + dnl Explicitly disallow avx512f to stop compiler auto-vectorizing + dnl and causing zmm usage with buggy binutils versions. + CFLAGS="$CFLAGS -mno-avx512f" fi else + dnl non x86_64 architectures don't have avx512, so not affected ovs_cv_binutils_avx512_good=no fi]) rm $OBJFILE