[dpdk-dev] memory barriers in rte_ring

Olivier MATZ olivier.matz at 6wind.com
Thu Mar 27 20:47:37 CET 2014

Hi Stephen,

On 03/27/2014 08:06 PM, Stephen Hemminger wrote:
> Long answer: for the multple CPU access ring, it is equivalent to smp_wmb and smp_rmb
>   in Linux kernel. For x86 where DPDK is used, this can normally be replaced by simpler
>   compiler barrier. In kernel there is a special flage X86_OOSTORE which is only enabled
>   for a few special cases, for most cases it is not. When cpu doesnt do out of order
>   stores, there are no cases where other cpu will see wrong state.

Thank you for this clarification.

So, if I understand properly, all usages of rte_*mb() sequencing memory
operations between CPUs could be replaced by a compiler barrier. On the
other hand, if the memory is also accessed by a device, a memory
barrier has to be used.


More information about the dev mailing list