Enhance headers check
cover Enhance headers check
We currently check that exported headers are fine with -DALLOW_EXPERIMENTAL_API and -DALLOW_INTERNAL_API.
Such a check won't catch issues like the one fixed in patch 1, where OVS compilation is broken by the additional of experimental API in a header commonly included in other parts of DPDK.
Ideally, I would like to merge patch 1 in rc1.
The patch 2 is not a real issue (more like the enhanced check would complain about this header).
In any case, I think it would not hurt merging everything now.
Comments, please.
Signature · 14 lines
David Marchand David Marchand (3): bitops: fix build for GCC without experimental API bitset: fix build for GCC without experimental API buildtools/chkincs: check headers with stable API only buildtools/chkincs/meson.build | 27 +++++++- lib/eal/include/rte_bitops.h | 6 ++ lib/eal/include/rte_bitset.h | 123 +++++++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+), 2 deletions(-) -- 2.46.2
PATCH 1/3 bitops: fix build for GCC without experimental API
Building OVS against current DPDK fails with following warnings:
In file included from .../ovs/dpdk-dir/include/rte_memory.h:18,
from .../ovs/dpdk-dir/include/rte_ring_core.h:29,
from .../ovs/dpdk-dir/include/rte_ring.h:37,
from .../ovs/dpdk-dir/include/rte_mempool.h:49,
from .../ovs/dpdk-dir/include/rte_mbuf.h:38,
from lib/dp-packet.h:25,
from lib/ofp-packet.c:20:.../ovs/dpdk-dir/include/rte_bitops.h: In function ‘__rte_bit_assign32’:.../ovs/dpdk-dir/include/rte_bitops.h:528:1: error:
‘__rte_bit_set32’ is deprecated: Symbol is not yet part of stable ABI [-Werror=deprecated-declarations]
...
This comes from the fact that some (experimental) inline helpers are calling other experimental API.
Hide those calls.
--- lib/eal/include/rte_bitops.h | 6 ++++++ 1 file changed, 6 insertions(+)
lib/eal/include/rte_bitops.h +6 -0
@@ -525,8 +525,10 @@ __rte_bit_ ## variant ## flip ## size(qualifier uint ## size ## _t *addr, unsign __RTE_GEN_BIT_OPS(,, size) \ __RTE_GEN_BIT_OPS(v_, volatile, size) +#ifdef ALLOW_EXPERIMENTAL_API __RTE_GEN_BIT_OPS_SIZE(32) __RTE_GEN_BIT_OPS_SIZE(64) +#endif #define __RTE_GEN_BIT_ATOMIC_TEST (variant, qualifier, size) \ __rte_experimental \
@@ -651,8 +653,10 @@ __rte_bit_atomic_ ## variant ## test_and_assign ## size( \ __RTE_GEN_BIT_ATOMIC_OPS(,, size) \ __RTE_GEN_BIT_ATOMIC_OPS(v_, volatile, size) +#ifdef ALLOW_EXPERIMENTAL_API __RTE_GEN_BIT_ATOMIC_OPS_SIZE(32) __RTE_GEN_BIT_ATOMIC_OPS_SIZE(64) +#endif /*------------------------ 32-bit relaxed operations ------------------------*/
@@ -1481,6 +1485,7 @@ rte_bit_ ## family ## fun(qualifier uint ## size ## _t *addr, arg1_type arg1_nam__RTE_BIT_OVERLOAD_SZ_4R (family, fun, qualifier,64 , ret_type, arg1_type, arg1_name, \ arg2_type, arg2_name, arg3_type, arg3_name) +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BIT_OVERLOAD_2R(, test, const, bool, unsigned int, nr) __RTE_BIT_OVERLOAD_2(, set,, unsigned int, nr) __RTE_BIT_OVERLOAD_2(, clear,, unsigned int, nr)
@@ -1496,6 +1501,7 @@ __RTE_BIT_OVERLOAD_3R(atomic_, test_and_set,, bool, unsigned int, nr, int, memor __RTE_BIT_OVERLOAD_3R(atomic_, test_and_clear,, bool, unsigned int, nr, int, memory_order) __RTE_BIT_OVERLOAD_4R(atomic_, test_and_assign,, bool, unsigned int, nr, bool, value, int, memory_order) +#endif #endif
Signature · 1 line
2.46.2
RE: [PATCH 1/3] bitops: fix build for GCC without experimental API
Quoted 19 lines
From: David Marchand [mailto:[email protected]]
Sent: Tuesday, 15 October 2024 14.11Building OVS against current DPDK fails with following warnings:
In file included from
.../ovs/dpdk-dir/include/rte_memory.h:18,from .../ovs/dpdk-dir/include/rte_ring_core.h:29, from .../ovs/dpdk-dir/include/rte_ring.h:37, from .../ovs/dpdk-dir/include/rte_mempool.h:49, from .../ovs/dpdk-dir/include/rte_mbuf.h:38, from lib/dp-packet.h:25, from lib/ofp-packet.c:20:
.../ovs/dpdk-dir/include/rte_bitops.h: In function ‘__rte_bit_assign32’:.../ovs/dpdk-dir/include/rte_bitops.h:528:1: error:
‘__rte_bit_set32’ is deprecated: Symbol is not yet part of stable ABI [-Werror=deprecated-declarations]
...
Quoted 3 lines
This comes from the fact that some (experimental) inline helpers are calling other experimental API.
Hide those calls.
Are you saying that the compiler warns if some experimental function calls another experimental function?
I understand the fix, so I am wondering about consistency:
Do we generally hide experimental functions if building without ALLOW_EXPERIMENTAL_API? Or do we only do it to inline functions?
An alternative solution is copy-pasting the inlined implementations of the called experimental functions into the functions calling them. I generally don't like copy-paste, so probably even worse.
Anyway, this is a viable fix, so
PATCH 2/3 bitset: fix build for GCC without experimental API
In reply to David MarchandFor a reason similar to the change on bitops header, hide bitset implementation relying on experimental API.
--- lib/eal/include/rte_bitset.h | 123 +++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)
lib/eal/include/rte_bitset.h +123 -0
@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +return false; +#endif }/**
@@ -277,7 +283,12 @@ __rte_experimentalstatic inline void rte_bitset_set (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_set, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +#endif }/**
@@ -299,7 +310,12 @@ __rte_experimentalstatic inline void rte_bitset_clear (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_clear, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +#endif }/**
@@ -323,7 +339,13 @@ __rte_experimentalstatic inline void rte_bitset_assign (uint64_t *bitset,size_t bit_num,bool bit_value) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_assign, bitset, bit_num, bit_value); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (bit_value); +#endif }/**
@@ -345,7 +367,12 @@ __rte_experimentalstatic inline void rte_bitset_flip (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_flip, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +#endif }/**
@@ -370,7 +397,14 @@ __rte_experimentalstatic inline bool rte_bitset_atomic_test (const uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE_N (rte_bit_atomic_test, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +return false; +#endif }/**
@@ -399,7 +433,13 @@ __rte_experimentalstatic inline void rte_bitset_atomic_set (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_set, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +#endif }/**
@@ -428,7 +468,13 @@ __rte_experimentalstatic inline void rte_bitset_atomic_clear (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_clear, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +#endif }/**
@@ -459,7 +505,14 @@ __rte_experimentalstatic inline void rte_bitset_atomic_assign (uint64_t *bitset,size_t bit_num,bool bit_value,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_assign, bitset, bit_num, bit_value, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (bit_value); +RTE_SET_USED (memory_order); +#endif }/**
@@ -488,7 +541,13 @@ __rte_experimentalstatic inline void rte_bitset_atomic_flip (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_flip, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +#endif }/**
@@ -524,7 +583,12 @@ __rte_experimentalstatic inline void rte_bitset_clear_all (uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API rte_bitset_init (bitset, size); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +#endif }/**
@@ -576,7 +640,13 @@ __rte_experimentalstatic inline size_t rte_bitset_count_clear (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return size -rte_bitset_count_set (bitset, size); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +return 0 ; +#endif }#define __RTE_BITSET_FIND_FLAG_FIND_CLEAR (1U << 0)
@@ -638,6 +708,7 @@ static inline ssize_t __rte_bitset_find(const uint64_t *bitset, size_t size, size_t start_bit, size_t len, unsigned int flags) { +#ifdef ALLOW_EXPERIMENTAL_API bool find_clear = flags & __RTE_BITSET_FIND_FLAG_FIND_CLEAR;bool may_wrap = flags & __RTE_BITSET_FIND_FLAG_WRAP;bool does_wrap = (start_bit + len) > size;
@@ -658,6 +729,14 @@ __rte_bitset_find(const uint64_t *bitset, size_t size, size_t start_bit, size_t rc =__rte_bitset_find_nowrap (bitset, size, start_bit, len, find_clear);return rc; +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +RTE_SET_USED (flags); +return 0 ; +#endif }/**
@@ -681,7 +760,13 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_first_set (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size,0 , size,0 ); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +return 0 ; +#endif }/**
@@ -711,7 +796,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_set (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len,0 ); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +return 0 ; +#endif }/**
@@ -742,7 +835,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_set_wrap (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_WRAP); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +return 0 ; +#endif }/**
@@ -766,7 +867,13 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_first_clear (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size,0 , size, __RTE_BITSET_FIND_FLAG_FIND_CLEAR); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +return 0 ; +#endif }/**
@@ -796,7 +903,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_clear (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_FIND_CLEAR); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +return 0 ; +#endif }/**
@@ -827,8 +942,16 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_clear_wrap (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_FIND_CLEAR | __RTE_BITSET_FIND_FLAG_WRAP); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +return 0 ; +#endif }/**
Signature · 1 line
2.46.2
RE: [PATCH 2/3] bitset: fix build for GCC without experimental API
Quoted 20 lines
From: David Marchand [mailto:[email protected]]
Sent: Tuesday, 15 October 2024 14.11For a reason similar to the change on bitops header, hide bitset implementation relying on experimental API.
Fixes 99a1197647d8 ("eal: add bitset type")Signed-off-by David Marchand <[email protected]>--- lib/eal/include/rte_bitset.h | 123 +++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)lib/eal/include/rte_bitset.h +0
-0@@ -255,7 +255,13 @@ __rte_experimental static inline bool
lib/eal/include/rte_bitset.h __rte_experimental · line 265
Quoted 10 lines
lib/eal/include/rte_bitset.h +6
-0rte_bitset_test(const uint64_t *bitset, size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +return false; +#endif }
This looks wrong! The API is exposed, but does nothing.
It is possible to build without ALLOW_EXPERIMENTAL_API; the compiler will emit warnings when using experimental APIs.
If those compiler warnings are not handled as errors, the compiled application will be full of bugs.
Re: [PATCH 2/3] bitset: fix build for GCC without experimental API
15/10/2024 14:53, Morten Brørup:
Quoted 7 lines
Quoted 7 lines
From: David Marchand [mailto:[email protected]]
lib/eal/include/rte_bitset.h +1
-0@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num);
Quoted 8 lines
lib/eal/include/rte_bitset.h __rte_experimental · line 265
Quoted 6 lines
lib/eal/include/rte_bitset.h +5
-0+#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +return false; +#endif }This looks wrong! The API is exposed, but does nothing.
Yes, this is what we did already in the past for other experimental functions called from inline functions.
There is no choice, the compiler is hitting the warning.
Quoted 1 line
It is possible to build without
ALLOW_EXPERIMENTAL_API; the compiler will emit warnings when using experimental APIs.
Yes it is possible to build,
but it is not said it should work the same.
Quoted 1 line
If those compiler warnings are not handled as errors, the compiled application will be full of bugs.
Yes, that's why there are warnings.
We may document it better but that's the behavior we have for years. There is no easy solution, and making experimental functions work without defining ALLOW_EXPERIMENTAL_API is not a really interesting goal. I think the word "allow" suggests it is not supposed to work if not allowed.
It would be more interesting to make sure the users understand why we have this flag and how to enable it.
I propose adding some docs, and mentioning ALLOW_EXPERIMENTAL_API in the the __rte_experimental message in rte_compat.h.
RE: [PATCH 2/3] bitset: fix build for GCC without experimental API
Quoted 34 lines
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, 15 October 2024 16.1315/10/2024 14:53, Morten Brørup:
Quoted 7 lines
Quoted 7 lines
From: David Marchand [mailto:[email protected]]
lib/eal/include/rte_bitset.h +1
-0@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num);Quoted 8 lines
lib/eal/include/rte_bitset.h __rte_experimental · line 265
Quoted 6 lines
lib/eal/include/rte_bitset.h +5
-0+#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +return false; +#endif }This looks wrong! The API is exposed, but does nothing.
Yes, this is what we did already in the past for other experimental functions
called from inline functions.
There is no choice, the compiler is hitting the warning.Quoted 1 line
It is possible to build without
ALLOW_EXPERIMENTAL_API; the compilerwill emit warnings when using experimental APIs.
Yes it is possible to build,
but it is not said it should work the same.Quoted 1 line
If those compiler warnings are not handled as errors, the compiled
application will be full of bugs.
Quoted 7 lines
Yes, that's why there are warnings.
We may document it better but that's the behavior we have for years. There is no easy solution, and making experimental functions work without definingALLOW_EXPERIMENTAL_APIis not a really interesting goal.
I think the word "allow" suggests it is not supposed to work if not allowed.
There's a world of difference between "experimental, might have bugs" - which is what I (and possibly other DPDK consumers) expect - and "experimental, we know for a fact that it doesn't work" - which is quite a surprise to me.
Quoted 6 lines
It would be more interesting to make sure the users understand why we have this flag and how to enable it.
I propose adding some docs, and mentioningALLOW_EXPERIMENTAL_APIin the the__rte_experimentalmessage inrte_compat.h.
If we know that some of these warnings cause bugs in DPDK, we should elevate these specific instances to error level.
Regarding this specific patch:
Would it be possible to change it to behave like patch 1/3, i.e. completely omit the experimental APIs if ALLOW_EXPERIMENTAL_API is not defined?
Re: [PATCH 2/3] bitset: fix build for GCC without experimental API
15/10/2024 16:44, Morten Brørup:
Quoted 42 lines
Quoted 34 lines
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, 15 October 2024 16.1315/10/2024 14:53, Morten Brørup:
Quoted 7 lines
Quoted 7 lines
From: David Marchand [mailto:[email protected]]
lib/eal/include/rte_bitset.h +1
-0@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num);Quoted 8 lines
lib/eal/include/rte_bitset.h __rte_experimental · line 265
Quoted 6 lines
lib/eal/include/rte_bitset.h +5
-0+#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +return false; +#endif }This looks wrong! The API is exposed, but does nothing.
Yes, this is what we did already in the past for other experimental functions
called from inline functions.
There is no choice, the compiler is hitting the warning.Quoted 1 line
It is possible to build without
ALLOW_EXPERIMENTAL_API; the compilerwill emit warnings when using experimental APIs.
Yes it is possible to build,
but it is not said it should work the same.Quoted 1 line
If those compiler warnings are not handled as errors, the compiled
application will be full of bugs.
Quoted 7 lines
Yes, that's why there are warnings.
We may document it better but that's the behavior we have for years. There is no easy solution, and making experimental functions work without definingALLOW_EXPERIMENTAL_APIis not a really interesting goal.
I think the word "allow" suggests it is not supposed to work if not allowed.
Quoted 1 line
There's a world of difference between "experimental, might have bugs" - which is what I (and possibly other DPDK consumers) expect - and "experimental, we know for a fact that it doesn't work" - which is quite a surprise to me.
It does not work if you don't enable it,
and there is a warning when compiling.
Quoted 7 lines
Quoted 5 lines
It would be more interesting to make sure the users understand why we have this flag and how to enable it.
I propose adding some docs, and mentioningALLOW_EXPERIMENTAL_APIin the the__rte_experimentalmessage inrte_compat.h.If we know that some of these warnings cause bugs in DPDK, we should elevate these specific instances to error level.
Technically I don't know whether it is possible.
Look at rte_compat.h
Quoted 2 lines
Regarding this specific patch:
Would it be possible to change it to behave like patch 1/3, i.e. completely omit the experimental APIs ifALLOW_EXPERIMENTAL_APIis not defined?
I disagree, it would be a lot of churn in the code to disable all experimental API calls.
Morten Brørup
Acked-byRE: [PATCH 2/3] bitset: fix build for GCC without experimental API
Quoted 50 lines
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, 15 October 2024 21.5815/10/2024 16:44, Morten Brørup:
Quoted 11 lines
Quoted 11 lines
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, 15 October 2024 16.1315/10/2024 14:53, Morten Brørup:
Quoted 7 lines
lib/eal/include/rte_bitset.h __rte_experimental · line 259
Quoted 7 lines
From: David Marchand [mailto:[email protected]]
lib/eal/include/rte_bitset.h +1
-0@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE(rte_bit_test, bitset,
bit_num);Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
lib/eal/include/rte_bitset.h __rte_experimental · line 265
Quoted 6 lines
lib/eal/include/rte_bitset.h +5
-0+#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +return false; +#endif }This looks wrong! The API is exposed, but does nothing.
Quoted 6 lines
Quoted 6 lines
Yes, this is what we did already in the past for other experimental functions
called from inline functions.
There is no choice, the compiler is hitting the warning.Quoted 1 line
It is possible to build without
ALLOW_EXPERIMENTAL_API; thecompiler
Quoted 6 lines
Quoted 6 lines
will emit warnings when using experimental APIs.
Yes it is possible to build,
but it is not said it should work the same.Quoted 1 line
If those compiler warnings are not handled as errors, the
compiled
Quoted 4 lines
Quoted 4 lines
application will be full of bugs.
Yes, that's why there are warnings.
We may document it better but that's the behavior we have foryears.
Quoted 6 lines
Quoted 5 lines
There is no easy solution, and making experimental functions work without defining
ALLOW_EXPERIMENTAL_APIis not a really interesting goal.
I think the word "allow" suggests it is not supposed to work if not allowed.
Quoted 7 lines
Quoted 1 line
There's a world of difference between "experimental, might have bugs"
- which is what I (and possibly other DPDK consumers) expect - and "experimental, we know for a fact that it doesn't work" - which is quite a surprise to me.
It does not work if you don't enable it,
and there is a warning when compiling.
My issue with this is:
The warning only says that the API is deprecated. It doesn't say that the underlying implementation might be completely missing.
Quoted 15 lines
Quoted 9 lines
Quoted 7 lines
It would be more interesting to make sure the users understand why we have this flag and how to enable it.
I propose adding some docs, and mentioningALLOW_EXPERIMENTAL_APIin the the__rte_experimentalmessage inrte_compat.h.If we know that some of these warnings cause bugs in DPDK, we should
elevate these specific instances to error level.
Technically I don't know whether it is possible.
Look atrte_compat.h
Quoted 7 lines
Quoted 2 lines
Regarding this specific patch:
Would it be possible to change it to behave like patch 1/3, i.e.completely omit the experimental APIs if
ALLOW_EXPERIMENTAL_APIis not defined?I disagree, it would be a lot of churn in the code to disable all experimental API calls.
OK.
Apparently the issue is not specific to this patch, so it would be unreasonable to require this patch to handle it differently than it has been handled until now.
PATCH 3/3 buildtools/chkincs: check headers with stable API only
In reply to David MarchandAn exported header should be usable w/ and w/o ALLOW_EXPERIMENTAL_API so that an application that only wants stable API may include it.
Plus, the widely common case is that an application will not use internal API.
Cover those cases but keep the original test.
--- buildtools/chkincs/meson.build | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
buildtools/chkincs/meson.build +25 -2
@@ -12,8 +12,6 @@ gen_c_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cflags = machine_args -cflags += '-DALLOW_EXPERIMENTAL_API' -cflags += '-DALLOW_INTERNAL_API' sources = files('main.c') sources += gen_c_files.process(dpdk_chkinc_headers)
@@ -32,6 +30,18 @@ executable('chkincs', sources, dependencies: deps, install: false) +executable('chkincs-exp', sources, + c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'], + include_directories: includes, + dependencies: deps, + install: false) + +executable('chkincs-all', sources, + c_args: [cflags, '-DALLOW_EXPERIMENTAL_API', '-DALLOW_INTERNAL_API'], + include_directories: includes, + dependencies: deps, + install: false) + # run tests for c++ builds also if not add_languages('cpp', required: false) subdir_done()
@@ -49,3 +59,16 @@ executable('chkincs-cpp', cpp_sources, include_directories: includes, dependencies: deps, install: false) + +executable('chkincs-cpp-exp', cpp_sources, + cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API'], + include_directories: includes, + dependencies: deps, + install: false) + +executable('chkincs-cpp-all', cpp_sources, + cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API', + '-DALLOW_INTERNAL_API'], + include_directories: includes, + dependencies: deps, + install: false)
Signature · 1 line
2.46.2
v2 cover Enhance headers check
In reply to David MarchandWe currently check that exported headers are fine with -DALLOW_EXPERIMENTAL_API and -DALLOW_INTERNAL_API.
Such a check won't catch issues like the one fixed in patch 1, where OVS compilation is broken by the additional of experimental API in a header commonly included in other parts of DPDK.
Ideally, I would like to merge patch 1 in rc1.
The patch 2 is not a real issue (more like the enhanced check would complain about this header).
In any case, I think it would not hurt merging everything now.
Comments, please.
Signature · 19 lines
David Marchand Changes since v1: - fixed additional issue in vDPA header, raised by CI, David Marchand (4): bitops: fix build for GCC without experimental API bitset: fix build for GCC without experimental API vhost: remove internal vDPA API description from public header buildtools/chkincs: check headers with stable API only buildtools/chkincs/meson.build | 27 +++++++- lib/eal/include/rte_bitops.h | 6 ++ lib/eal/include/rte_bitset.h | 123 +++++++++++++++++++++++++++++++++ lib/vhost/rte_vdpa.h | 17 ----- 4 files changed, 154 insertions(+), 19 deletions(-) -- 2.46.2
PATCH v2 1/4 bitops: fix build for GCC without experimental API
Building OVS against current DPDK fails with following warnings:
In file included from .../ovs/dpdk-dir/include/rte_memory.h:18,
from .../ovs/dpdk-dir/include/rte_ring_core.h:29,
from .../ovs/dpdk-dir/include/rte_ring.h:37,
from .../ovs/dpdk-dir/include/rte_mempool.h:49,
from .../ovs/dpdk-dir/include/rte_mbuf.h:38,
from lib/dp-packet.h:25,
from lib/ofp-packet.c:20:.../ovs/dpdk-dir/include/rte_bitops.h: In function ‘__rte_bit_assign32’:.../ovs/dpdk-dir/include/rte_bitops.h:528:1: error:
‘__rte_bit_set32’ is deprecated: Symbol is not yet part of stable ABI [-Werror=deprecated-declarations]
...
This comes from the fact that some (experimental) inline helpers are calling other experimental API.
Hide those calls.
--- lib/eal/include/rte_bitops.h | 6 ++++++ 1 file changed, 6 insertions(+)
lib/eal/include/rte_bitops.h +6 -0
@@ -525,8 +525,10 @@ __rte_bit_ ## variant ## flip ## size(qualifier uint ## size ## _t *addr, unsign __RTE_GEN_BIT_OPS(,, size) \ __RTE_GEN_BIT_OPS(v_, volatile, size) +#ifdef ALLOW_EXPERIMENTAL_API __RTE_GEN_BIT_OPS_SIZE(32) __RTE_GEN_BIT_OPS_SIZE(64) +#endif #define __RTE_GEN_BIT_ATOMIC_TEST (variant, qualifier, size) \ __rte_experimental \
@@ -651,8 +653,10 @@ __rte_bit_atomic_ ## variant ## test_and_assign ## size( \ __RTE_GEN_BIT_ATOMIC_OPS(,, size) \ __RTE_GEN_BIT_ATOMIC_OPS(v_, volatile, size) +#ifdef ALLOW_EXPERIMENTAL_API __RTE_GEN_BIT_ATOMIC_OPS_SIZE(32) __RTE_GEN_BIT_ATOMIC_OPS_SIZE(64) +#endif /*------------------------ 32-bit relaxed operations ------------------------*/
@@ -1481,6 +1485,7 @@ rte_bit_ ## family ## fun(qualifier uint ## size ## _t *addr, arg1_type arg1_nam__RTE_BIT_OVERLOAD_SZ_4R (family, fun, qualifier,64 , ret_type, arg1_type, arg1_name, \ arg2_type, arg2_name, arg3_type, arg3_name) +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BIT_OVERLOAD_2R(, test, const, bool, unsigned int, nr) __RTE_BIT_OVERLOAD_2(, set,, unsigned int, nr) __RTE_BIT_OVERLOAD_2(, clear,, unsigned int, nr)
@@ -1496,6 +1501,7 @@ __RTE_BIT_OVERLOAD_3R(atomic_, test_and_set,, bool, unsigned int, nr, int, memor __RTE_BIT_OVERLOAD_3R(atomic_, test_and_clear,, bool, unsigned int, nr, int, memory_order) __RTE_BIT_OVERLOAD_4R(atomic_, test_and_assign,, bool, unsigned int, nr, bool, value, int, memory_order) +#endif #endif
Signature · 1 line
2.46.2
PATCH v2 2/4 bitset: fix build for GCC without experimental API
In reply to David MarchandFor a reason similar to the change on bitops header, hide bitset implementation relying on experimental API.
--- lib/eal/include/rte_bitset.h | 123 +++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)
lib/eal/include/rte_bitset.h +123 -0
@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +return false; +#endif }/**
@@ -277,7 +283,12 @@ __rte_experimentalstatic inline void rte_bitset_set (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_set, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +#endif }/**
@@ -299,7 +310,12 @@ __rte_experimentalstatic inline void rte_bitset_clear (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_clear, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +#endif }/**
@@ -323,7 +339,13 @@ __rte_experimentalstatic inline void rte_bitset_assign (uint64_t *bitset,size_t bit_num,bool bit_value) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_assign, bitset, bit_num, bit_value); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (bit_value); +#endif }/**
@@ -345,7 +367,12 @@ __rte_experimentalstatic inline void rte_bitset_flip (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_flip, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +#endif }/**
@@ -370,7 +397,14 @@ __rte_experimentalstatic inline bool rte_bitset_atomic_test (const uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE_N (rte_bit_atomic_test, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +return false; +#endif }/**
@@ -399,7 +433,13 @@ __rte_experimentalstatic inline void rte_bitset_atomic_set (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_set, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +#endif }/**
@@ -428,7 +468,13 @@ __rte_experimentalstatic inline void rte_bitset_atomic_clear (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_clear, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +#endif }/**
@@ -459,7 +505,14 @@ __rte_experimentalstatic inline void rte_bitset_atomic_assign (uint64_t *bitset,size_t bit_num,bool bit_value,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_assign, bitset, bit_num, bit_value, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (bit_value); +RTE_SET_USED (memory_order); +#endif }/**
@@ -488,7 +541,13 @@ __rte_experimentalstatic inline void rte_bitset_atomic_flip (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_flip, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +#endif }/**
@@ -524,7 +583,12 @@ __rte_experimentalstatic inline void rte_bitset_clear_all (uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API rte_bitset_init (bitset, size); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +#endif }/**
@@ -576,7 +640,13 @@ __rte_experimentalstatic inline size_t rte_bitset_count_clear (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return size -rte_bitset_count_set (bitset, size); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +return 0 ; +#endif }#define __RTE_BITSET_FIND_FLAG_FIND_CLEAR (1U << 0)
@@ -638,6 +708,7 @@ static inline ssize_t __rte_bitset_find(const uint64_t *bitset, size_t size, size_t start_bit, size_t len, unsigned int flags) { +#ifdef ALLOW_EXPERIMENTAL_API bool find_clear = flags & __RTE_BITSET_FIND_FLAG_FIND_CLEAR;bool may_wrap = flags & __RTE_BITSET_FIND_FLAG_WRAP;bool does_wrap = (start_bit + len) > size;
@@ -658,6 +729,14 @@ __rte_bitset_find(const uint64_t *bitset, size_t size, size_t start_bit, size_t rc =__rte_bitset_find_nowrap (bitset, size, start_bit, len, find_clear);return rc; +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +RTE_SET_USED (flags); +return 0 ; +#endif }/**
@@ -681,7 +760,13 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_first_set (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size,0 , size,0 ); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +return 0 ; +#endif }/**
@@ -711,7 +796,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_set (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len,0 ); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +return 0 ; +#endif }/**
@@ -742,7 +835,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_set_wrap (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_WRAP); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +return 0 ; +#endif }/**
@@ -766,7 +867,13 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_first_clear (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size,0 , size, __RTE_BITSET_FIND_FLAG_FIND_CLEAR); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +return 0 ; +#endif }/**
@@ -796,7 +903,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_clear (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_FIND_CLEAR); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +return 0 ; +#endif }/**
@@ -827,8 +942,16 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_clear_wrap (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_FIND_CLEAR | __RTE_BITSET_FIND_FLAG_WRAP); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +return 0 ; +#endif }/**
Signature · 1 line
2.46.2
Re: [PATCH v2 2/4] bitset: fix build for GCC without experimental API
Quoted 16 lines · David Marchand
For a reason similar to the change on bitops header, hide bitset implementation relying on experimental API.
Fixes 99a1197647d8 ("eal: add bitset type")Signed-off-by David Marchand <[email protected]>Acked-by Morten Brørup <[email protected]>--- lib/eal/include/rte_bitset.h | 123 +++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)lib/eal/include/rte_bitset.h +0
-0
lib/eal/include/rte_bitset.h __rte_experimental · line 263
Quoted 9 lines
lib/eal/include/rte_bitset.h +5
-0@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +return false;
This is no RTE_VERIFY(0) here, because this is just dummy code, that will never be run. Is that correct?
Quoted 272 lines
lib/eal/include/rte_bitset.h +118
-0+#endif }/** @@ -277,7 +283,12 @@ __rte_experimentalstatic inline void rte_bitset_set (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_set, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +#endif }/** @@ -299,7 +310,12 @@ __rte_experimentalstatic inline void rte_bitset_clear (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_clear, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +#endif }/** @@ -323,7 +339,13 @@ __rte_experimentalstatic inline void rte_bitset_assign (uint64_t *bitset,size_t bit_num,bool bit_value) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_assign, bitset, bit_num, bit_value); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (bit_value); +#endif }/** @@ -345,7 +367,12 @@ __rte_experimentalstatic inline void rte_bitset_flip (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_flip, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +#endif }/** @@ -370,7 +397,14 @@ __rte_experimentalstatic inline bool rte_bitset_atomic_test (const uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE_N (rte_bit_atomic_test, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +return false; +#endif }/** @@ -399,7 +433,13 @@ __rte_experimentalstatic inline void rte_bitset_atomic_set (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_set, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +#endif }/** @@ -428,7 +468,13 @@ __rte_experimentalstatic inline void rte_bitset_atomic_clear (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_clear, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +#endif }/** @@ -459,7 +505,14 @@ __rte_experimentalstatic inline void rte_bitset_atomic_assign (uint64_t *bitset,size_t bit_num,bool bit_value,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_assign, bitset, bit_num, bit_value, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (bit_value); +RTE_SET_USED (memory_order); +#endif }/** @@ -488,7 +541,13 @@ __rte_experimentalstatic inline void rte_bitset_atomic_flip (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_flip, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +#endif }/** @@ -524,7 +583,12 @@ __rte_experimentalstatic inline void rte_bitset_clear_all (uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API rte_bitset_init (bitset, size); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +#endif }/** @@ -576,7 +640,13 @@ __rte_experimentalstatic inline size_t rte_bitset_count_clear (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return size -rte_bitset_count_set (bitset, size); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +return 0 ; +#endif }#define __RTE_BITSET_FIND_FLAG_FIND_CLEAR (1U << 0)@@ -638,6 +708,7 @@ static inline ssize_t __rte_bitset_find(const uint64_t *bitset, size_t size, size_t start_bit, size_t len, unsigned int flags) { +#ifdef ALLOW_EXPERIMENTAL_API bool find_clear = flags & __RTE_BITSET_FIND_FLAG_FIND_CLEAR;bool may_wrap = flags & __RTE_BITSET_FIND_FLAG_WRAP;bool does_wrap = (start_bit + len) > size;@@ -658,6 +729,14 @@ __rte_bitset_find(const uint64_t *bitset, size_t size, size_t start_bit, size_t rc =__rte_bitset_find_nowrap (bitset, size, start_bit, len, find_clear);return rc; +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +RTE_SET_USED (flags); +return 0 ; +#endif }/** @@ -681,7 +760,13 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_first_set (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size,0 , size,0 ); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +return 0 ; +#endif }/** @@ -711,7 +796,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_set (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len,0 ); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +return 0 ; +#endif }/** @@ -742,7 +835,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_set_wrap (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_WRAP); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +return 0 ; +#endif }/** @@ -766,7 +867,13 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_first_clear (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size,0 , size, __RTE_BITSET_FIND_FLAG_FIND_CLEAR); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +return 0 ; +#endif }/** @@ -796,7 +903,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_clear (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_FIND_CLEAR); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +return 0 ; +#endif }/** @@ -827,8 +942,16 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_clear_wrap (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_FIND_CLEAR | __RTE_BITSET_FIND_FLAG_WRAP); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +return 0 ; +#endif }/**
Re: [PATCH v2 2/4] bitset: fix build for GCC without experimental API
Quoted 22 lines · Mattias Rönnblom
Quoted 20 lines · David Marchand
For a reason similar to the change on bitops header, hide bitset implementation relying on experimental API.
Fixes 99a1197647d8 ("eal: add bitset type")Signed-off-by David Marchand <[email protected]>Acked-by Morten Brørup <[email protected]>--- lib/eal/include/rte_bitset.h | 123 +++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)lib/eal/include/rte_bitset.h +1
-0@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API
Quoted 8 lines
lib/eal/include/rte_bitset.h __rte_experimental · line 263
Quoted 5 lines
lib/eal/include/rte_bitset.h +4
-0return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +return false;This is no
RTE_VERIFY(0)here, because this is just dummy code, that will never be run. Is that correct?
Adding a RTE_VERIFY(false) is an interesting idea. It is not supposed to be run, indeed.
Do you prefer I respin with this?
Signature · 1 line
David Marchand
RE: [PATCH v2 2/4] bitset: fix build for GCC without experimental API
Quoted 38 lines
From: David Marchand [mailto:[email protected]]
Sent: Wednesday, 16 October 2024 17.37Quoted 11 lines · Mattias Rönnblom
Quoted 9 lines · David Marchand
For a reason similar to the change on bitops header, hide bitset implementation relying on experimental API.
Fixes 99a1197647d8 ("eal: add bitset type")Signed-off-by David Marchand <[email protected]>Acked-by Morten Brørup <[email protected]>--- lib/eal/include/rte_bitset.h | 123+++++++++++++++++++++++++++++++++++
Quoted 3 lines
Review
Quoted 3 lines
1 file changed, 123 insertions(+)(quoted diff) +0
-0
b/lib/eal/include/rte_bitset.hQuoted 8 lines
Quoted 8 lines
index
74c643a72a..8ae8425fc2100644lib/eal/include/rte_bitset.h +1
-0@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API Quoted 8 lines
lib/eal/include/rte_bitset.h __rte_experimental · line 263
Quoted 5 lines
lib/eal/include/rte_bitset.h +4
-0return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +return false;This is no
RTE_VERIFY(0)here, because this is just dummy code, that will never be run. Is that correct?
Quoted 2 lines
Adding a
RTE_VERIFY(false)is an interesting idea. It is not supposed to be run, indeed.
Great idea.
Quoted 2 lines
Do you prefer I respin with this?
No need.
Instead, create a ticket in Bugzilla so RTE_VERIFY(false) goes in everywhere there is dummy code, not just here.
Quoted 4 lines
--
David Marchand
Re: [PATCH v2 2/4] bitset: fix build for GCC without experimental API
Quoted 41 lines · Morten Brørup
Quoted 38 lines
From: David Marchand [mailto:[email protected]]
Sent: Wednesday, 16 October 2024 17.37Quoted 11 lines · Mattias Rönnblom
Quoted 9 lines · David Marchand
For a reason similar to the change on bitops header, hide bitset implementation relying on experimental API.
Fixes 99a1197647d8 ("eal: add bitset type")Signed-off-by David Marchand <[email protected]>Acked-by Morten Brørup <[email protected]>--- lib/eal/include/rte_bitset.h | 123+++++++++++++++++++++++++++++++++++
Quoted 3 lines
Review
Quoted 3 lines
1 file changed, 123 insertions(+)(quoted diff) +0
-0
b/lib/eal/include/rte_bitset.hQuoted 8 lines
Quoted 8 lines
index
74c643a72a..8ae8425fc2100644lib/eal/include/rte_bitset.h +1
-0@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API Quoted 8 lines
lib/eal/include/rte_bitset.h __rte_experimental · line 263
Quoted 5 lines
lib/eal/include/rte_bitset.h +4
-0return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +return false;This is no
RTE_VERIFY(0)here, because this is just dummy code, that will never be run. Is that correct?Quoted 2 lines
Adding a
RTE_VERIFY(false)is an interesting idea. It is not supposed to be run, indeed.
Quoted 8 lines
Great idea.
Quoted 2 lines
Do you prefer I respin with this?
No need.
Instead, create a ticket in Bugzilla soRTE_VERIFY(false)goes in everywhere there is dummy code, not just here.
No experimental function is supposed to be invoked, if ALLOW_EXPERIMENTAL_API is not set, right? So RTE_VERIFY(), or its compile-time equivalent, should be in every such function, not just the broken ones.
Quoted 5 lines
Quoted 4 lines
--
David Marchand
Re: [PATCH v2 2/4] bitset: fix build for GCC without experimental API
16/10/2024 18:03, Mattias Rönnblom:
Quoted 47 lines · Morten Brørup
Quoted 46 lines
Quoted 38 lines
From: David Marchand [mailto:[email protected]]
Sent: Wednesday, 16 October 2024 17.37Quoted 11 lines · Mattias Rönnblom
Quoted 9 lines · David Marchand
For a reason similar to the change on bitops header, hide bitset implementation relying on experimental API.
Fixes 99a1197647d8 ("eal: add bitset type")Signed-off-by David Marchand <[email protected]>Acked-by Morten Brørup <[email protected]>--- lib/eal/include/rte_bitset.h | 123+++++++++++++++++++++++++++++++++++
Quoted 3 lines
Review
Quoted 3 lines
1 file changed, 123 insertions(+)(quoted diff) +0
-0
b/lib/eal/include/rte_bitset.hQuoted 8 lines
Quoted 8 lines
index
74c643a72a..8ae8425fc2100644lib/eal/include/rte_bitset.h +1
-0@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API Quoted 8 lines
lib/eal/include/rte_bitset.h __rte_experimental · line 263
Quoted 5 lines
lib/eal/include/rte_bitset.h +4
-0return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +return false;This is no
RTE_VERIFY(0)here, because this is just dummy code, that will never be run. Is that correct?Quoted 2 lines
Adding a
RTE_VERIFY(false)is an interesting idea. It is not supposed to be run, indeed.Great idea.
Quoted 2 lines
Do you prefer I respin with this?
Quoted 8 lines
Quoted 3 lines
No need.
Instead, create a ticket in Bugzilla soRTE_VERIFY(false)goes in everywhere there is dummy code, not just here.No experimental function is supposed to be invoked, if
ALLOW_EXPERIMENTAL_APIis not set, right? SoRTE_VERIFY(), or its compile-time equivalent, should be in every such function, not just the broken ones.
There is no other experimental dummy branch in the current version. I think respin is a good option.
Re: [PATCH v2 2/4] bitset: fix build for GCC without experimental API
In reply to David MarchandQuoted 32 lines · David Marchand
Quoted 22 lines · Mattias Rönnblom
Quoted 20 lines · David Marchand
For a reason similar to the change on bitops header, hide bitset implementation relying on experimental API.
Fixes 99a1197647d8 ("eal: add bitset type")Signed-off-by David Marchand <[email protected]>Acked-by Morten Brørup <[email protected]>--- lib/eal/include/rte_bitset.h | 123 +++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)lib/eal/include/rte_bitset.h +1
-0@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API Quoted 8 lines
lib/eal/include/rte_bitset.h __rte_experimental · line 263
Quoted 5 lines
lib/eal/include/rte_bitset.h +4
-0return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +return false;This is no
RTE_VERIFY(0)here, because this is just dummy code, that will never be run. Is that correct?
Quoted 6 lines
Adding a
RTE_VERIFY(false)is an interesting idea. It is not supposed to be run, indeed.Do you prefer I respin with this?
I reminded myself how ALLOW_EXPERIMENTAL_APIs works. This code may indeed be run. Experimental just generates a compiler warning.
So RTE_VERIFY(0); is needed. You should be able to remove the "return false;" statement.
PATCH v2 3/4 vhost: remove internal vDPA API description from public header
In reply to David Marchandrte_vdpa_relay_vring_used() is an internal symbol which was left behind in the application header when doing the application vs driver API split.
--- lib/vhost/rte_vdpa.h | 17 ----------------- 1 file changed, 17 deletions(-)
lib/vhost/rte_vdpa.h +0 -17
@@ -108,23 +108,6 @@ rte_vdpa_get_features(struct rte_vdpa_device *dev, uint64_t *features);int rte_vdpa_get_protocol_features (struct rte_vdpa_device *dev,uint64_t *features); -/** -* Synchronize the used ring from mediated ring to guest, log dirty -* page for each writeable buffer, caller should handle the used -* ring logging before device stop. -* -* @param vid -* vhost device id -* @param qid -* vhost queue id -* @param vring_m -* mediated virtio ring pointer -* @return -* number of synced used entries on success, -1 on failure -*/ -int -rte_vdpa_relay_vring_used (int vid,uint16_t qid,void *vring_m); -/** * Retrieve names of statistics of a vDPA device. *
Signature · 1 line
2.46.2
Re: [PATCH v2 3/4] vhost: remove internal vDPA API description from public header
Quoted 11 lines · David Marchand
rte_vdpa_relay_vring_used()is an internal symbol which was left behind in the application header when doing the application vs driver API split.Fixes a49f758d1170 ("vhost: split vDPA header file")Signed-off-by David Marchand <[email protected]>--- lib/vhost/rte_vdpa.h | 17 ----------------- 1 file changed, 17 deletions(-)
Good catch!
Thanks,
Maxime
PATCH v2 4/4 buildtools/chkincs: check headers with stable API only
In reply to David MarchandAn exported header should be usable w/ and w/o ALLOW_EXPERIMENTAL_API so that an application that only wants stable API may include it.
Plus, the widely common case is that an application will not use internal API.
Cover those cases but keep the original test.
--- buildtools/chkincs/meson.build | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
buildtools/chkincs/meson.build +25 -2
@@ -12,8 +12,6 @@ gen_c_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cflags = machine_args -cflags += '-DALLOW_EXPERIMENTAL_API' -cflags += '-DALLOW_INTERNAL_API' sources = files('main.c') sources += gen_c_files.process(dpdk_chkinc_headers)
@@ -32,6 +30,18 @@ executable('chkincs', sources, dependencies: deps, install: false) +executable('chkincs-exp', sources, + c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'], + include_directories: includes, + dependencies: deps, + install: false) + +executable('chkincs-all', sources, + c_args: [cflags, '-DALLOW_EXPERIMENTAL_API', '-DALLOW_INTERNAL_API'], + include_directories: includes, + dependencies: deps, + install: false) + # run tests for c++ builds also if not add_languages('cpp', required: false) subdir_done()
@@ -49,3 +59,16 @@ executable('chkincs-cpp', cpp_sources, include_directories: includes, dependencies: deps, install: false) + +executable('chkincs-cpp-exp', cpp_sources, + cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API'], + include_directories: includes, + dependencies: deps, + install: false) + +executable('chkincs-cpp-all', cpp_sources, + cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API', + '-DALLOW_INTERNAL_API'], + include_directories: includes, + dependencies: deps, + install: false)
Signature · 1 line
2.46.2
Quoted 4 lines · David Marchand
We currently check that exported headers are fine with -DALLOW_EXPERIMENTAL_API and -DALLOW_INTERNAL_API.
Quoted 8 lines
Such a check won't catch issues like the one fixed in patch 1, where OVS compilation is broken by the additional of experimental API in a header commonly included in other parts of DPDK.
Ideally, I would like to merge patch 1 in rc1.
The patch 2 is not a real issue (more like the enhanced check would complain about this header).
In any case, I think it would not hurt merging everything now.
Applied patch 1 and 3.
I will respin the series (or come up with a different fix for patch 2) for rc2.
Signature · 1 line
David Marchand
v3 cover Enhance headers check
In reply to David MarchandWe currently check that exported headers are fine with -DALLOW_EXPERIMENTAL_API and -DALLOW_INTERNAL_API.
Such a check won't catch issues when build is broken in the absence of those flags, which is the common case for applications consuming DPDK.
This series adds more coverage.
Signature · 21 lines
David Marchand Changes since v2: - rebased on rc1, - added check when calling rte_bitset without ALLOW_EXPERIMENTAL_API, - added checks (and fixes) on driver specific headers, David Marchand (4): bitset: fix build for GCC without experimental API buildtools/chkincs: check headers with stable API only bus/ifpga: use C linkage where appropriate in driver header buildtools/chkincs: check driver specific headers buildtools/chkincs/meson.build | 30 +++++- drivers/bus/ifpga/bus_ifpga_driver.h | 8 +- drivers/meson.build | 1 + lib/eal/include/rte_bitset.h | 132 +++++++++++++++++++++++++++ 4 files changed, 165 insertions(+), 6 deletions(-) -- 2.46.2
PATCH v3 1/4 bitset: fix build for GCC without experimental API
For a reason similar to the change on bitops header, hide bitset implementation relying on experimental API.
---
Changes since v2:
- added a runtime assert so that an application won't call those experimental APIs,
--- lib/eal/include/rte_bitset.h | 132 +++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+)
lib/eal/include/rte_bitset.h +132 -0
@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_VERIFY (false); +#endif }/**
@@ -277,7 +283,13 @@ __rte_experimentalstatic inline void rte_bitset_set (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_set, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_VERIFY (false); +#endif }/**
@@ -299,7 +311,13 @@ __rte_experimentalstatic inline void rte_bitset_clear (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_clear, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_VERIFY (false); +#endif }/**
@@ -323,7 +341,14 @@ __rte_experimentalstatic inline void rte_bitset_assign (uint64_t *bitset,size_t bit_num,bool bit_value) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_assign, bitset, bit_num, bit_value); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (bit_value); +RTE_VERIFY (false); +#endif }/**
@@ -345,7 +370,13 @@ __rte_experimentalstatic inline void rte_bitset_flip (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_flip, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_VERIFY (false); +#endif }/**
@@ -370,7 +401,14 @@ __rte_experimentalstatic inline bool rte_bitset_atomic_test (const uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE_N (rte_bit_atomic_test, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +RTE_VERIFY (false); +#endif }/**
@@ -399,7 +437,14 @@ __rte_experimentalstatic inline void rte_bitset_atomic_set (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_set, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +RTE_VERIFY (false); +#endif }/**
@@ -428,7 +473,14 @@ __rte_experimentalstatic inline void rte_bitset_atomic_clear (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_clear, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +RTE_VERIFY (false); +#endif }/**
@@ -459,7 +511,15 @@ __rte_experimentalstatic inline void rte_bitset_atomic_assign (uint64_t *bitset,size_t bit_num,bool bit_value,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_assign, bitset, bit_num, bit_value, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (bit_value); +RTE_SET_USED (memory_order); +RTE_VERIFY (false); +#endif }/**
@@ -488,7 +548,14 @@ __rte_experimentalstatic inline void rte_bitset_atomic_flip (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_flip, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +RTE_VERIFY (false); +#endif }/**
@@ -524,7 +591,13 @@ __rte_experimentalstatic inline void rte_bitset_clear_all (uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API rte_bitset_init (bitset, size); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_VERIFY (false); +#endif }/**
@@ -576,7 +649,13 @@ __rte_experimentalstatic inline size_t rte_bitset_count_clear (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return size -rte_bitset_count_set (bitset, size); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_VERIFY (false); +#endif }#define __RTE_BITSET_FIND_FLAG_FIND_CLEAR (1U << 0)
@@ -635,6 +714,7 @@ static inline ssize_t __rte_bitset_find(const uint64_t *bitset, size_t size, size_t start_bit, size_t len, unsigned int flags) { +#ifdef ALLOW_EXPERIMENTAL_API bool find_clear = flags & __RTE_BITSET_FIND_FLAG_FIND_CLEAR;bool may_wrap = flags & __RTE_BITSET_FIND_FLAG_WRAP;bool does_wrap = (start_bit + len) > size;
@@ -655,6 +735,14 @@ __rte_bitset_find(const uint64_t *bitset, size_t size, size_t start_bit, size_t rc =__rte_bitset_find_nowrap (bitset, size, start_bit, len, find_clear);return rc; +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +RTE_SET_USED (flags); +RTE_VERIFY (false); +#endif }/**
@@ -678,7 +766,13 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_first_set (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size,0 , size,0 ); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_VERIFY (false); +#endif }/**
@@ -708,7 +802,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_set (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len,0 ); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +RTE_VERIFY (false); +#endif }/**
@@ -739,7 +841,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_set_wrap (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_WRAP); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +RTE_VERIFY (false); +#endif }/**
@@ -763,7 +873,13 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_first_clear (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size,0 , size, __RTE_BITSET_FIND_FLAG_FIND_CLEAR); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_VERIFY (false); +#endif }/**
@@ -793,7 +909,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_clear (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_FIND_CLEAR); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +RTE_VERIFY (false); +#endif }/**
@@ -824,8 +948,16 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_clear_wrap (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_FIND_CLEAR | __RTE_BITSET_FIND_FLAG_WRAP); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +RTE_VERIFY (false); +#endif }/**
Signature · 1 line
2.46.2
Re: [PATCH v3 1/4] bitset: fix build for GCC without experimental API
Quoted 300 lines · David Marchand
For a reason similar to the change on bitops header, hide bitset implementation relying on experimental API.
Fixes 99a1197647d8 ("eal: add bitset type")Signed-off-by David Marchand <[email protected]>---
Changes since v2:
- added a runtime assert so that an application won't call those experimental APIs,--- lib/eal/include/rte_bitset.h | 132 +++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+)lib/eal/include/rte_bitset.h +125
-0@@ -255,7 +255,13 @@ __rte_experimentalstatic inline bool rte_bitset_test (const uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE (rte_bit_test, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_VERIFY (false); +#endif }/** @@ -277,7 +283,13 @@ __rte_experimentalstatic inline void rte_bitset_set (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_set, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_VERIFY (false); +#endif }/** @@ -299,7 +311,13 @@ __rte_experimentalstatic inline void rte_bitset_clear (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_clear, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_VERIFY (false); +#endif }/** @@ -323,7 +341,14 @@ __rte_experimentalstatic inline void rte_bitset_assign (uint64_t *bitset,size_t bit_num,bool bit_value) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_assign, bitset, bit_num, bit_value); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (bit_value); +RTE_VERIFY (false); +#endif }/** @@ -345,7 +370,13 @@ __rte_experimentalstatic inline void rte_bitset_flip (uint64_t *bitset,size_t bit_num) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE (rte_bit_flip, bitset, bit_num); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_VERIFY (false); +#endif }/** @@ -370,7 +401,14 @@ __rte_experimentalstatic inline bool rte_bitset_atomic_test (const uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API return __RTE_BITSET_DELEGATE_N (rte_bit_atomic_test, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +RTE_VERIFY (false); +#endif }/** @@ -399,7 +437,14 @@ __rte_experimentalstatic inline void rte_bitset_atomic_set (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_set, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +RTE_VERIFY (false); +#endif }/** @@ -428,7 +473,14 @@ __rte_experimentalstatic inline void rte_bitset_atomic_clear (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_clear, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +RTE_VERIFY (false); +#endif }/** @@ -459,7 +511,15 @@ __rte_experimentalstatic inline void rte_bitset_atomic_assign (uint64_t *bitset,size_t bit_num,bool bit_value,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_assign, bitset, bit_num, bit_value, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (bit_value); +RTE_SET_USED (memory_order); +RTE_VERIFY (false); +#endif }/** @@ -488,7 +548,14 @@ __rte_experimentalstatic inline void rte_bitset_atomic_flip (uint64_t *bitset,size_t bit_num,int memory_order) { +#ifdef ALLOW_EXPERIMENTAL_API __RTE_BITSET_DELEGATE_N (rte_bit_atomic_flip, bitset, bit_num, memory_order); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (bit_num); +RTE_SET_USED (memory_order); +RTE_VERIFY (false); +#endif }/** @@ -524,7 +591,13 @@ __rte_experimentalstatic inline void rte_bitset_clear_all (uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API rte_bitset_init (bitset, size); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_VERIFY (false); +#endif }/** @@ -576,7 +649,13 @@ __rte_experimentalstatic inline size_t rte_bitset_count_clear (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return size -rte_bitset_count_set (bitset, size); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_VERIFY (false); +#endif }#define __RTE_BITSET_FIND_FLAG_FIND_CLEAR (1U << 0)@@ -635,6 +714,7 @@ static inline ssize_t __rte_bitset_find(const uint64_t *bitset, size_t size, size_t start_bit, size_t len, unsigned int flags) { +#ifdef ALLOW_EXPERIMENTAL_API bool find_clear = flags & __RTE_BITSET_FIND_FLAG_FIND_CLEAR;bool may_wrap = flags & __RTE_BITSET_FIND_FLAG_WRAP;bool does_wrap = (start_bit + len) > size;@@ -655,6 +735,14 @@ __rte_bitset_find(const uint64_t *bitset, size_t size, size_t start_bit, size_t rc =__rte_bitset_find_nowrap (bitset, size, start_bit, len, find_clear);return rc; +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +RTE_SET_USED (flags); +RTE_VERIFY (false); +#endif }/** @@ -678,7 +766,13 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_first_set (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size,0 , size,0 ); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_VERIFY (false); +#endif }/** @@ -708,7 +802,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_set (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len,0 ); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +RTE_VERIFY (false); +#endif }/** @@ -739,7 +841,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_set_wrap (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_WRAP); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +RTE_VERIFY (false); +#endif }/** @@ -763,7 +873,13 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_first_clear (const uint64_t *bitset,size_t size) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size,0 , size, __RTE_BITSET_FIND_FLAG_FIND_CLEAR); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_VERIFY (false); +#endif }/** @@ -793,7 +909,15 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_clear (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_FIND_CLEAR); +#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +RTE_VERIFY (false); +#endif }/** @@ -824,8 +948,16 @@ __rte_experimentalstatic inline ssize_t rte_bitset_find_clear_wrap (const uint64_t *bitset,size_t size,size_t start_bit,size_t len) { +#ifdef ALLOW_EXPERIMENTAL_API return __rte_bitset_find (bitset, size, start_bit, len, __RTE_BITSET_FIND_FLAG_FIND_CLEAR | __RTE_BITSET_FIND_FLAG_WRAP);
lib/eal/include/rte_bitset.h __rte_experimental · line 963
Quoted 10 lines
lib/eal/include/rte_bitset.h +7
-0+#else +RTE_SET_USED (bitset); +RTE_SET_USED (size); +RTE_SET_USED (start_bit); +RTE_SET_USED (len); +RTE_VERIFY (false); +#endif }/**
PATCH v3 2/4 buildtools/chkincs: check headers with stable API only
In reply to David MarchandAn exported header should be usable w/ and w/o ALLOW_EXPERIMENTAL_API so that an application that only wants stable API may include it.
Plus, the widely common case is that an application will not use internal API.
Cover those cases but keep the original test.
--- buildtools/chkincs/meson.build | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
buildtools/chkincs/meson.build +25 -2
@@ -12,8 +12,6 @@ gen_c_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cflags = machine_args -cflags += '-DALLOW_EXPERIMENTAL_API' -cflags += '-DALLOW_INTERNAL_API' sources = files('main.c') sources += gen_c_files.process(dpdk_chkinc_headers)
@@ -32,6 +30,18 @@ executable('chkincs', sources, dependencies: deps, install: false) +executable('chkincs-exp', sources, + c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'], + include_directories: includes, + dependencies: deps, + install: false) + +executable('chkincs-all', sources, + c_args: [cflags, '-DALLOW_EXPERIMENTAL_API', '-DALLOW_INTERNAL_API'], + include_directories: includes, + dependencies: deps, + install: false) + # run tests for c++ builds also if not add_languages('cpp', required: false) subdir_done()
@@ -49,3 +59,16 @@ executable('chkincs-cpp', cpp_sources, include_directories: includes, dependencies: deps, install: false) + +executable('chkincs-cpp-exp', cpp_sources, + cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API'], + include_directories: includes, + dependencies: deps, + install: false) + +executable('chkincs-cpp-all', cpp_sources, + cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API', + '-DALLOW_INTERNAL_API'], + include_directories: includes, + dependencies: deps, + install: false)
Signature · 1 line
2.46.2
Re: [PATCH v3 2/4] buildtools/chkincs: check headers with stable API only
Quoted 10 lines · David Marchand
An exported header should be usable w/ and w/o
ALLOW_EXPERIMENTAL_APIso that an application that only wants stable API may include it.Plus, the widely common case is that an application will not use internal API.
Cover those cases but keep the original test.
Signed-off-by David Marchand <[email protected]>---
PATCH v3 3/4 bus/ifpga: use C linkage where appropriate in driver header
In reply to David MarchandThis driver was missed when cleaning up most of the headers.
--- drivers/bus/ifpga/bus_ifpga_driver.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/bus/ifpga/bus_ifpga_driver.h +4 -4
@@ -11,16 +11,16 @@* RTE Intel FPGA Bus Interface */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ -#include <rte_compat.h> #include <dev_driver.h> #include <rte_pci.h> #include <rte_interrupts.h> #include <rte_spinlock.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#define IFPGA_BUS_NAME ifpga/* Forward declarations */
Signature · 1 line
2.46.2
Re: [PATCH v3 3/4] bus/ifpga: use C linkage where appropriate in driver header
Quoted 24 lines · David Marchand
This driver was missed when cleaning up most of the headers.
Fixes 719834a6849e ("use C linkage where appropriate in headers")Signed-off-by David Marchand <[email protected]>--- drivers/bus/ifpga/bus_ifpga_driver.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/bus/ifpga/bus_ifpga_driver.h +0
-4@@ -11,16 +11,16 @@* RTE Intel FPGA Bus Interface */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ -#include <rte_compat.h> #include <dev_driver.h> #include <rte_pci.h>
drivers/bus/ifpga/bus_ifpga_driver.h line 26
Quoted 10 lines
drivers/bus/ifpga/bus_ifpga_driver.h +4
-0#include <rte_interrupts.h> #include <rte_spinlock.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#define IFPGA_BUS_NAME ifpga/* Forward declarations */
My effort was limited to the headers passed to chkincs, which I'm guessing is the public API headers.
Internal headers shouldn't have any #ifdef __cpluspus at all, anywhere.
Re: [PATCH v3 3/4] bus/ifpga: use C linkage where appropriate in driver header
Quoted 35 lines · Mattias Rönnblom
Quoted 33 lines · David Marchand
This driver was missed when cleaning up most of the headers.
Fixes 719834a6849e ("use C linkage where appropriate in headers")Signed-off-by David Marchand <[email protected]>--- drivers/bus/ifpga/bus_ifpga_driver.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/bus/ifpga/bus_ifpga_driver.h +4
-4@@ -11,16 +11,16 @@* RTE Intel FPGA Bus Interface */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ -#include <rte_compat.h> #include <dev_driver.h> #include <rte_pci.h> #include <rte_interrupts.h> #include <rte_spinlock.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#define IFPGA_BUS_NAME ifpga
Quoted 4 lines
drivers/bus/ifpga/bus_ifpga_driver.h line 26
Quoted 1 line
drivers/bus/ifpga/bus_ifpga_driver.h +0
-0/* Forward declarations */ My effort was limited to the headers passed to chkincs, which I'm guessing is the public API headers.
There were many headers that got changed in commit 719834a6849e ("use C linkage where appropriate in headers") while not being in the exported headers list, which is what chkincs checks.
For example,
$ git show --stat 719834a6849e | grep raw/ifpga drivers/raw/ifpga/afu_pmd_core.h | 8 ++++---- drivers/raw/ifpga/afu_pmd_he_hssi.h | 6 +++--- drivers/raw/ifpga/afu_pmd_he_lpbk.h | 6 +++--- drivers/raw/ifpga/afu_pmd_he_mem.h | 6 +++--- drivers/raw/ifpga/afu_pmd_n3000.h | 6 +++--- drivers/raw/ifpga/rte_pmd_afu.h | 4 ++-- drivers/raw/ifpga/rte_pmd_ifpga.h | 4 ++--
$ grep chkincs.*afu build/build.ninja
Quoted 3 lines
Internal headers shouldn't have any #ifdef
__cpluspusat all, anywhere.
Internal headers, I agree, though commit 719834a6849e ("use C linkage where appropriate in headers") did change some.
For drivers headers that are exported, it is another story, some people seem to like C++ for writing out of tree drivers. And this is what this patch of mine is about.
Signature · 1 line
David Marchand
PATCH v3 4/4 buildtools/chkincs: check driver specific headers
In reply to David MarchandOnly driver headers exported by libraries were checked. Add driver specific headers to the checked headers list.
This reveals a small issue with the vmbus driver header as some driver headers rely on it.
--- buildtools/chkincs/meson.build | 3 +++ drivers/meson.build | 1 + 2 files changed, 4 insertions(+)
buildtools/chkincs/meson.build +3 -0
@@ -19,6 +19,9 @@ sources += gen_c_files.process(dpdk_chkinc_headers) # some driver SDK headers depend on these two buses, which are mandatory in build # so we always include them in deps list deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')] +if dpdk_conf.has('RTE_BUS_VMBUS') + deps += get_variable('shared_rte_bus_vmbus') +endif # add the rest of the libs to the dependencies foreach l:dpdk_libs_enabled deps += get_variable('shared_rte_' + l)
drivers/meson.build +1 -0
@@ -220,6 +220,7 @@ foreach subpath:subdirs if get_option('enable_driver_sdk') install_headers(driver_sdk_headers) endif + dpdk_chkinc_headers += driver_sdk_headers if headers.length() > 0 dpdk_includes += include_directories(drv_path)
Signature · 1 line
2.46.2
For the series,
Quoted 8 lines · David Marchand
We currently check that exported headers are fine with -DALLOW_EXPERIMENTAL_API and -DALLOW_INTERNAL_API.
Such a check won't catch issues when build is broken in the absence of those flags, which is the common case for applications consuming DPDK.
This series adds more coverage.
Series applied, thanks.
Signature · 1 line
David Marchand