On 03/04/2015 02:33 AM, Stephen Hemminger wrote: > On Tue, 3 Mar 2015 21:48:43 +0200 > Vlad Zolotarov <vladz at cloudius-systems.com> wrote: > >> + * TODO: >> + * - Get rid of "volatile" crap and let the compiler do its >> + * job. >> + * - Use the proper memory barrier (rte_rmb()) to ensure the >> + * memory ordering below. > This comment screams "this is broken". > Why not get proper architecture independent barriers in DPDK first.
C11 has arch independent memory barriers, so this can be as simple as -std=gnu11 (default in gcc 5, anyway). Not only do we get the barriers for free, but they are also properly integrated with the compiler, so for example a release barrier won't stop the compiler from hoisting a later accesses to before the store, or cause spurious reloads, due to the memory clobber.