From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 8384F3B5 for ; Mon, 11 Jul 2016 12:44:41 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 11 Jul 2016 03:44:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,346,1464678000"; d="scan'208";a="1019369581" Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75]) by fmsmga002.fm.intel.com with ESMTP; 11 Jul 2016 03:41:29 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.51]) by IRSMSX153.ger.corp.intel.com ([169.254.9.105]) with mapi id 14.03.0248.002; Mon, 11 Jul 2016 11:41:19 +0100 From: "Ananyev, Konstantin" To: Juhamatti Kuusisaari , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] lib: move rte_ring read barrier to correct location Thread-Index: AQHR214YM0lag5RGeUO4brWmDxiYS6ATCkbA Date: Mon, 11 Jul 2016 10:41:18 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836B7C858@irsmsx105.ger.corp.intel.com> References: <20160711102055.14855-1-juhamatti.kuusisaari@coriant.com> In-Reply-To: <20160711102055.14855-1-juhamatti.kuusisaari@coriant.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] lib: move rte_ring read barrier to correct location X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 10:44:41 -0000 Hi , > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Juhamatti Kuusisaari > Sent: Monday, July 11, 2016 11:21 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] lib: move rte_ring read barrier to correct lo= cation >=20 > Fix the location of the rte_ring data dependency read barrier. > It needs to be called before accessing indexed data to ensure > that the data itself is guaranteed to be correctly updated. >=20 > See more details at kernel/Documentation/memory-barriers.txt > section 'Data dependency barriers'. Any explanation why? >>From my point smp_rmb()s are on the proper places here :) Konstantin >=20 > Signed-off-by: Juhamatti Kuusisaari > --- > lib/librte_ring/rte_ring.h | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h > index eb45e41..a923e49 100644 > --- a/lib/librte_ring/rte_ring.h > +++ b/lib/librte_ring/rte_ring.h > @@ -662,9 +662,10 @@ __rte_ring_mc_do_dequeue(struct rte_ring *r, void **= obj_table, > cons_next); > } while (unlikely(success =3D=3D 0)); >=20 > + rte_smp_rmb(); > + > /* copy in table */ > DEQUEUE_PTRS(); > - rte_smp_rmb(); >=20 > /* > * If there are other dequeues in progress that preceded us, > @@ -746,9 +747,10 @@ __rte_ring_sc_do_dequeue(struct rte_ring *r, void **= obj_table, > cons_next =3D cons_head + n; > r->cons.head =3D cons_next; >=20 > + rte_smp_rmb(); > + > /* copy in table */ > DEQUEUE_PTRS(); > - rte_smp_rmb(); >=20 > __RING_STAT_ADD(r, deq_success, n); > r->cons.tail =3D cons_next; > -- > 2.9.0 >=20 >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > The information contained in this message may be privileged > and confidential and protected from disclosure. If the reader > of this message is not the intended recipient, or an employee > or agent responsible for delivering this message to the > intended recipient, you are hereby notified that any reproduction, > dissemination or distribution of this communication is strictly > prohibited. If you have received this communication in error, > please notify us immediately by replying to the message and > deleting it from your computer. Thank you. Coriant-Tellabs > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D