From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 98C8A1BAE6 for ; Fri, 11 Jan 2019 20:27:29 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jan 2019 11:27:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,466,1539673200"; d="scan'208";a="117412502" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga003.jf.intel.com with ESMTP; 11 Jan 2019 11:27:28 -0800 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 11 Jan 2019 11:27:27 -0800 Received: from fmsmsx108.amr.corp.intel.com ([169.254.9.99]) by FMSMSX125.amr.corp.intel.com ([169.254.2.19]) with mapi id 14.03.0415.000; Fri, 11 Jan 2019 11:27:27 -0800 From: "Eads, Gage" To: "Richardson, Bruce" , "Burakov, Anatoly" CC: "dev@dpdk.org" , "olivier.matz@6wind.com" , "arybchenko@solarflare.com" , "Ananyev, Konstantin" Thread-Topic: [dpdk-dev] [PATCH 1/6] ring: change head and tail to pointer-width size Thread-Index: AQHUqZoLSGNAhgPQUEq3X66uBo4z+qWqbCkAgAAI1QCAAAfzgP//8yQA Date: Fri, 11 Jan 2019 19:27:27 +0000 Message-ID: <9184057F7FC11744A2107296B6B8EB1E541C4C91@FMSMSX108.amr.corp.intel.com> References: <20190110210122.24889-1-gage.eads@intel.com> <20190110210122.24889-2-gage.eads@intel.com> <20190111105848.GA18132@bricha3-MOBL.ger.corp.intel.com> <9b215f62-55e3-5ffd-d163-0a8c9e7fa55a@intel.com> <20190111115851.GC3336@bricha3-MOBL.ger.corp.intel.com> In-Reply-To: <20190111115851.GC3336@bricha3-MOBL.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNGQ2YTQ0ZDQtNWRlZC00MWM3LWI0ZGItNjMyYTQ0MjlmNDhlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNHZvMUhsSlVIeWp5bHNrWWdXTkNBdHFzY3hLRk9cLzN3S20rN1Vqbk16QU15ZzdcL0V6bDJzWXpkQ1VqOGtqRk11In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.1.200.108] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/6] ring: change head and tail to pointer-width size 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: Fri, 11 Jan 2019 19:27:30 -0000 > -----Original Message----- > From: Richardson, Bruce > Sent: Friday, January 11, 2019 5:59 AM > To: Burakov, Anatoly > Cc: Eads, Gage ; dev@dpdk.org; > olivier.matz@6wind.com; arybchenko@solarflare.com; Ananyev, Konstantin > > Subject: Re: [dpdk-dev] [PATCH 1/6] ring: change head and tail to pointer= -width > size >=20 > On Fri, Jan 11, 2019 at 11:30:24AM +0000, Burakov, Anatoly wrote: > > On 11-Jan-19 10:58 AM, Bruce Richardson wrote: > > > On Fri, Jan 11, 2019 at 10:40:19AM +0000, Burakov, Anatoly wrote: > > > > <...> > > > > > > > > > + * Copyright(c) 2016-2019 Intel Corporation > > > > > */ > > > > > /** > > > > > @@ -88,7 +88,7 @@ rte_event_ring_enqueue_burst(struct > rte_event_ring *r, > > > > > const struct rte_event *events, > > > > > unsigned int n, uint16_t *free_space) > > > > > { > > > > > - uint32_t prod_head, prod_next; > > > > > + uintptr_t prod_head, prod_next; > > > > > > > > I would also question the use of uinptr_t. I think semnatically, > > > > size_t is more appropriate. > > > > > > > Yes, it would, but I believe in this case they want to use the > > > largest size of (unsigned)int where there exists an atomic for > > > manipulating 2 of them simultaneously. [The largest size is to > > > minimize any chance of an ABA issue occuring]. Therefore we need > > > 32-bit values on 32-bit and 64-bit on 64, and I suspect the best way > > > to guarantee this is to use pointer-sized values. If size_t is > > > guaranteed across all OS's to have the same size as uintptr_t it coul= d also be > used, though. > > > > > > /Bruce > > > > > > > Technically, size_t and uintptr_t are not guaranteed to match. In > > practice, they won't match only on architectures that DPDK doesn't > > intend to run on (such as 16-bit segmented archs, where size_t would > > be 16-bit but uinptr_t would be 32-bit). > > > > In all the rest of DPDK code, we use size_t for this kind of thing. > > >=20 > Ok. > If we do use size_t, I think we also need to add a compile-time check int= o the > build too, to error out if sizeof(size_t) !=3D sizeof(uintptr_t). Ok, I wasn't aware of the precedent of using size_t for this purpose. I'll = change it and look into adding a static assert. Thanks, Gage