From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6BF8745B50; Wed, 16 Oct 2024 15:37:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 288DE40264; Wed, 16 Oct 2024 15:37:27 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id E02C440150 for ; Wed, 16 Oct 2024 15:37:24 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 3146818F20 for ; Wed, 16 Oct 2024 15:37:24 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 2473218EC3; Wed, 16 Oct 2024 15:37:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on hermod.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,AWL, T_SCC_BODY_TEXT_LINE autolearn=disabled version=4.0.0 X-Spam-Score: -1.2 Received: from [192.168.1.85] (h-62-63-215-114.A163.priv.bahnhof.se [62.63.215.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 33FD618F96; Wed, 16 Oct 2024 15:37:22 +0200 (CEST) Message-ID: <140afca3-c2f6-4f37-94c0-6059ba45113b@lysator.liu.se> Date: Wed, 16 Oct 2024 15:37:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/4] eal: add bitset type To: David Marchand , 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 References: <20240809201440.590464-1-mattias.ronnblom@ericsson.com> <20241010083022.3437380-1-david.marchand@redhat.com> <20241010083022.3437380-2-david.marchand@redhat.com> Content-Language: en-US From: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 2024-10-16 13:30, David Marchand wrote: > On Thu, Oct 10, 2024 at 10:30 AM David Marchand > 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.