* [PATCH 19.11] eal/freebsd: fix use of newer cpuset macros
@ 2022-07-28 11:37 Bruce Richardson
2022-08-03 10:11 ` Christian Ehrhardt
0 siblings, 1 reply; 2+ messages in thread
From: Bruce Richardson @ 2022-07-28 11:37 UTC (permalink / raw)
To: stable; +Cc: YuX.Jiang, Bruce Richardson, 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=e2650af157bc
Bugzilla ID: 1014
Fixes: c3568ea37670 ("eal: restrict control threads to startup CPU affinity")
Fixes: b6be16acfeb1 ("eal: fix control thread affinity with --lcores")
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
This is a backport of commit 2f51bc9c27a4f1da674d66499667155663dcc419
for 19.11 release tree
---
lib/librte_eal/freebsd/eal/include/rte_os.h | 16 +++++++++++++++-
lib/librte_eal/freebsd/eal/meson.build | 11 +++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/freebsd/eal/include/rte_os.h b/lib/librte_eal/freebsd/eal/include/rte_os.h
index 78ee6fd8f4..908c37e9aa 100644
--- a/lib/librte_eal/freebsd/eal/include/rte_os.h
+++ b/lib/librte_eal/freebsd/eal/include/rte_os.h
@@ -17,6 +17,7 @@ extern "C" {
#include <pthread_np.h>
typedef cpuset_t rte_cpuset_t;
+#ifdef RTE_EAL_FREEBSD_CPUSET_LEGACY
#define RTE_CPU_AND(dst, src1, src2) do \
{ \
cpuset_t tmp; \
@@ -50,7 +51,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/librte_eal/freebsd/eal/meson.build b/lib/librte_eal/freebsd/eal/meson.build
index 1426f7e5f1..deb367f44c 100644
--- a/lib/librte_eal/freebsd/eal/meson.build
+++ b/lib/librte_eal/freebsd/eal/meson.build
@@ -20,3 +20,14 @@ env_sources = files('eal_alarm.c',
)
deps += ['kvargs']
+
+# test for version of cpuset macros
+cpuset_test_code = '''
+ #include <sys/types.h>
+ #include <sys/cpuset.h>
+ 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
--
2.37.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 19.11] eal/freebsd: fix use of newer cpuset macros
2022-07-28 11:37 [PATCH 19.11] eal/freebsd: fix use of newer cpuset macros Bruce Richardson
@ 2022-08-03 10:11 ` Christian Ehrhardt
0 siblings, 0 replies; 2+ messages in thread
From: Christian Ehrhardt @ 2022-08-03 10:11 UTC (permalink / raw)
To: Bruce Richardson; +Cc: stable, YuX.Jiang, David Marchand
On Thu, Jul 28, 2022 at 1:38 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> 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=e2650af157bc
Thank you for the ongoing help keeping the old releases buildable.
This is queued now, it depends if we will have a -rc2 if it will be in
19.11.13 or 19.11.14.
> Bugzilla ID: 1014
> Fixes: c3568ea37670 ("eal: restrict control threads to startup CPU affinity")
> Fixes: b6be16acfeb1 ("eal: fix control thread affinity with --lcores")
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> This is a backport of commit 2f51bc9c27a4f1da674d66499667155663dcc419
> for 19.11 release tree
> ---
> lib/librte_eal/freebsd/eal/include/rte_os.h | 16 +++++++++++++++-
> lib/librte_eal/freebsd/eal/meson.build | 11 +++++++++++
> 2 files changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/freebsd/eal/include/rte_os.h b/lib/librte_eal/freebsd/eal/include/rte_os.h
> index 78ee6fd8f4..908c37e9aa 100644
> --- a/lib/librte_eal/freebsd/eal/include/rte_os.h
> +++ b/lib/librte_eal/freebsd/eal/include/rte_os.h
> @@ -17,6 +17,7 @@ extern "C" {
> #include <pthread_np.h>
>
> typedef cpuset_t rte_cpuset_t;
> +#ifdef RTE_EAL_FREEBSD_CPUSET_LEGACY
> #define RTE_CPU_AND(dst, src1, src2) do \
> { \
> cpuset_t tmp; \
> @@ -50,7 +51,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/librte_eal/freebsd/eal/meson.build b/lib/librte_eal/freebsd/eal/meson.build
> index 1426f7e5f1..deb367f44c 100644
> --- a/lib/librte_eal/freebsd/eal/meson.build
> +++ b/lib/librte_eal/freebsd/eal/meson.build
> @@ -20,3 +20,14 @@ env_sources = files('eal_alarm.c',
> )
>
> deps += ['kvargs']
> +
> +# test for version of cpuset macros
> +cpuset_test_code = '''
> + #include <sys/types.h>
> + #include <sys/cpuset.h>
> + 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
> --
> 2.37.1
>
--
Christian Ehrhardt
Senior Staff Engineer, Ubuntu Server
Canonical Ltd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-03 10:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-28 11:37 [PATCH 19.11] eal/freebsd: fix use of newer cpuset macros Bruce Richardson
2022-08-03 10:11 ` Christian Ehrhardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).