From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id E04E01C8E2 for ; Thu, 5 Apr 2018 01:38:44 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2018 16:38:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,408,1517904000"; d="scan'208";a="29617746" Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59]) by fmsmga007.fm.intel.com with ESMTP; 04 Apr 2018 16:38:42 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.216]) by IRSMSX151.ger.corp.intel.com ([169.254.4.3]) with mapi id 14.03.0319.002; Thu, 5 Apr 2018 00:38:42 +0100 From: "Ananyev, Konstantin" To: Jerin Jacob , Olivier Matz CC: "dev@dpdk.org" , "Richardson, Bruce" Thread-Topic: [dpdk-dev] [PATCH] ring: relax alignment constraint on ring structure Thread-Index: AQHTy12O1Lx02zh0E02SnZc6w2EUYqPvGHGAgAADSwCAAAVLgIAADRUAgAFW7bA= Date: Wed, 4 Apr 2018 23:38:41 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258A0AB90E3@irsmsx105.ger.corp.intel.com> References: <20170630142609.6180-1-olivier.matz@6wind.com> <20180403132644.23729-1-olivier.matz@6wind.com> <20180403150722.GB15937@jerin> <20180403152517.hsjghkj5z6mauze7@platinum> <20180403153703.GA19072@jerin> <20180403155601.rqb7fhu6vggzrh7e@platinum> <20180403163254.GB19072@jerin> In-Reply-To: <20180403163254.GB19072@jerin> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDY0NzM0ZmUtOGFhNS00NDc5LTlmODgtYjk5OTBkZTQ0MDUwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6InRHVHFxczJhSjVDekZmNG5hKzZrK2VsTG1lUVlZZmxyZWp3WGp5cEM3SkE9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] ring: relax alignment constraint on ring structure 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: Wed, 04 Apr 2018 23:38:46 -0000 Hi lads, > -----Original Message----- > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > Sent: Tuesday, April 3, 2018 5:43 PM > To: Olivier Matz > Cc: dev@dpdk.org; Ananyev, Konstantin ; Ric= hardson, Bruce > Subject: Re: [dpdk-dev] [PATCH] ring: relax alignment constraint on ring = structure >=20 > -----Original Message----- > > Date: Tue, 3 Apr 2018 17:56:01 +0200 > > From: Olivier Matz > > To: Jerin Jacob > > CC: dev@dpdk.org, konstantin.ananyev@intel.com, bruce.richardson@intel.= com > > Subject: Re: [dpdk-dev] [PATCH] ring: relax alignment constraint on rin= g > > structure > > User-Agent: NeoMutt/20170113 (1.7.2) > > > > On Tue, Apr 03, 2018 at 09:07:04PM +0530, Jerin Jacob wrote: > > > -----Original Message----- > > > > Date: Tue, 3 Apr 2018 17:25:17 +0200 > > > > From: Olivier Matz > > > > To: Jerin Jacob > > > > CC: dev@dpdk.org, konstantin.ananyev@intel.com, bruce.richardson@in= tel.com > > > > Subject: Re: [dpdk-dev] [PATCH] ring: relax alignment constraint on= ring > > > > structure > > > > User-Agent: NeoMutt/20170113 (1.7.2) > > > > > > > > On Tue, Apr 03, 2018 at 08:37:23PM +0530, Jerin Jacob wrote: > > > > > -----Original Message----- > > > > > > Date: Tue, 3 Apr 2018 15:26:44 +0200 > > > > > > From: Olivier Matz > > > > > > To: dev@dpdk.org > > > > > > Subject: [dpdk-dev] [PATCH] ring: relax alignment constraint on= ring > > > > > > structure > > > > > > X-Mailer: git-send-email 2.11.0 > > > > > > > > > > > > The initial objective of > > > > > > commit d9f0d3a1ffd4 ("ring: remove split cacheline build settin= g") > > > > > > was to add an empty cache line betwee, the producer and consume= r > > > > > > data (on platform with cache line size =3D 64B), preventing fro= m > > > > > > having them on adjacent cache lines. > > > > > > > > > > > > Following discussion on the mailing list, it appears that this > > > > > > also imposes an alignment constraint that is not required. > > > > > > > > > > > > This patch removes the extra alignment constraint and adds the > > > > > > empty cache lines using padding fields in the structure. The > > > > > > size of rte_ring structure and the offset of the fields remain > > > > > > the same on platforms with cache line size =3D 64B: > > > > > > > > > > > > rte_ring =3D 384 > > > > > > rte_ring.name =3D 0 > > > > > > rte_ring.flags =3D 32 > > > > > > rte_ring.memzone =3D 40 > > > > > > rte_ring.size =3D 48 > > > > > > rte_ring.mask =3D 52 > > > > > > rte_ring.prod =3D 128 > > > > > > rte_ring.cons =3D 256 > > > > > > > > > > > > But it has an impact on platform where cache line size is 128B: > > > > > > > > > > > > rte_ring =3D 384 -> 768 > > > > > > rte_ring.name =3D 0 > > > > > > rte_ring.flags =3D 32 > > > > > > rte_ring.memzone =3D 40 > > > > > > rte_ring.size =3D 48 > > > > > > rte_ring.mask =3D 52 > > > > > > rte_ring.prod =3D 128 -> 256 > > > > > > rte_ring.cons =3D 256 -> 512 > > > > > > > > > > Are we leaving TWO cacheline to make sure, HW prefetch don't load > > > > > the adjust cacheline(consumer)? > > > > > > > > > > If so, Will it have impact on those machine where it is 128B Cach= e line > > > > > and the HW prefetcher is not loading the next caching explicitly.= Right? > > > > > > > > The impact on machines that have a 128B cache line is that an unuse= d > > > > cache line will be added between the producer and consumer data. I > > > > expect that the impact is positive in case there is a hw prefetcher= , and > > > > null in case there is no such prefetcher. > > > > > > It is not NULL, Right? You are loosing 256B for each ring. > > > > Is it really that important? >=20 > Pipeline or eventdev SW cases there could more rings in the system. > I don't see any downside of having config option which is enabled > default. >=20 > In my view, such config options are good, as in embedded usecases, custom= ers > can really fine tune the target for the need. In server usecases, let the= default > of option be enabled, no harm. But that would mean we have to maintain two layouts for the rte_ring struct= ure. I am agree with Olivier here, might be saving 256B per ring is not worth su= ch hassle. Konstantin >=20 > > > > > > > > On machines with 64B cache line, this was already the case. It just > > > > reduces the alignment constraint. > > > > > > Not all the 64B CL machines will have HW prefetch. > > > > > > I would recommend to add conditional compilation flags to express HW > > > prefetch enabled or not? based on that we can decide to reserve > > > the additional space. By default, in common config, HW prefetch can > > > be enabled so that it works for almost all cases. > > > > The hw prefetcher can be enabled at runtime, so a compilation flag > > does not seem to be a good idea. Moreover, changing this compilation >=20 > On those Hardwares HW prefetch can be disabled at runtime, it is fine > with default config. I was taking about some low end ARM hardware which > does not have HW prefetch is not present at all. >=20 > > flag would change the ABI. >=20 > ABI is broken anyway, Right? due to size of the structure change. >=20