From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juhamatti Kuusisaari Subject: [PATCH] lib: move rte_ring read barrier to correct location Date: Mon, 11 Jul 2016 13:20:55 +0300 Message-ID: <20160711102055.14855-1-juhamatti.kuusisaari@coriant.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable To: Return-path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0082.outbound.protection.outlook.com [104.47.0.82]) by dpdk.org (Postfix) with ESMTP id 10D4E2BBD for ; Mon, 11 Jul 2016 12:21:49 +0200 (CEST) List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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. See more details at kernel/Documentation/memory-barriers.txt section 'Data dependency barriers'. Signed-off-by: Juhamatti Kuusisaari --- lib/librte_ring/rte_ring.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 **ob= j_table, cons_next); } while (unlikely(success =3D=3D 0)); + rte_smp_rmb(); + /* copy in table */ DEQUEUE_PTRS(); - rte_smp_rmb(); /* * If there are other dequeues in progress that preceded us, @@ -746,9 +747,10 @@ __rte_ring_sc_do_dequeue(struct rte_ring *r, void **ob= j_table, cons_next =3D cons_head + n; r->cons.head =3D cons_next; + rte_smp_rmb(); + /* copy in table */ DEQUEUE_PTRS(); - rte_smp_rmb(); __RING_STAT_ADD(r, deq_success, n); r->cons.tail =3D cons_next; -- 2.9.0 =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