From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 81BEF9961 for ; Mon, 31 Jul 2017 18:20:39 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jul 2017 09:20:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,304,1498546800"; d="scan'208";a="999196177" Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75]) by orsmga003.jf.intel.com with ESMTP; 31 Jul 2017 09:20:34 -0700 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.211]) by IRSMSX153.ger.corp.intel.com ([169.254.9.74]) with mapi id 14.03.0319.002; Mon, 31 Jul 2017 17:20:32 +0100 From: "Van Haaren, Harry" To: =?iso-8859-1?Q?Ga=EBtan_Rivet?= CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] service: fix shifts to operate on 64 bit integers Thread-Index: AQHTChYEBnRoMLcvEkKAyI/JalfOxKJuDDAAgAARGQA= Date: Mon, 31 Jul 2017 16:20:31 +0000 Message-ID: References: <1501516707-87024-1-git-send-email-harry.van.haaren@intel.com> <20170731161754.GN11154@bidouze.vm.6wind.com> In-Reply-To: <20170731161754.GN11154@bidouze.vm.6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDAwOTNhMGYtNDExZC00ZjljLTg2NTMtMDg1ZWU1ZDc4YzhmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IlZBNFVLVlB4YzBPRHBZaCtGMkJZWEZoT1A2S2hIOWlcL2hIT2Z6ZDlRS25nPSJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] service: fix shifts to operate on 64 bit integers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 16:20:40 -0000 > From: Ga=EBtan Rivet [mailto:gaetan.rivet@6wind.com] > Sent: Monday, July 31, 2017 5:18 PM > To: Van Haaren, Harry > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] service: fix shifts to operate on 64 bit = integers >=20 > Hi Harry, >=20 > On Mon, Jul 31, 2017 at 04:58:27PM +0100, Harry van Haaren wrote: > > This commit fixes shifts to an integer (1 << shift) which > > is assumed to be a 32-bit integer. In this case, the shift is > > variable and expected to be valid for 64-bit integers. Given that > > the expectation to work with 64 bits exists, we must ensure that > > the (1 << shift) one in that formula is actually a uin64_t. > > > > Simply defining a const uint64_t and using it ensures the compiler > > is aware of the intention. The issue would only manifest if there > > were greater than 31 services registered. > > > > Fixes: 21698354c832 ("service: introduce service cores concept") > > > > Signed-off-by: Harry van Haaren > > --- > > lib/librte_eal/common/rte_service.c | 16 ++++++++++------ > > 1 file changed, 10 insertions(+), 6 deletions(-) > > > > diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/commo= n/rte_service.c > > index e82b9ad..8c1cffa 100644 > > --- a/lib/librte_eal/common/rte_service.c > > +++ b/lib/librte_eal/common/rte_service.c > > @@ -285,8 +285,9 @@ rte_service_unregister(struct rte_service_spec *spe= c) > > > > s->internal_flags &=3D ~(SERVICE_F_REGISTERED); > > > > + const uint64_t one =3D 1; > > for (i =3D 0; i < RTE_MAX_LCORE; i++) > > - lcore_states[i].service_mask &=3D ~(1 << service_id); > > + lcore_states[i].service_mask &=3D ~(one << service_id); >=20 > Why not use UINT64_C(1)? Mostly because I've never heard of it before :) Thanks for review, still le= arnin' every day! Sending v2's every other day...