[dpdk-dev] [PATCH] eal/armv7: add support for rte pause

Ola Liljedahl Ola.Liljedahl at arm.com
Sun Oct 7 23:09:25 CEST 2018

On 07/10/2018, 08:32, "Jerin Jacob" <jerin.jacob at caviumnetworks.com> wrote:

    Add support for rte_pause() implementation for armv7.

    Signed-off-by: Jerin Jacob <jerin.jacob at caviumnetworks.com>

    The reference implementation for Linux's cpu_relax() for armv7 is at

     lib/librte_eal/common/include/arch/arm/rte_pause_32.h | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)

    diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause_32.h b/lib/librte_eal/common/include/arch/arm/rte_pause_32.h
    index d4768c7a9..9b856e0cf 100644
    --- a/lib/librte_eal/common/include/arch/arm/rte_pause_32.h
    +++ b/lib/librte_eal/common/include/arch/arm/rte_pause_32.h
    @@ -9,11 +9,13 @@
     extern "C" {

    -#include <rte_common.h>
    +#include <rte_atomic.h>
     #include "generic/rte_pause.h"

     static inline void rte_pause(void)
The compiler barrier is not mandated by the DPDK documentation for rte_pause():

You have to go all the way to the source and GCC documentation to discover that for GCC, rte_pause calls _mm_pause() which in turn is implemented using __builtin_ia32_pause().
void __builtin_ia32_pause (void)
Generates the pause machine instruction with a compiler memory barrier.

If you are using C11 atomic operations e.g. for polling a location, the atomic operations will be able to provide the required semantics (e.g. don't merge atomic loads from different iterations of a loop, optionally provide acquire and/or release (or stronger) ordering. A compiler barrier here interferes with the (possibly weaker) barriers from the atomic operations. We could use a C11-version of rte_pause() that doesn't have the compiler barrier. But actually, we want support for WFE, x86 also has something similar now, MONITOR/MWAIT?.

-- Ola


     #ifdef __cplusplus

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

More information about the dev mailing list