Go to file
Jia He 9bc2cbb007 ring: guarantee load/load order in enqueue and dequeue
We watched a rte panic of mbuf_autotest in our qualcomm arm64 server
(Amberwing).

Root cause:
In __rte_ring_move_cons_head()
...
        do {
                /* Restore n as it may change every loop */
                n = max;

                *old_head = r->cons.head;                //1st load
                const uint32_t prod_tail = r->prod.tail; //2nd load

In weak memory order architectures (powerpc,arm), the 2nd load might be
reodered before the 1st load, that makes *entries is bigger than we wanted.
This nasty reording messed enque/deque up.

cpu1(producer)          cpu2(consumer)          cpu3(consumer)
                        load r->prod.tail
in enqueue:
load r->cons.tail
load r->prod.head

store r->prod.tail

                                                load r->cons.head
                                                load r->prod.tail
                                                ...
                                                store r->cons.{head,tail}
                        load r->cons.head

Then, r->cons.head will be bigger than prod_tail, then make *entries very
big and the consumer will go forward incorrectly.

After this patch, the old cons.head will be recaculated after failure of
rte_atomic32_cmpset

There is no such issue on X86, because X86 is strong memory order model.
But rte_smp_rmb() doesn't have impact on runtime performance on X86, so
keep the same code without architectures specific concerns.

Fixes: 50d7690548 ("ring: add burst API")
Cc: stable@dpdk.org

Signed-off-by: Jia He <jia.he@hxt-semitech.com>
Signed-off-by: Jie Liu <jie2.liu@hxt-semitech.com>
Signed-off-by: Bing Zhao <bing.zhao@hxt-semitech.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Jianbo Liu <jianbo.liu@arm.com>
2017-11-12 18:59:14 +01:00
app app/testpmd: remove port status check from TM command 2017-11-11 16:18:21 +01:00
buildtools buildtools: check allocation error in pmdinfogen 2017-11-07 23:24:43 +01:00
config net/qede: fix default config option 2017-11-10 08:12:20 +00:00
devtools devtools: add script to get maintainers from patch 2017-11-08 00:38:46 +01:00
doc doc: mention 17.11 LTS in contributing guide 2017-11-12 05:40:00 +01:00
drivers net/virtio: fix Rx interrupt with VFIO 2017-11-11 15:54:16 +01:00
examples examples/ipv4_multicast: fix segments number type 2017-11-12 04:15:54 +01:00
lib ring: guarantee load/load order in enqueue and dequeue 2017-11-12 18:59:14 +01:00
mk bus/vdev: move code from EAL into a new driver 2017-11-07 16:54:07 +01:00
pkg eal: remove Xen dom0 support 2017-10-09 01:54:29 +02:00
test test/memory: fix autotest parsing 2017-11-12 04:15:54 +01:00
usertools usertools: fix device binding with python 3 2017-11-07 23:34:38 +01:00
.gitattributes improve git diff 2016-11-13 15:25:12 +01:00
.gitignore devtools: add tags and cscope index generation 2017-04-30 12:57:04 +02:00
GNUmakefile mk: do not build tests by default 2017-02-28 16:04:18 +01:00
LICENSE.GPL doc: GPL/LGPL licenses 2013-07-25 14:43:06 +02:00
LICENSE.LGPL doc: fix file format (dos to unix) 2013-09-06 11:43:07 +02:00
MAINTAINERS maintainers: update PTP client example 2017-11-12 08:10:23 +01:00
Makefile remove trailing whitespaces 2014-06-11 00:29:34 +02:00
README doc: add readme file 2015-12-13 22:06:58 +01:00

DPDK is a set of libraries and drivers for fast packet processing.
It supports many processor architectures and both FreeBSD and Linux.

The DPDK uses the Open Source BSD license for the core libraries and
drivers. The kernel components are GPLv2 licensed.

Please check the doc directory for release notes,
API documentation, and sample application information.

For questions and usage discussions, subscribe to: users@dpdk.org
Report bugs and issues to the development mailing list: dev@dpdk.org