[dpdk-dev] [PATCH 6/6] eal: switchover to architecture specific rte pause function

Jerin Jacob jerin.jacob at caviumnetworks.com
Thu May 11 12:10:46 CEST 2017


Remove rte_pause() definition from rte_common.h and
switchover to architecture specific rte_pause.h

Signed-off-by: Jerin Jacob <jerin.jacob at caviumnetworks.com>
---
 examples/distributor/main.c                              |  1 +
 examples/l2fwd-jobstats/main.c                           |  1 +
 examples/performance-thread/l3fwd-thread/main.c          |  1 +
 examples/tep_termination/main.c                          |  1 +
 examples/vhost/main.c                                    |  1 +
 examples/vhost_xen/main.c                                |  1 +
 lib/librte_distributor/rte_distributor.c                 |  2 ++
 lib/librte_distributor/rte_distributor_v20.c             |  2 ++
 lib/librte_eal/common/eal_common_timer.c                 |  1 +
 lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h |  1 +
 lib/librte_eal/common/include/arch/x86/rte_spinlock.h    |  1 +
 lib/librte_eal/common/include/generic/rte_rwlock.h       |  1 +
 lib/librte_eal/common/include/generic/rte_spinlock.h     |  1 +
 lib/librte_eal/common/include/rte_common.h               | 15 ---------------
 lib/librte_eal/common/include/rte_eal_memconfig.h        |  1 +
 lib/librte_eal/linuxapp/eal/eal_interrupts.c             |  1 +
 lib/librte_hash/rte_cuckoo_hash.c                        |  1 +
 lib/librte_ring/rte_ring.h                               |  1 +
 lib/librte_timer/rte_timer.c                             |  1 +
 test/test/test_common.c                                  |  1 +
 test/test/test_cryptodev.c                               |  1 +
 test/test/test_cryptodev_blockcipher.c                   |  1 +
 test/test/test_distributor_perf.c                        |  1 +
 test/test/test_eventdev_sw.c                             |  3 ++-
 test/test/test_ring_perf.c                               |  1 +
 test/test/test_timer.c                                   |  1 +
 test/test/test_timer_perf.c                              |  1 +
 test/test/test_timer_racecond.c                          |  1 +
 28 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 8071f9195..cf8982a71 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -43,6 +43,7 @@
 #include <rte_debug.h>
 #include <rte_prefetch.h>
 #include <rte_distributor.h>
+#include <rte_pause.h>
 
 #define RX_RING_SIZE 512
 #define TX_RING_SIZE 512
diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index e6e6c2286..d21e8338e 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -67,6 +67,7 @@
 #include <rte_jobstats.h>
 #include <rte_timer.h>
 #include <rte_alarm.h>
+#include <rte_pause.h>
 
 #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1
 
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 2d98473eb..f24409a32 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -73,6 +73,7 @@
 #include <rte_tcp.h>
 #include <rte_udp.h>
 #include <rte_string_fns.h>
+#include <rte_pause.h>
 
 #include <cmdline_parse.h>
 #include <cmdline_parse_etheraddr.h>
diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c
index cd6e3f1cf..224893413 100644
--- a/examples/tep_termination/main.c
+++ b/examples/tep_termination/main.c
@@ -50,6 +50,7 @@
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_vhost.h>
+#include <rte_pause.h>
 
 #include "main.h"
 #include "vxlan.h"
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index e07f86693..076935bf5 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -52,6 +52,7 @@
 #include <rte_vhost.h>
 #include <rte_ip.h>
 #include <rte_tcp.h>
+#include <rte_pause.h>
 
 #include "main.h"
 
diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c
index d9ef140f7..e5166214c 100644
--- a/examples/vhost_xen/main.c
+++ b/examples/vhost_xen/main.c
@@ -48,6 +48,7 @@
 #include <rte_ethdev.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
+#include <rte_pause.h>
 
 #include "main.h"
 #include "virtio-net.h"
diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c
index e4dfa7f0e..32dd18edc 100644
--- a/lib/librte_distributor/rte_distributor.c
+++ b/lib/librte_distributor/rte_distributor.c
@@ -42,6 +42,8 @@
 #include <rte_string_fns.h>
 #include <rte_eal_memconfig.h>
 #include <rte_compat.h>
+#include <rte_pause.h>
+
 #include "rte_distributor_private.h"
 #include "rte_distributor.h"
 #include "rte_distributor_v20.h"
