From patchwork Fri Sep 3 13:53:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Amber X-Patchwork-Id: 1524347 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=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H1KYX2pTdz9sPf for ; Sat, 4 Sep 2021 00:14:39 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id C8E62407F0; Fri, 3 Sep 2021 14:14:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XVvUzdnq1hlX; Fri, 3 Sep 2021 14:14:35 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 7195540123; Fri, 3 Sep 2021 14:14:34 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4DE13C0010; Fri, 3 Sep 2021 14:14:34 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0F274C000E for ; Fri, 3 Sep 2021 14:14:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 064FE80DF7 for ; Fri, 3 Sep 2021 14:14:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ImIr8H9o7bKP for ; Fri, 3 Sep 2021 14:14:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by smtp1.osuosl.org (Postfix) with ESMTPS id 7E0D780CC4 for ; Fri, 3 Sep 2021 14:14:29 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10096"; a="280445066" X-IronPort-AV: E=Sophos;i="5.85,265,1624345200"; d="scan'208";a="280445066" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2021 07:14:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,265,1624345200"; d="scan'208";a="429674012" Received: from bmca4bf01706bbf.iind.intel.com (HELO localhost.localdomain) ([10.190.213.111]) by orsmga003.jf.intel.com with ESMTP; 03 Sep 2021 07:14:20 -0700 From: Kumar Amber To: ovs-dev@openvswitch.org Date: Fri, 3 Sep 2021 19:23:16 +0530 Message-Id: <20210903135316.2449305-1-kumar.amber@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Cc: i.maximets@ovn.org, fbl@sysclose.org, Kumar Amber Subject: [ovs-dev] [PATCH v1] configure: Allow opt-in to CPU ISA opts at compile time 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This commit allows "opt-in" to CPU ISA optimized implementations of OVS SW datapath components at compile time. This can be useful in some deployments where the CPU ISA optimized implementation is to be chosen by default. If an subtable implementation is not available due to ISA not being available, it will not be selected. With --enable-cpu-isa on an AVX512 capable CPU, the dpcls_avx512_gather, the DPIF AVX512, MFEX AVX512 ISA optimized implementation is automatically enabled. The default is off, so unless ./configure --enable-cpu-isa is passed, the behaviour of the default OVS compile is not changed. Signed-off-by: Kumar Amber Signed-off-by: Harry van Haaren Co-authored-by: Harry van Haaren --- Documentation/topics/dpdk/bridge.rst | 9 +++++++++ NEWS | 2 ++ acinclude.m4 | 17 +++++++++++++++++ configure.ac | 1 + lib/dpif-netdev-lookup.c | 8 +++++++- lib/dpif-netdev-private-dpif.c | 2 +- lib/dpif-netdev-private-extract.c | 2 ++ 7 files changed, 39 insertions(+), 2 deletions(-) diff --git a/Documentation/topics/dpdk/bridge.rst b/Documentation/topics/dpdk/bridge.rst index f645b9ade..8568ec365 100644 --- a/Documentation/topics/dpdk/bridge.rst +++ b/Documentation/topics/dpdk/bridge.rst @@ -436,3 +436,12 @@ the following test-case in tests/system-dpdk.at :: make check-dpdk TESTSUITEFLAGS='-k MFEX' OVS-DPDK - MFEX Autovalidator Fuzzy + +Enabling all AVX512 options +--------------------------- + +A user can enable all the three DPIF, Miniflow Extract and DPLCS optimized +AVX512 options at build time, if the CPU supports the required AVX512 ISA +by using the following command :: + + ./configure --enable-cpu-isa diff --git a/NEWS b/NEWS index 1f2adf718..8d700595b 100644 --- a/NEWS +++ b/NEWS @@ -68,6 +68,8 @@ v2.16.0 - 16 Aug 2021 * Add new 'pmd-rxq-isolate' option that can be set to 'false' in order that pmd cores which are pinned with rxqs using 'pmd-rxq-affinity' are available for assigning other non-pinned rxqs. + * Add command and documentation to enable all AVX512 optimized options + by default at build time. - ovs-ctl: * New option '--no-record-hostname' to disable hostname configuration in ovsdb on startup. diff --git a/acinclude.m4 b/acinclude.m4 index dba365ea1..75098f980 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -33,6 +33,23 @@ AC_DEFUN([OVS_CHECK_MFEX_AUTOVALIDATOR], [ fi ]) +dnl Set OVS DPCLS DPIF and MFEX to AVX512 opt at compile time? +AC_DEFUN([OVS_CHECK_CPU_ISA_OPT_IN], [ + AC_ARG_ENABLE([cpu-isa], + [AC_HELP_STRING([--enable-cpu-isa], + [Enable CPU ISA default enable.])], + [isa=yes],[isa=no]) + AC_MSG_CHECKING([whether CPU ISA should be enabled by default]) + if test "$isa" != yes; then + AC_MSG_RESULT([no]) + else + AC_DEFINE([CPU_ISA_OPT_IN], [1], + [DPIF AVX512, DPCLS AVX512, MFEX AVX512 is a + default implementation.]) + AC_MSG_RESULT([yes]) + fi +]) + dnl Set OVS DPCLS Autovalidator as default subtable search at compile time? dnl This enables automatically running all unit tests with all DPCLS dnl implementations. diff --git a/configure.ac b/configure.ac index eaa9bf7ee..47e64a98c 100644 --- a/configure.ac +++ b/configure.ac @@ -182,6 +182,7 @@ OVS_CONDITIONAL_CC_OPTION([-Wno-unused-parameter], [HAVE_WNO_UNUSED_PARAMETER]) OVS_ENABLE_WERROR OVS_ENABLE_SPARSE OVS_CTAGS_IDENTIFIERS +OVS_CHECK_CPU_ISA_OPT_IN OVS_CHECK_DPCLS_AUTOVALIDATOR OVS_CHECK_DPIF_AVX512_DEFAULT OVS_CHECK_MFEX_AUTOVALIDATOR diff --git a/lib/dpif-netdev-lookup.c b/lib/dpif-netdev-lookup.c index bd0a99abe..0989c6a5f 100644 --- a/lib/dpif-netdev-lookup.c +++ b/lib/dpif-netdev-lookup.c @@ -45,7 +45,13 @@ static struct dpcls_subtable_lookup_info_t subtable_lookups[] = { #if (__x86_64__ && HAVE_AVX512F && HAVE_LD_AVX512_GOOD && __SSE4_2__) /* Only available on x86_64 bit builds with SSE 4.2 used for OVS core. */ - { .prio = 0, + { +#ifdef CPU_ISA_OPT_IN + /* Allow Autovalidator to override, but higher than default scalar. */ + .prio = 100, +#else + .prio = 0, +#endif .probe = dpcls_subtable_avx512_gather_probe, .name = "avx512_gather", }, #else diff --git a/lib/dpif-netdev-private-dpif.c b/lib/dpif-netdev-private-dpif.c index 84d4ec156..22761c10e 100644 --- a/lib/dpif-netdev-private-dpif.c +++ b/lib/dpif-netdev-private-dpif.c @@ -60,7 +60,7 @@ dp_netdev_impl_get_default(void) /* Configure-time overriding to run test suite on all implementations. */ #if (__x86_64__ && HAVE_AVX512F && HAVE_LD_AVX512_GOOD && __SSE4_2__) -#ifdef DPIF_AVX512_DEFAULT +#if defined(DPIF_AVX512_DEFAULT) || defined(CPU_ISA_OPT_IN) dp_netdev_input_func_probe probe; /* Check if the compiled default is compatible. */ diff --git a/lib/dpif-netdev-private-extract.c b/lib/dpif-netdev-private-extract.c index 7a06dbf6f..482aa1f37 100644 --- a/lib/dpif-netdev-private-extract.c +++ b/lib/dpif-netdev-private-extract.c @@ -105,6 +105,8 @@ dpif_miniflow_extract_init(void) atomic_uintptr_t *mfex_func = (void *)&default_mfex_func; #ifdef MFEX_AUTOVALIDATOR_DEFAULT int mfex_idx = MFEX_IMPL_AUTOVALIDATOR; +#elif CPU_ISA_OPT_IN + int mfex_idx = MFEX_IMPL_STUDY; #else int mfex_idx = MFEX_IMPL_SCALAR; #endif