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