diff --git a/lib/librte_distributor/rte_distributor_v20.c b/lib/librte_distributor/rte_distributor_v20.c
index bb6c5d709..b09abecd5 100644
--- a/lib/librte_distributor/rte_distributor_v20.c
+++ b/lib/librte_distributor/rte_distributor_v20.c
@@ -41,6 +41,8 @@
 #include <rte_compat.h>
 #include <rte_string_fns.h>
 #include <rte_eal_memconfig.h>
+#include <rte_pause.h>
+
 #include "rte_distributor_v20.h"
 #include "rte_distributor_private.h"
 
diff --git a/lib/librte_eal/common/eal_common_timer.c b/lib/librte_eal/common/eal_common_timer.c
index 72656176e..ed0b16d05 100644
--- a/lib/librte_eal/common/eal_common_timer.c
+++ b/lib/librte_eal/common/eal_common_timer.c
@@ -41,6 +41,7 @@
 #include <rte_common.h>
 #include <rte_log.h>
 #include <rte_cycles.h>
+#include <rte_pause.h>
 
 #include "eal_private.h"
 
diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h b/lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h
index af139c9d3..39815d9ee 100644
--- a/lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_spinlock.h
@@ -38,6 +38,7 @@ extern "C" {
 #endif
 
 #include <rte_common.h>
+#include <rte_pause.h>
 #include "generic/rte_spinlock.h"
 
 /* Fixme: Use intrinsics to implement the spinlock on Power architecture */
diff --git a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
index 8e630c219..5675c2b45 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h
@@ -43,6 +43,7 @@ extern "C" {
 #include "rte_cpuflags.h"
 #include "rte_branch_prediction.h"
 #include "rte_common.h"
+#include "rte_pause.h"
 
 #define RTE_RTM_MAX_RETRIES (10)
 #define RTE_XABORT_LOCK_BUSY (0xff)
diff --git a/lib/librte_eal/common/include/generic/rte_rwlock.h b/lib/librte_eal/common/include/generic/rte_rwlock.h
index 7a0fdc55c..fdb3113d3 100644
--- a/lib/librte_eal/common/include/generic/rte_rwlock.h
+++ b/lib/librte_eal/common/include/generic/rte_rwlock.h
@@ -52,6 +52,7 @@ extern "C" {
 
 #include <rte_common.h>
 #include <rte_atomic.h>
+#include <rte_pause.h>
 
 /**
  * The rte_rwlock_t type.
diff --git a/lib/librte_eal/common/include/generic/rte_spinlock.h b/lib/librte_eal/common/include/generic/rte_spinlock.h
index e51fc56ba..54f83a4c5 100644
--- a/lib/librte_eal/common/include/generic/rte_spinlock.h
+++ b/lib/librte_eal/common/include/generic/rte_spinlock.h
@@ -51,6 +51,7 @@
 #ifdef RTE_FORCE_INTRINSICS
 #include <rte_common.h>
 #endif
+#include <rte_pause.h>
 
 /**
  * The rte_spinlock_t type.
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index e057f6e21..31d5021ec 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -294,21 +294,6 @@ rte_align64pow2(uint64_t v)
 
 /*********** Other general functions / macros ********/
 
-#ifdef __SSE2__
-#include <emmintrin.h>
-/**
- * PAUSE instruction for tight loops (avoid busy waiting)
- */
-static inline void
-rte_pause (void)
-{
-	_mm_pause();
-}
-#else
-static inline void
-rte_pause(void) {}
-#endif
-
 /**
  * Searches the input parameter for the least significant set bit
  * (starting from zero).
diff --git a/lib/librte_eal/common/include/rte_eal_memconfig.h b/lib/librte_eal/common/include/rte_eal_memconfig.h
index 2b5e0b170..b9eee702e 100644
--- a/lib/librte_eal/common/include/rte_eal_memconfig.h
+++ b/lib/librte_eal/common/include/rte_eal_memconfig.h
@@ -39,6 +39,7 @@
 #include <rte_memzone.h>
 #include <rte_malloc_heap.h>
 #include <rte_rwlock.h>
+#include <rte_pause.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 2e3bd12a4..3e9ac41ee 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -64,6 +64,7 @@
 #include <rte_malloc.h>
 #include <rte_errno.h>
 #include <rte_spinlock.h>
+#include <rte_pause.h>
 
 #include "eal_private.h"
 #include "eal_vfio.h"
diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c
index 645c0cfab..83444d39d 100644
--- a/lib/librte_hash/rte_cuckoo_hash.c
+++ b/lib/librte_hash/rte_cuckoo_hash.c
@@ -57,6 +57,7 @@
 #include <rte_spinlock.h>
 #include <rte_ring.h>
 #include <rte_compat.h>
+#include <rte_pause.h>
 
 #include "rte_hash.h"
 #include "rte_cuckoo_hash.h"
diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
index 97f025a1f..5f93cb7a6 100644
--- a/lib/librte_ring/rte_ring.h
+++ b/lib/librte_ring/rte_ring.h
@@ -101,6 +101,7 @@ extern "C" {
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memzone.h>
+#include <rte_pause.h>
 
 #define RTE_TAILQ_RING_NAME "RTE_RING"
 
diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c
index 18782fab0..9994f5515 100644
--- a/lib/librte_timer/rte_timer.c
+++ b/lib/librte_timer/rte_timer.c
@@ -51,6 +51,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_spinlock.h>
 #include <rte_random.h>
+#include <rte_pause.h>
 
 #include "rte_timer.h"
 
diff --git a/test/test/test_common.c b/test/test/test_common.c
index 8effa2f9e..6e803f5d3 100644
--- a/test/test/test_common.c
+++ b/test/test/test_common.c
@@ -35,6 +35,7 @@
 #include <string.h>
 #include <rte_common.h>
 #include <rte_hexdump.h>
+#include <rte_pause.h>
 
 #include "test.h"
 
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 029ce8a0f..671911a5d 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -35,6 +35,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
+#include <rte_pause.h>
 
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c
index 603c77652..ce350e39f 100644
--- a/test/test/test_cryptodev_blockcipher.c
+++ b/test/test/test_cryptodev_blockcipher.c
@@ -35,6 +35,7 @@
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
+#include <rte_pause.h>
 
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
diff --git a/test/test/test_distributor_perf.c b/test/test/test_distributor_perf.c
index 732d86d0e..7d69887b9 100644
--- a/test/test/test_distributor_perf.c
+++ b/test/test/test_distributor_perf.c
@@ -40,6 +40,7 @@
 #include <rte_common.h>
 #include <rte_mbuf.h>
 #include <rte_distributor.h>
+#include <rte_pause.h>
 
 #define ITER_POWER_CL 25 /* log 2 of how many iterations  for Cache Line test */
 #define ITER_POWER 21 /* log 2 of how many iterations we do when timing. */
diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c
index b187d0290..a17adbfbe 100644
--- a/test/test/test_eventdev_sw.c
+++ b/test/test/test_eventdev_sw.c
@@ -47,8 +47,9 @@
 #include <rte_debug.h>
 #include <rte_ethdev.h>
 #include <rte_cycles.h>
-
 #include <rte_eventdev.h>
+#include <rte_pause.h>
+
 #include "test.h"
 
 #define MAX_PORTS 16
diff --git a/test/test/test_ring_perf.c b/test/test/test_ring_perf.c
index ed89896b3..84d200332 100644
--- a/test/test/test_ring_perf.c
+++ b/test/test/test_ring_perf.c
@@ -37,6 +37,7 @@
 #include <rte_ring.h>
 #include <rte_cycles.h>
 #include <rte_launch.h>
+#include <rte_pause.h>
 
 #include "test.h"
 
diff --git a/test/test/test_timer.c b/test/test/test_timer.c
index 2f6525a50..de0c312fa 100644
--- a/test/test/test_timer.c
+++ b/test/test/test_timer.c
@@ -136,6 +136,7 @@
 #include <rte_timer.h>
 #include <rte_random.h>
 #include <rte_malloc.h>
+#include <rte_pause.h>
 
 #define TEST_DURATION_S 1 /* in seconds */
 #define NB_TIMER 4
diff --git a/test/test/test_timer_perf.c b/test/test/test_timer_perf.c
index fa77efbd2..467ae13da 100644
--- a/test/test/test_timer_perf.c
+++ b/test/test/test_timer_perf.c
@@ -42,6 +42,7 @@
 #include <rte_lcore.h>
 #include <rte_random.h>
 #include <rte_malloc.h>
+#include <rte_pause.h>
 
 #define MAX_ITERATIONS 1000000
 
diff --git a/test/test/test_timer_racecond.c b/test/test/test_timer_racecond.c
index 7824ec4bf..5e08f06be 100644
--- a/test/test/test_timer_racecond.c
+++ b/test/test/test_timer_racecond.c
@@ -42,6 +42,7 @@
 #include <rte_lcore.h>
 #include <rte_random.h>
 #include <rte_malloc.h>
+#include <rte_pause.h>
 
 #undef TEST_TIMER_RACECOND_VERBOSE
 
-- 
2.12.2



More information about the dev mailing list