DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] lib: move rte_ring read barrier to correct location
@ 2016-07-11 10:20 Juhamatti Kuusisaari
  2016-07-11 10:41 ` Ananyev, Konstantin
  0 siblings, 1 reply; 17+ messages in thread
From: Juhamatti Kuusisaari @ 2016-07-11 10:20 UTC (permalink / raw)
  To: 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 <juhamatti.kuusisaari@coriant.com>
---
 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 **obj_table,
                                              cons_next);
        } while (unlikely(success == 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 **obj_table,
        cons_next = cons_head + n;
        r->cons.head = cons_next;

+       rte_smp_rmb();
+
        /* copy in table */
        DEQUEUE_PTRS();
-       rte_smp_rmb();

        __RING_STAT_ADD(r, deq_success, n);
        r->cons.tail = cons_next;
--
2.9.0


============================================================
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
============================================================

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-07-18  2:47 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-11 10:20 [dpdk-dev] [PATCH] lib: move rte_ring read barrier to correct location Juhamatti Kuusisaari
2016-07-11 10:41 ` Ananyev, Konstantin
2016-07-11 11:22   ` Kuusisaari, Juhamatti
2016-07-11 11:40     ` Olivier Matz
2016-07-12  4:10       ` Kuusisaari, Juhamatti
2016-07-11 12:34     ` Ananyev, Konstantin
2016-07-12  5:27       ` Kuusisaari, Juhamatti
2016-07-12 11:01         ` Ananyev, Konstantin
2016-07-12 17:58           ` Ananyev, Konstantin
2016-07-13  5:27             ` Kuusisaari, Juhamatti
2016-07-13 13:00               ` Ananyev, Konstantin
2016-07-14  4:17                 ` Kuusisaari, Juhamatti
2016-07-14 12:56                   ` Ananyev, Konstantin
2016-07-15  5:40                     ` Kuusisaari, Juhamatti
2016-07-15  6:29                     ` Jerin Jacob
2016-07-15 10:34                       ` Ananyev, Konstantin
2016-07-18  2:47                         ` Jerin Jacob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).