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 BF31545B4D; Wed, 16 Oct 2024 13:31:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 913F4400D6; Wed, 16 Oct 2024 13:31:15 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 1F13F400D5 for ; Wed, 16 Oct 2024 13:31:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729078273; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b7kUnHMp0LktXe9H3HNbxmHyhyekUHqwT4EhxMA6cDU=; b=eW0PFKpKrPYcmQsGa47DRNelv2nXpMN7BpiFhFLLjrBK3ctMYQOqqeKxL9ED/VuPnH+8x4 krddDLVrty5mTBGafaQYzhRfRS99mLOnESBvmwL56RuEC40qpHqtQQGFNIIBf2uzVTAQHj jFFG6QV3bQ4n9YcdffdYNdvIUgVxvcI= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-345-wTSIBPjfMyKoVTq8Fcnc0w-1; Wed, 16 Oct 2024 07:31:12 -0400 X-MC-Unique: wTSIBPjfMyKoVTq8Fcnc0w-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2fb58c0df21so17114921fa.2 for ; Wed, 16 Oct 2024 04:31:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729078271; x=1729683071; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b7kUnHMp0LktXe9H3HNbxmHyhyekUHqwT4EhxMA6cDU=; b=AdyO3Ui7i7QhwIvBqfFXIjPdJE3QOJ/QsluE0BhrTwmSXYjsxL4fAIvzS42jg/I/Mn iJsL95Sr8youjDSlr19U5Pg3RceEmnx8Fwz4J+Pgv7Rh2IsV/GmIf5gjTeH2pkhMDqmV 0rY95S3z8PTMOTErLP6wgTLkP3cjBWq0T5vWbay2I7aAT9HU/FHcttI9S8GCZgmXJjPC uCjpeu2IQjz51y89oomMHOKkaxetW6edh1fb3GpBXfwIuahCdi0rQcoTZ3pFmf/1IKWE qoyeRNRKLe8PJ5G/oRxDk1NIkUD69vrRe0iIvACri9Dei66ZxE+Dy+GrshFC+LJTeFQT xYEw== X-Gm-Message-State: AOJu0Ywv+ToG+6rwykHnT8BpPgfuZo89HCM/WCq3xdI1dd/wGJAy8WbU MwpPsDAooEqvjIVpEaWkwaNjxSF37MF1c3bD2IcyKtCM1yAK9rNVqxyNgIPK/2ylGCoqTS2o1Ms WFt66JU+KTC1KDPNrdJwbUWCJYrAVzt1rtZgPrRfEHUtD+1Ok7VJhNj/wr6jrvCbC756UYUuTTm BR6CRR+q7BRwqa/Lw= X-Received: by 2002:a2e:be9d:0:b0:2fb:587d:2ee with SMTP id 38308e7fff4ca-2fb61b46312mr24826881fa.12.1729078271087; Wed, 16 Oct 2024 04:31:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbLo4xcjenRLMI8QnsomXhzE4+CPhLEf5ZzqPucIWOw//BTfQwTzA2HiSCvyY8B8eRebFPGVxiWTm0PRHbSTY= X-Received: by 2002:a2e:be9d:0:b0:2fb:587d:2ee with SMTP id 38308e7fff4ca-2fb61b46312mr24826711fa.12.1729078270662; Wed, 16 Oct 2024 04:31:10 -0700 (PDT) MIME-Version: 1.0 References: <20240809201440.590464-1-mattias.ronnblom@ericsson.com> <20241010083022.3437380-1-david.marchand@redhat.com> <20241010083022.3437380-2-david.marchand@redhat.com> In-Reply-To: <20241010083022.3437380-2-david.marchand@redhat.com> From: David Marchand Date: Wed, 16 Oct 2024 13:30:59 +0200 Message-ID: Subject: Re: [PATCH v2 1/4] eal: add bitset type To: mattias.ronnblom@ericsson.com, =?UTF-8?Q?Mattias_R=C3=B6nnblom?= Cc: dev@dpdk.org, mb@smartsharesystems.com, stephen@networkplumber.org, harry.van.haaren@intel.com, roretzla@linux.microsoft.com, Thomas Monjalon X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Thu, Oct 10, 2024 at 10:30=E2=80=AFAM 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 siz= e, size_t start_bit, > + size_t len, bool find_clear) > +{ > + size_t word_idx; > + size_t offset; > + size_t end_bit =3D start_bit + len; > + > + RTE_ASSERT(end_bit <=3D size); > + > + if (unlikely(len =3D=3D 0)) > + return -1; > + > + word_idx =3D __RTE_BITSET_WORD_IDX(start_bit); > + offset =3D __RTE_BITSET_BIT_OFFSET(start_bit); > + > + while (word_idx <=3D __RTE_BITSET_WORD_IDX(end_bit - 1)) { > + uint64_t word; > + int word_ffs; > + > + word =3D bitset[word_idx]; > + if (find_clear) > + word =3D ~word; > + > + word >>=3D offset; > + > + word_ffs =3D __builtin_ffsll(word); > + > + if (word_ffs !=3D 0) { > + ssize_t ffs =3D start_bit + word_ffs - 1; > + > + /* > + * Check if set bit were among the last, > + * unused bits, in the last word. > + */ > + if (unlikely(ffs >=3D (ssize_t)end_bit)) > + return -1; > + > + return ffs; > + } > + > + start_bit +=3D (RTE_BITSET_WORD_BITS - offset); > + word_idx++; > + offset =3D 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=3D0x0A00" "-DALLOW_EXPERIMENTAL_API" "-DALLOW_INTERNAL_API" "-DABI_VERSION=3D\"25.0\"" "-DRTE_LOG_DEFAULT_LOGTYPE=3Dlib.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 earli= er. See: devtools/checkpatches.sh: -v EXPRESSIONS=3D'\\<__builtin_(clz|clzll|ctz|ctzll|popcount|popcountll)\\>' \ Please send a fix. --=20 David Marchand