All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] eal/freebsd: fix use of newer CPU_* macros
@ 2022-05-20 18:10 Bruce Richardson
  2022-05-24  6:50 ` Gao, DaxueX
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2022-05-20 18:10 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, stable, Bruce Richardson

From: David Marchand <david.marchand@redhat.com>

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 <david.marchand@redhat.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

---

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(-)

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 <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.36.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] eal/freebsd: fix use of newer CPU_* macros
  2022-05-20 18:10 [PATCH] eal/freebsd: fix use of newer CPU_* macros Bruce Richardson
@ 2022-05-24  6:50 ` Gao, DaxueX
  2022-05-24 10:37   ` David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: Gao, DaxueX @ 2022-05-24  6:50 UTC (permalink / raw)
  To: Richardson, Bruce, dev; +Cc: David Marchand, stable, Richardson, Bruce

> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: 2022年5月21日 2:11
> To: dev@dpdk.org
> Cc: David Marchand <david.marchand@redhat.com>; stable@dpdk.org;
> Richardson, Bruce <bruce.richardson@intel.com>
> Subject: [PATCH] eal/freebsd: fix use of newer CPU_* macros
> 
> From: David Marchand <david.marchand@redhat.com>
> 
> 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=e2650af157bc7489deaf2c9054995f0f8
> 8a6e5da
> 
> 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 <david.marchand@redhat.com>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Tested-by: Daxue Gao <daxuex.gao@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] eal/freebsd: fix use of newer CPU_* macros
  2022-05-24  6:50 ` Gao, DaxueX
@ 2022-05-24 10:37   ` David Marchand
  0 siblings, 0 replies; 3+ messages in thread
From: David Marchand @ 2022-05-24 10:37 UTC (permalink / raw)
  To: Richardson, Bruce; +Cc: dev, stable, Gao, DaxueX

On Tue, May 24, 2022 at 8:50 AM Gao, DaxueX <daxuex.gao@intel.com> wrote:
> > From: David Marchand <david.marchand@redhat.com>
> >
> > 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=e2650af157bc7489deaf2c9054995f0f8
> >
> > Bugzilla ID: 1014
> > Fixes: c3568ea37670 ("eal: restrict control threads to startup CPU affinity")
> > Fixes: b6be16acfeb1 ("eal: fix control thread affinity with --lcores")
> > CC: stable@dpdk.org
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Tested-by: Daxue Gao <daxuex.gao@intel.com>

Applied, thanks Bruce.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-24 10:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20 18:10 [PATCH] eal/freebsd: fix use of newer CPU_* macros Bruce Richardson
2022-05-24  6:50 ` Gao, DaxueX
2022-05-24 10:37   ` David Marchand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.