From patchwork Fri May 20 18:10:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 111558 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CABA6A0032; Fri, 20 May 2022 20:11:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 74AFC40222; Fri, 20 May 2022 20:11:02 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 5511E40156; Fri, 20 May 2022 20:11:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653070260; x=1684606260; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=skxD/ZjVIdHgHddwu0tZD5zwJJ6kK1nWpVLVQOlwf4o=; b=TOAp7K2aP9taUUY/WnS3/fxQWEWB+W6w8CjiRT6M2qX0C+y5Xot7zeuO AhmqtaqdGohzfVk75AObp7McNOPfZRACk67H8IbPAp8+4neKipCi5TCL4 ZpFhC+cWYh0yRWs0QXl/bvp1HMtzeO9B2x7bSqM/LBmWATriB5ymdLJx1 r3Fcw4ozsthkiXJfHLwKk6siBTQ/GdgVQDoMGb8TIc9iY0gcUD4QzzoRA HcMZUK2JoW10NNLCQvOL55gHRSejTasYrdhPqV4ueLeQfn66AkRnjr4is njZ8SRu5/aeAwDgiL9YLu4j1OIdtKJw4O8zqvXah+BnFeSxpGXRdjAoZh w==; X-IronPort-AV: E=McAfee;i="6400,9594,10353"; a="333316677" X-IronPort-AV: E=Sophos;i="5.91,240,1647327600"; d="scan'208";a="333316677" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2022 11:10:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,240,1647327600"; d="scan'208";a="570939006" Received: from silpixa00401026.ir.intel.com ([10.243.23.31]) by orsmga007.jf.intel.com with ESMTP; 20 May 2022 11:10:57 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: David Marchand , stable@dpdk.org, Bruce Richardson Subject: [PATCH] eal/freebsd: fix use of newer CPU_* macros Date: Fri, 20 May 2022 19:10:50 +0100 Message-Id: <20220520181050.55654-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: David Marchand FreeBSD has updated its CPU macros to align more with the definitions used on Linux[1]. Unfortunately, while this makes compatibility better in future, it means we need to have both legacy and newer definition support. Use a meson check to determine which set of macros are used. [1] https://cgit.freebsd.org/src/commit/?id=e2650af157bc7489deaf2c9054995f0f88a6e5da Fixes: c3568ea37670 ("eal: restrict control threads to startup CPU affinity") Fixes: b6be16acfeb1 ("eal: fix control thread affinity with --lcores") Bugzilla ID: 1014 CC: stable@dpdk.org Signed-off-by: David Marchand Signed-off-by: Bruce Richardson Tested-by: Daxue Gao --- The fixes lines are indicative only (as commits where the macros were introduced), since there is no real bug in DPDK, just a changed environment it has to build/run in. --- lib/eal/freebsd/include/rte_os.h | 17 ++++++++++++++++- lib/eal/freebsd/meson.build | 11 +++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) -- 2.36.1 diff --git a/lib/eal/freebsd/include/rte_os.h b/lib/eal/freebsd/include/rte_os.h index b4afd45adc..003a8025b0 100644 --- a/lib/eal/freebsd/include/rte_os.h +++ b/lib/eal/freebsd/include/rte_os.h @@ -28,6 +28,8 @@ extern "C" { typedef cpuset_t rte_cpuset_t; #define RTE_HAS_CPUSET + +#ifdef RTE_EAL_FREEBSD_CPUSET_LEGACY #define RTE_CPU_AND(dst, src1, src2) do \ { \ cpuset_t tmp; \ @@ -61,7 +63,20 @@ typedef cpuset_t rte_cpuset_t; CPU_ANDNOT(&tmp, src); \ CPU_COPY(&tmp, dst); \ } while (0) -#endif +#endif /* CPU_NAND */ + +#else /* RTE_EAL_FREEBSD_CPUSET_LEGACY */ + +#define RTE_CPU_AND CPU_AND +#define RTE_CPU_OR CPU_OR +#define RTE_CPU_FILL CPU_FILL +#define RTE_CPU_NOT(dst,src) do { \ + cpu_set_t tmp; \ + CPU_FILL(&tmp); \ + CPU_XOR(dst, src, &tmp); \ +} while(0) + +#endif /* RTE_EAL_FREEBSD_CPUSET_LEGACY */ #ifdef __cplusplus } diff --git a/lib/eal/freebsd/meson.build b/lib/eal/freebsd/meson.build index 398ceab71d..2107d282db 100644 --- a/lib/eal/freebsd/meson.build +++ b/lib/eal/freebsd/meson.build @@ -19,3 +19,14 @@ sources += files( ) deps += ['kvargs', 'telemetry'] + +# test for version of cpuset macros +cpuset_test_code = ''' + #include + #include + void cpu_test_or(cpuset_t *s) { CPU_OR(s, s, s); } +''' + +if not cc.compiles(cpuset_test_code, name: 'Detect argument count for CPU_OR') + dpdk_conf.set('RTE_EAL_FREEBSD_CPUSET_LEGACY', 1) +endif