From: "Mattias Rönnblom" <hofors@lysator.liu.se>
To: David Marchand <david.marchand@redhat.com>,
mattias.ronnblom@ericsson.com
Cc: dev@dpdk.org, mb@smartsharesystems.com,
stephen@networkplumber.org, harry.van.haaren@intel.com,
roretzla@linux.microsoft.com,
Thomas Monjalon <thomas@monjalon.net>
Subject: Re: [PATCH v2 1/4] eal: add bitset type
Date: Wed, 16 Oct 2024 15:37:21 +0200 [thread overview]
Message-ID: <140afca3-c2f6-4f37-94c0-6059ba45113b@lysator.liu.se> (raw)
In-Reply-To: <CAJFAV8ww3eO1Gz0L8D92DeK5DUzvKv0s16hHZDw9zXZT+tLVkw@mail.gmail.com>
On 2024-10-16 13:30, David Marchand wrote:
> On Thu, Oct 10, 2024 at 10:30 AM David Marchand
> <david.marchand@redhat.com> wrote:
>> diff --git a/lib/eal/include/rte_bitset.h b/lib/eal/include/rte_bitset.h
>> new file mode 100644
>> index 0000000000..b2d71aa7c6
>> --- /dev/null
>> +++ b/lib/eal/include/rte_bitset.h
>
> [snip]
>
>> +__rte_experimental
>> +static inline ssize_t
>> +__rte_bitset_find_nowrap(const uint64_t *bitset, size_t __rte_unused size, size_t start_bit,
>> + size_t len, bool find_clear)
>> +{
>> + size_t word_idx;
>> + size_t offset;
>> + size_t end_bit = start_bit + len;
>> +
>> + RTE_ASSERT(end_bit <= size);
>> +
>> + if (unlikely(len == 0))
>> + return -1;
>> +
>> + word_idx = __RTE_BITSET_WORD_IDX(start_bit);
>> + offset = __RTE_BITSET_BIT_OFFSET(start_bit);
>> +
>> + while (word_idx <= __RTE_BITSET_WORD_IDX(end_bit - 1)) {
>> + uint64_t word;
>> + int word_ffs;
>> +
>> + word = bitset[word_idx];
>> + if (find_clear)
>> + word = ~word;
>> +
>> + word >>= offset;
>> +
>> + word_ffs = __builtin_ffsll(word);
>> +
>> + if (word_ffs != 0) {
>> + ssize_t ffs = start_bit + word_ffs - 1;
>> +
>> + /*
>> + * Check if set bit were among the last,
>> + * unused bits, in the last word.
>> + */
>> + if (unlikely(ffs >= (ssize_t)end_bit))
>> + return -1;
>> +
>> + return ffs;
>> + }
>> +
>> + start_bit += (RTE_BITSET_WORD_BITS - offset);
>> + word_idx++;
>> + offset = 0;
>> + }
>> +
>> + return -1;
>> +
>> +}
>
> Now that the series is merged, we finally got one report from UNH and
> this patch breaks MSVC build.
>
> FAILED: lib/librte_eal.a.p/eal_common_rte_bitset.c.obj
> "cl" "-Ilib\librte_eal.a.p" "-Ilib" "-I..\lib" "-I." "-I.." "-Iconfig"
> "-I..\config" "-Ilib\eal\include" "-I..\lib\eal\include"
> "-Ilib\eal\windows\include" "-I..\lib\eal\windows\include"
> "-Ilib\eal\x86\include" "-I..\lib\eal\x86\include" "-Ilib\eal\common"
> "-I..\lib\eal\common" "-Ilib\eal" "-I..\lib\eal" "-Ilib\log"
> "-I..\lib\log" "-Ilib\kvargs" "-I..\lib\kvargs" "-IC:\Program
> Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc" "/MD" "/nologo"
> "/showIncludes" "/W3" "/WX" "/std:c11" "/O2" "/Gw" "/wd4244" "/wd4267"
> "/wd4146" "/experimental:c11atomics" "/d1experimental:typeof"
> "/experimental:statementExpressions" "/FI" "rte_config.h"
> "-D_GNU_SOURCE" "-D_WIN32_WINNT=0x0A00" "-DALLOW_EXPERIMENTAL_API"
> "-DALLOW_INTERNAL_API" "-DABI_VERSION=\"25.0\""
> "-DRTE_LOG_DEFAULT_LOGTYPE=lib.eal"
> "/Fdlib\librte_eal.a.p\eal_common_rte_bitset.c.pdb"
> /Folib/librte_eal.a.p/eal_common_rte_bitset.c.obj "/c"
> ../lib/eal/common/rte_bitset.c
> ..\lib\eal\include\rte_bitset.h(612): error C2220: the following
> warning is treated as an error
> ..\lib\eal\include\rte_bitset.h(612): warning C4013: '__builtin_ffsll'
> undefined; assuming extern returning int
>
>
> I see two options:
> - rewrite this code and use existing rte_ctz64 or rte_bsf64_safe,
> - introduce an additional rte_ffs64() in rte_bitops.h and implement it
> for MSVC and others,
>
> And I would prefer we extend checkpatch, so that such issue is caught earlier.
> See:
> devtools/checkpatches.sh: -v
> EXPRESSIONS='\\<__builtin_(clz|clzll|ctz|ctzll|popcount|popcountll)\\>'
> \
>
> Please send a fix.
>
>
Will do.
next prev parent reply other threads:[~2024-10-16 13:37 UTC|newest]
Thread overview: 114+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-31 13:13 [RFC v3] " Mattias Rönnblom
2024-01-31 16:02 ` Stephen Hemminger
2024-01-31 16:28 ` Mattias Rönnblom
2024-01-31 16:06 ` Stephen Hemminger
2024-01-31 18:45 ` Mattias Rönnblom
2024-02-01 8:04 ` Morten Brørup
2024-02-02 10:19 ` Mattias Rönnblom
2024-02-02 12:42 ` Morten Brørup
2024-02-16 10:23 ` [RFC v4 1/4] " Mattias Rönnblom
2024-02-16 10:23 ` [RFC v4 2/4] eal: add bitset test suite Mattias Rönnblom
2024-02-16 10:23 ` [RFC v4 3/4] service: use multi-word bitset to represent service flags Mattias Rönnblom
2024-02-16 10:23 ` [RFC v4 4/4] event/dsw: optimize serving port logic Mattias Rönnblom
2024-05-05 7:33 ` [RFC v5 1/6] eal: add bitset type Mattias Rönnblom
2024-05-05 7:33 ` [RFC v5 2/6] eal: add bitset test suite Mattias Rönnblom
2024-05-05 7:33 ` [RFC v5 3/6] eal: add atomic bitset functions Mattias Rönnblom
2024-05-05 7:33 ` [RFC v5 4/6] eal: add unit tests for atomic bitset operations Mattias Rönnblom
2024-05-05 7:33 ` [RFC v5 5/6] service: use multi-word bitset to represent service flags Mattias Rönnblom
2024-05-05 7:33 ` [RFC v5 6/6] event/dsw: optimize serving port logic Mattias Rönnblom
2024-08-09 20:14 ` [PATCH 1/6] eal: add bitset type Mattias Rönnblom
2024-08-09 20:14 ` [PATCH 2/6] eal: add bitset test suite Mattias Rönnblom
2024-09-12 4:51 ` Tyler Retzlaff
2024-08-09 20:14 ` [PATCH 3/6] eal: add atomic bitset functions Mattias Rönnblom
2024-09-12 4:51 ` Tyler Retzlaff
2024-08-09 20:14 ` [PATCH 4/6] eal: add unit tests for atomic bitset operations Mattias Rönnblom
2024-09-12 4:52 ` Tyler Retzlaff
2024-10-09 20:29 ` Morten Brørup
2024-08-09 20:14 ` [PATCH 5/6] service: use multi-word bitset to represent service flags Mattias Rönnblom
2024-09-12 4:52 ` Tyler Retzlaff
2024-08-09 20:14 ` [PATCH 6/6] event/dsw: add support for larger port count Mattias Rönnblom
2024-09-12 4:53 ` Tyler Retzlaff
2024-08-20 17:09 ` [PATCH 1/6] eal: add bitset type Mattias Rönnblom
2024-09-02 13:55 ` Morten Brørup
2024-09-02 14:46 ` Mattias Rönnblom
2024-09-02 14:49 ` Mattias Rönnblom
2024-09-12 4:51 ` Tyler Retzlaff
2024-09-17 9:36 ` [PATCH v7 0/6] Improve EAL bit operations API Mattias Rönnblom
2024-09-17 9:36 ` [PATCH v7 1/6] dpdk: do not force C linkage on include file dependencies Mattias Rönnblom
2024-09-17 10:48 ` [PATCH v8 0/6] Improve EAL bit operations API Mattias Rönnblom
2024-09-17 10:48 ` [PATCH v8 1/6] dpdk: do not force C linkage on include file dependencies Mattias Rönnblom
2024-09-18 9:04 ` [PATCH v9 0/6] Improve EAL bit operations API Mattias Rönnblom
2024-09-18 9:04 ` [PATCH v9 1/6] dpdk: do not force C linkage on include file dependencies Mattias Rönnblom
2024-09-19 19:31 ` [PATCH v10 0/7] Improve EAL bit operations API Mattias Rönnblom
2024-09-19 19:31 ` [PATCH v10 1/7] buildtools/chkincs: relax C linkage requirement Mattias Rönnblom
2024-09-20 6:24 ` [PATCH v11 0/7] Improve EAL bit operations API Mattias Rönnblom
2024-09-20 6:24 ` [PATCH v11 1/7] buildtools/chkincs: relax C linkage requirement Mattias Rönnblom
2024-09-20 10:47 ` [PATCH v12 0/7] Improve EAL bit operations API Mattias Rönnblom
2024-09-20 10:47 ` [PATCH v12 1/7] buildtools/chkincs: relax C linkage requirement Mattias Rönnblom
2024-10-03 16:47 ` Robin Jarry
2024-10-04 7:31 ` Mattias Rönnblom
2024-10-04 8:05 ` Robin Jarry
2024-10-04 8:40 ` Mattias Rönnblom
2024-10-04 11:51 ` Robin Jarry
2024-10-04 12:19 ` Thomas Monjalon
2024-10-06 8:55 ` Mattias Rönnblom
2024-10-06 9:47 ` Mattias Rönnblom
2024-10-06 12:25 ` Robin Jarry
2024-10-06 13:09 ` Robin Jarry
2024-10-06 14:17 ` Mattias Rönnblom
2024-10-06 15:58 ` Robin Jarry
2024-10-10 10:24 ` Mattias Rönnblom
2024-10-10 10:39 ` Bruce Richardson
2024-09-20 10:47 ` [PATCH v12 2/7] dpdk: use C linkage only where appropriate Mattias Rönnblom
2024-09-20 10:47 ` [PATCH v12 3/7] eal: extend bit manipulation functionality Mattias Rönnblom
2024-09-20 10:47 ` [PATCH v12 4/7] eal: add unit tests for bit operations Mattias Rönnblom
2024-09-20 10:47 ` [PATCH v12 5/7] eal: add atomic " Mattias Rönnblom
2024-09-20 10:47 ` [PATCH v12 6/7] eal: add unit tests for atomic bit access functions Mattias Rönnblom
2024-10-10 10:45 ` David Marchand
2024-10-10 11:55 ` Mattias Rönnblom
2024-10-10 12:14 ` David Marchand
2024-10-10 12:35 ` Mattias Rönnblom
2024-10-10 13:07 ` Thomas Monjalon
2024-10-11 8:35 ` David Marchand
2024-10-11 15:06 ` Morten Brørup
2024-10-11 15:11 ` David Marchand
2024-10-11 15:15 ` Morten Brørup
2024-10-11 15:18 ` David Marchand
2024-09-20 10:47 ` [PATCH v12 7/7] eal: extend bitops to handle volatile pointers Mattias Rönnblom
2024-10-09 20:18 ` [PATCH v12 0/7] Improve EAL bit operations API David Marchand
2024-09-20 6:24 ` [PATCH v11 2/7] dpdk: use C linkage only where appropriate Mattias Rönnblom
2024-09-20 6:24 ` [PATCH v11 3/7] eal: extend bit manipulation functionality Mattias Rönnblom
2024-09-20 6:24 ` [PATCH v11 4/7] eal: add unit tests for bit operations Mattias Rönnblom
2024-09-20 6:24 ` [PATCH v11 5/7] eal: add atomic " Mattias Rönnblom
2024-09-20 6:24 ` [PATCH v11 6/7] eal: add unit tests for atomic bit access functions Mattias Rönnblom
2024-09-20 6:24 ` [PATCH v11 7/7] eal: extend bitops to handle volatile pointers Mattias Rönnblom
2024-09-19 19:31 ` [PATCH v10 2/7] dpdk: use C linkage only where appropriate Mattias Rönnblom
2024-09-19 19:31 ` [PATCH v10 3/7] eal: extend bit manipulation functionality Mattias Rönnblom
2024-09-19 19:31 ` [PATCH v10 4/7] eal: add unit tests for bit operations Mattias Rönnblom
2024-09-19 19:31 ` [PATCH v10 5/7] eal: add atomic " Mattias Rönnblom
2024-09-19 19:31 ` [PATCH v10 6/7] eal: add unit tests for atomic bit access functions Mattias Rönnblom
2024-09-19 19:31 ` [PATCH v10 7/7] eal: extend bitops to handle volatile pointers Mattias Rönnblom
2024-09-18 9:04 ` [PATCH v9 2/6] eal: extend bit manipulation functionality Mattias Rönnblom
2024-09-18 9:04 ` [PATCH v9 3/6] eal: add unit tests for bit operations Mattias Rönnblom
2024-09-18 9:04 ` [PATCH v9 4/6] eal: add atomic " Mattias Rönnblom
2024-09-18 9:04 ` [PATCH v9 5/6] eal: add unit tests for atomic bit access functions Mattias Rönnblom
2024-09-18 9:04 ` [PATCH v9 6/6] eal: extend bitops to handle volatile pointers Mattias Rönnblom
2024-09-17 10:48 ` [PATCH v8 2/6] eal: extend bit manipulation functionality Mattias Rönnblom
2024-09-17 10:48 ` [PATCH v8 3/6] eal: add unit tests for bit operations Mattias Rönnblom
2024-09-17 10:48 ` [PATCH v8 4/6] eal: add atomic " Mattias Rönnblom
2024-09-17 10:48 ` [PATCH v8 5/6] eal: add unit tests for atomic bit access functions Mattias Rönnblom
2024-09-17 10:48 ` [PATCH v8 6/6] eal: extend bitops to handle volatile pointers Mattias Rönnblom
2024-09-17 9:36 ` [PATCH v7 2/6] eal: extend bit manipulation functionality Mattias Rönnblom
2024-09-17 9:36 ` [PATCH v7 3/6] eal: add unit tests for bit operations Mattias Rönnblom
2024-09-17 9:36 ` [PATCH v7 4/6] eal: add atomic " Mattias Rönnblom
2024-09-17 9:36 ` [PATCH v7 5/6] eal: add unit tests for atomic bit access functions Mattias Rönnblom
2024-09-17 9:36 ` [PATCH v7 6/6] eal: extend bitops to handle volatile pointers Mattias Rönnblom
2024-10-10 8:30 ` [PATCH v2 0/4] Add bitset type David Marchand
2024-10-10 8:30 ` [PATCH v2 1/4] eal: add " David Marchand
2024-10-11 9:35 ` Mattias Rönnblom
2024-10-16 11:30 ` David Marchand
2024-10-16 13:37 ` Mattias Rönnblom [this message]
2024-10-10 8:30 ` [PATCH v2 2/4] bitset: add atomic functions David Marchand
2024-10-10 8:30 ` [PATCH v2 3/4] service: use multi-word bitset to represent service flags David Marchand
2024-10-10 8:30 ` [PATCH v2 4/4] event/dsw: add support for larger port count David Marchand
2024-10-14 15:08 ` [PATCH v2 0/4] Add bitset type David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=140afca3-c2f6-4f37-94c0-6059ba45113b@lysator.liu.se \
--to=hofors@lysator.liu.se \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=harry.van.haaren@intel.com \
--cc=mattias.ronnblom@ericsson.com \
--cc=mb@smartsharesystems.com \
--cc=roretzla@linux.microsoft.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).