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 648BA45D13; Fri, 15 Nov 2024 15:45:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F169942FEB; Fri, 15 Nov 2024 15:45:17 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 221FF42F95 for ; Fri, 15 Nov 2024 15:45:16 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 55460206BCDA; Fri, 15 Nov 2024 06:45:15 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 55460206BCDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1731681915; bh=w4s/3yy6n0iOZBDfP7Gd/CEXgcWXpBJK2uqjwpCnrEw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NNvUYNm8blM3l9Oqf4uti2byDnSkTKaOSaKPfb6fKWAfghyhUGzuch0PyTvoqEXbz yzOwupw3nnf4gOrl7wx/HrXKBzoPpwhewRE9RYQZaVG+D4dxElEXr0DSTH9/b0SIbA B7uTGZECMflVCHvNC9zI+50mnsqb9VYzSUVliSHE= Date: Fri, 15 Nov 2024 06:45:15 -0800 From: Andre Muezerie To: David Marchand Cc: dev@dpdk.org, honnappa.nagarahalli@arm.com, doug.foster@arm.com Subject: Re: [PATCH v2] rcu: shift 64-bit constant to avoid implicit 32 to 64 bit conversion Message-ID: <20241115144515.GA31574@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1731448959-18046-1-git-send-email-andremue@linux.microsoft.com> <1731514983-31238-1-git-send-email-andremue@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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 Fri, Nov 15, 2024 at 03:21:42PM +0100, David Marchand wrote: > On Wed, Nov 13, 2024 at 5:24 PM Andre Muezerie > wrote: > > > > ../lib/rcu/rte_rcu_qsbr.c(101): warning C4334: '<<': result of 32-bit > > shift implicitly converted to 64 bits (was 64-bit shift intended?) > > ../lib/rcu/rte_rcu_qsbr.c(107): warning C4334: '<<': result of 32-bit > > shift implicitly converted to 64 bits (was 64-bit shift intended?) > > ../lib/rcu/rte_rcu_qsbr.c(145): warning C4334: '<<': result of 32-bit > > shift implicitly converted to 64 bits (was 64-bit shift intended?) > > > > These warnings are being issued by the MSVC compiler. Since the result is > > being stored in a variable of type uint64_t, it makes sense to shift a > > 64-bit number instead of shifting a 32-bit number and then having the > > compiler to convert the result implicitly to 64 bits. > > UINT64_C was used in the fix as it is the portable way to define a 64-bit > > constant (ULL suffix is architecture dependent). > > > > From reading the code this is also a bugfix: > > (1 << id), where id = thread_id & 0x3f, was wrong when thread_id > 0x1f. > > > > Fixes: 64994b56cfd7 ("rcu: add RCU library supporting QSBR mechanism") > > > > Signed-off-by: Andre Muezerie > > Reviewed-by: Honnappa Nagarahalli > > Reviewed-by: Morten Brørup > > Just a nit, EAL provides a macro: > lib/eal/include/rte_bitops.h:#define RTE_BIT64(nr) (UINT64_C(1) << (nr)) > Ah, nice! Thanks for letting me know. I'll update the patch. > > Does this change allow to build the rcu library with MSVC? > I see it is disabled in meson. You're correct. The rcu is currently not being built for MSVC. I'm fixing the issues and want to include rcu in the MSVC built. I'm doing the same for other parts of the DPDK code and I appreciate the help in reviewing the changes. Thanks! Andre Muezerie > > > -- > David Marchand