DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 0/8] use compiler atomic builtins for examples
@ 2021-08-23  5:49 Joyce Kong
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 1/8] examples/bbdev_app: use compiler atomics for flag sync Joyce Kong
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Joyce Kong @ 2021-08-23  5:49 UTC (permalink / raw)
  Cc: dev, thomas, david.marchand, honnappa.nagarahalli, ruifeng.wang, nd

Since atomic operations have been adopted in DPDK now[1],
change rte_atomicNN_xxx APIs to compiler's atomic built-ins
in examples module[2].

[1] https://www.dpdk.org/blog/2021/03/26/dpdk-adopts-the-c11-memory-model/
[2] https://doc.dpdk.org/guides/rel_notes/deprecation.html

v2:
  Fix the compiling error of performance-thread patch.

Joyce Kong (8):
  examples/bbdev_app: use compiler atomics for flag sync
  examples/multi_process: use compiler atomics for sync
  examples/kni: use compiler atomics for status sync
  examples/performance-thread: use compiler atomics for sync
  examples/l2fwd-jobstats: use compiler atomics for stats sync
  examples/vm_power_manager: use compiler atomics for sync
  examples/server_node_efd: use compiler atomics for sync
  examples: remove unnecessary include of atomic

 examples/bbdev_app/main.c                     | 13 ++++---
 examples/bond/main.c                          |  1 -
 examples/ip_fragmentation/main.c              |  1 -
 examples/ip_reassembly/main.c                 |  1 -
 examples/ipsec-secgw/ipsec-secgw.c            |  1 -
 examples/ipv4_multicast/main.c                |  1 -
 examples/kni/main.c                           | 27 +++++++--------
 examples/l2fwd-crypto/main.c                  |  1 -
 examples/l2fwd-event/l2fwd_common.h           |  1 -
 examples/l2fwd-event/l2fwd_event.c            |  1 -
 examples/l2fwd-jobstats/main.c                | 11 +++---
 examples/l2fwd-keepalive/main.c               |  1 -
 examples/l2fwd/main.c                         |  1 -
 examples/l3fwd-acl/main.c                     |  1 -
 examples/l3fwd-power/main.c                   |  1 -
 examples/l3fwd/main.c                         |  1 -
 examples/link_status_interrupt/main.c         |  1 -
 .../client_server_mp/mp_client/client.c       |  1 -
 .../client_server_mp/mp_server/init.c         |  1 -
 .../client_server_mp/mp_server/main.c         |  7 ++--
 examples/multi_process/simple_mp/main.c       |  1 -
 .../multi_process/simple_mp/mp_commands.c     |  1 -
 examples/multi_process/symmetric_mp/main.c    |  1 -
 examples/performance-thread/common/lthread.c  | 10 +++---
 .../performance-thread/common/lthread_diag.h  | 10 +++---
 .../performance-thread/common/lthread_int.h   |  1 -
 .../performance-thread/common/lthread_mutex.c | 26 +++++++-------
 .../performance-thread/common/lthread_mutex.h |  2 +-
 .../performance-thread/common/lthread_sched.c | 34 ++++++++-----------
 .../performance-thread/common/lthread_tls.c   |  5 +--
 .../performance-thread/l3fwd-thread/main.c    | 22 +++++-------
 examples/server_node_efd/node/node.c          |  1 -
 examples/server_node_efd/server/init.c        |  1 -
 examples/server_node_efd/server/main.c        |  7 ++--
 examples/vhost_blk/blk.c                      |  1 -
 examples/vhost_blk/vhost_blk.c                |  1 -
 examples/vm_power_manager/channel_manager.c   |  1 -
 examples/vm_power_manager/channel_manager.h   |  1 -
 examples/vm_power_manager/channel_monitor.c   | 11 +++---
 examples/vmdq/main.c                          |  1 -
 examples/vmdq_dcb/main.c                      |  1 -
 41 files changed, 91 insertions(+), 122 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 1/8] examples/bbdev_app: use compiler atomics for flag sync
  2021-08-23  5:49 [dpdk-dev] [PATCH v2 0/8] use compiler atomic builtins for examples Joyce Kong
@ 2021-08-23  5:49 ` Joyce Kong
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 2/8] examples/multi_process: use compiler atomics for sync Joyce Kong
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Joyce Kong @ 2021-08-23  5:49 UTC (permalink / raw)
  To: Nicolas Chautru
  Cc: dev, thomas, david.marchand, honnappa.nagarahalli, ruifeng.wang, nd

Convert rte_atomic usages to compiler atomic built-ins
for global_exit_flag sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/bbdev_app/main.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 5251db0b16..75c620ea75 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -18,7 +18,6 @@
 #include <getopt.h>
 #include <signal.h>
 
-#include <rte_atomic.h>
 #include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_cycles.h>
@@ -167,7 +166,7 @@ static const struct app_config_params def_app_config = {
 	.num_dec_cores = 1,
 };
 
-static rte_atomic16_t global_exit_flag;
+static uint16_t global_exit_flag;
 
 /* display usage */
 static inline void
@@ -279,7 +278,7 @@ static void
 signal_handler(int signum)
 {
 	printf("\nSignal %d received\n", signum);
-	rte_atomic16_set(&global_exit_flag, 1);
+	__atomic_store_n(&global_exit_flag, 1, __ATOMIC_RELAXED);
 }
 
 static void
@@ -328,7 +327,7 @@ check_port_link_status(uint16_t port_id)
 	fflush(stdout);
 
 	for (count = 0; count <= MAX_CHECK_TIME &&
-			!rte_atomic16_read(&global_exit_flag); count++) {
+			!__atomic_load_n(&global_exit_flag, __ATOMIC_RELAXED); count++) {
 		memset(&link, 0, sizeof(link));
 		link_get_err = rte_eth_link_get_nowait(port_id, &link);
 
@@ -682,7 +681,7 @@ stats_loop(void *arg)
 {
 	struct stats_lcore_params *stats_lcore = arg;
 
-	while (!rte_atomic16_read(&global_exit_flag)) {
+	while (!__atomic_load_n(&global_exit_flag, __ATOMIC_RELAXED)) {
 		print_stats(stats_lcore);
 		rte_delay_ms(500);
 	}
@@ -928,7 +927,7 @@ processing_loop(void *arg)
 	const bool run_decoder = (lcore_conf->core_type &
 			(1 << RTE_BBDEV_OP_TURBO_DEC));
 
-	while (!rte_atomic16_read(&global_exit_flag)) {
+	while (!__atomic_load_n(&global_exit_flag, __ATOMIC_RELAXED)) {
 		if (run_encoder)
 			run_encoding(lcore_conf);
 		if (run_decoder)
@@ -1062,7 +1061,7 @@ main(int argc, char **argv)
 		.align = __alignof__(struct rte_mbuf *),
 	};
 
-	rte_atomic16_init(&global_exit_flag);
+	__atomic_store_n(&global_exit_flag, 0, __ATOMIC_RELAXED);
 
 	sigret = signal(SIGTERM, signal_handler);
 	if (sigret == SIG_ERR)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 2/8] examples/multi_process: use compiler atomics for sync
  2021-08-23  5:49 [dpdk-dev] [PATCH v2 0/8] use compiler atomic builtins for examples Joyce Kong
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 1/8] examples/bbdev_app: use compiler atomics for flag sync Joyce Kong
@ 2021-08-23  5:49 ` Joyce Kong
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 3/8] examples/kni: use compiler atomics for status sync Joyce Kong
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Joyce Kong @ 2021-08-23  5:49 UTC (permalink / raw)
  To: Anatoly Burakov
  Cc: dev, thomas, david.marchand, honnappa.nagarahalli, ruifeng.wang, nd

Convert rte_atomic32_test_and_set usage to compiler atomic
CAS operation for display_stats sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/multi_process/client_server_mp/mp_server/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c
index 9bcee460fd..b4761ebc7b 100644
--- a/examples/multi_process/client_server_mp/mp_server/main.c
+++ b/examples/multi_process/client_server_mp/mp_server/main.c
@@ -20,7 +20,6 @@
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
 #include <rte_branch_prediction.h>
-#include <rte_atomic.h>
 #include <rte_ring.h>
 #include <rte_log.h>
 #include <rte_debug.h>
@@ -158,10 +157,12 @@ static int
 sleep_lcore(__rte_unused void *dummy)
 {
 	/* Used to pick a display thread - static, so zero-initialised */
-	static rte_atomic32_t display_stats;
+	static uint32_t display_stats;
 
+	uint32_t status = 0;
 	/* Only one core should display stats */
-	if (rte_atomic32_test_and_set(&display_stats)) {
+	if (__atomic_compare_exchange_n(&display_stats, &status, 1, 0,
+			__ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 		const unsigned sleeptime = 1;
 		printf("Core %u displaying statistics\n", rte_lcore_id());
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 3/8] examples/kni: use compiler atomics for status sync
  2021-08-23  5:49 [dpdk-dev] [PATCH v2 0/8] use compiler atomic builtins for examples Joyce Kong
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 1/8] examples/bbdev_app: use compiler atomics for flag sync Joyce Kong
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 2/8] examples/multi_process: use compiler atomics for sync Joyce Kong
@ 2021-08-23  5:49 ` Joyce Kong
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 4/8] examples/performance-thread: use compiler atomics for sync Joyce Kong
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Joyce Kong @ 2021-08-23  5:49 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: dev, thomas, david.marchand, honnappa.nagarahalli, ruifeng.wang, nd

Convert rte_atomic usages to compiler atomic builit-ins
for kni_stop and kni_pause sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/kni/main.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/examples/kni/main.c b/examples/kni/main.c
index beabb3c848..ad1f569e18 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -27,7 +27,6 @@
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_lcore.h>
 #include <rte_branch_prediction.h>
 #include <rte_interrupts.h>
@@ -131,8 +130,8 @@ static int kni_change_mtu(uint16_t port_id, unsigned int new_mtu);
 static int kni_config_network_interface(uint16_t port_id, uint8_t if_up);
 static int kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]);
 
-static rte_atomic32_t kni_stop = RTE_ATOMIC32_INIT(0);
-static rte_atomic32_t kni_pause = RTE_ATOMIC32_INIT(0);
+static uint32_t kni_stop;
+static uint32_t kni_pause;
 
 /* Print out statistics on packets handled */
 static void
@@ -185,7 +184,7 @@ signal_handler(int signum)
 	if (signum == SIGRTMIN || signum == SIGINT || signum == SIGTERM) {
 		printf("\nSIGRTMIN/SIGINT/SIGTERM received. "
 			"KNI processing stopping.\n");
-		rte_atomic32_inc(&kni_stop);
+		__atomic_fetch_add(&kni_stop, 1, __ATOMIC_RELAXED);
 		return;
         }
 }
@@ -311,8 +310,8 @@ main_loop(__rte_unused void *arg)
 					kni_port_params_array[i]->lcore_rx,
 					kni_port_params_array[i]->port_id);
 		while (1) {
-			f_stop = rte_atomic32_read(&kni_stop);
-			f_pause = rte_atomic32_read(&kni_pause);
+			f_stop = __atomic_load_n(&kni_stop, __ATOMIC_RELAXED);
+			f_pause = __atomic_load_n(&kni_pause, __ATOMIC_RELAXED);
 			if (f_stop)
 				break;
 			if (f_pause)
@@ -324,8 +323,8 @@ main_loop(__rte_unused void *arg)
 					kni_port_params_array[i]->lcore_tx,
 					kni_port_params_array[i]->port_id);
 		while (1) {
-			f_stop = rte_atomic32_read(&kni_stop);
-			f_pause = rte_atomic32_read(&kni_pause);
+			f_stop = __atomic_load_n(&kni_stop, __ATOMIC_RELAXED);
+			f_pause = __atomic_load_n(&kni_pause, __ATOMIC_RELAXED);
 			if (f_stop)
 				break;
 			if (f_pause)
@@ -856,9 +855,9 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
 {
 	int ret;
 
-	rte_atomic32_inc(&kni_pause);
+	__atomic_fetch_add(&kni_pause, 1, __ATOMIC_RELAXED);
 	ret =  kni_change_mtu_(port_id, new_mtu);
-	rte_atomic32_dec(&kni_pause);
+	__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
 
 	return ret;
 }
@@ -877,14 +876,14 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up)
 	RTE_LOG(INFO, APP, "Configure network interface of %d %s\n",
 					port_id, if_up ? "up" : "down");
 
-	rte_atomic32_inc(&kni_pause);
+	__atomic_fetch_add(&kni_pause, 1, __ATOMIC_RELAXED);
 
 	if (if_up != 0) { /* Configure network interface up */
 		ret = rte_eth_dev_stop(port_id);
 		if (ret != 0) {
 			RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
 				port_id, rte_strerror(-ret));
-			rte_atomic32_dec(&kni_pause);
+			__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
 			return ret;
 		}
 		ret = rte_eth_dev_start(port_id);
@@ -893,12 +892,12 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up)
 		if (ret != 0) {
 			RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
 				port_id, rte_strerror(-ret));
-			rte_atomic32_dec(&kni_pause);
+			__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
 			return ret;
 		}
 	}
 
-	rte_atomic32_dec(&kni_pause);
+	__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
 
 	if (ret < 0)
 		RTE_LOG(ERR, APP, "Failed to start port %d\n", port_id);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 4/8] examples/performance-thread: use compiler atomics for sync
  2021-08-23  5:49 [dpdk-dev] [PATCH v2 0/8] use compiler atomic builtins for examples Joyce Kong
                   ` (2 preceding siblings ...)
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 3/8] examples/kni: use compiler atomics for status sync Joyce Kong
@ 2021-08-23  5:49 ` Joyce Kong
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 5/8] examples/l2fwd-jobstats: use compiler atomics for stats sync Joyce Kong
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Joyce Kong @ 2021-08-23  5:49 UTC (permalink / raw)
  To: John McNamara
  Cc: dev, thomas, david.marchand, honnappa.nagarahalli, ruifeng.wang, nd

Convert rte_atomic usages to compiler atomic built-ins
for thread sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/performance-thread/common/lthread.c  | 10 +++---
 .../performance-thread/common/lthread_diag.h  | 10 +++---
 .../performance-thread/common/lthread_int.h   |  1 -
 .../performance-thread/common/lthread_mutex.c | 26 +++++++-------
 .../performance-thread/common/lthread_mutex.h |  2 +-
 .../performance-thread/common/lthread_sched.c | 34 ++++++++-----------
 .../performance-thread/common/lthread_tls.c   |  5 +--
 .../performance-thread/l3fwd-thread/main.c    | 22 +++++-------
 8 files changed, 53 insertions(+), 57 deletions(-)

diff --git a/examples/performance-thread/common/lthread.c b/examples/performance-thread/common/lthread.c
index 3f1f48db43..98123f34f8 100644
--- a/examples/performance-thread/common/lthread.c
+++ b/examples/performance-thread/common/lthread.c
@@ -357,9 +357,10 @@ void lthread_exit(void *ptr)
 	 *  - if exit before join then we suspend and resume on join
 	 *  - if join before exit then we resume the joining thread
 	 */
+	uint64_t join_initial = LT_JOIN_INITIAL;
 	if ((lt->join == LT_JOIN_INITIAL)
-	    && rte_atomic64_cmpset(&lt->join, LT_JOIN_INITIAL,
-				   LT_JOIN_EXITING)) {
+	    && __atomic_compare_exchange_n(&lt->join, &join_initial,
+		LT_JOIN_EXITING, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 
 		DIAG_EVENT(lt, LT_DIAG_LTHREAD_EXIT, 1, 0);
 		_suspend();
@@ -415,9 +416,10 @@ int lthread_join(struct lthread *lt, void **ptr)
 	 *  - if join before exit we suspend and will resume when exit is called
 	 *  - if exit before join we resume the exiting thread
 	 */
+	uint64_t join_initial = LT_JOIN_INITIAL;
 	if ((lt->join == LT_JOIN_INITIAL)
-	    && rte_atomic64_cmpset(&lt->join, LT_JOIN_INITIAL,
-				   LT_JOIN_THREAD_SET)) {
+	    && __atomic_compare_exchange_n(&lt->join, &join_initial,
+		LT_JOIN_THREAD_SET, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 
 		DIAG_EVENT(current, LT_DIAG_LTHREAD_JOIN, lt, 1);
 		_suspend();
diff --git a/examples/performance-thread/common/lthread_diag.h b/examples/performance-thread/common/lthread_diag.h
index e876dda6da..7ee89eef38 100644
--- a/examples/performance-thread/common/lthread_diag.h
+++ b/examples/performance-thread/common/lthread_diag.h
@@ -78,11 +78,11 @@ extern uint64_t diag_mask;
 	}								\
 } while (0)
 
-#define DIAG_COUNT_DEFINE(x) rte_atomic64_t count_##x
-#define DIAG_COUNT_INIT(o, x) rte_atomic64_init(&((o)->count_##x))
-#define DIAG_COUNT_INC(o, x) rte_atomic64_inc(&((o)->count_##x))
-#define DIAG_COUNT_DEC(o, x) rte_atomic64_dec(&((o)->count_##x))
-#define DIAG_COUNT(o, x) rte_atomic64_read(&((o)->count_##x))
+#define DIAG_COUNT_DEFINE(x) uint64_t count_##x
+#define DIAG_COUNT_INIT(o, x) __atomic_store_n(&((o)->count_##x), 0, __ATOMIC_RELAXED)
+#define DIAG_COUNT_INC(o, x) __atomic_fetch_add(&((o)->count_##x), 1, __ATOMIC_RELAXED)
+#define DIAG_COUNT_DEC(o, x) __atomic_fetch_sub(&((o)->count_##x), 1, __ATOMIC_RELAXED)
+#define DIAG_COUNT(o, x) __atomic_load_n(&((o)->count_##x), __ATOMIC_RELAXED)
 
 #define DIAG_USED
 
diff --git a/examples/performance-thread/common/lthread_int.h b/examples/performance-thread/common/lthread_int.h
index a352f13b75..d010126f16 100644
--- a/examples/performance-thread/common/lthread_int.h
+++ b/examples/performance-thread/common/lthread_int.h
@@ -21,7 +21,6 @@ extern "C" {
 #include <rte_cycles.h>
 #include <rte_per_lcore.h>
 #include <rte_timer.h>
-#include <rte_atomic_64.h>
 #include <rte_spinlock.h>
 #include <ctx.h>
 
diff --git a/examples/performance-thread/common/lthread_mutex.c b/examples/performance-thread/common/lthread_mutex.c
index 01da6cad4f..061fc5c19a 100644
--- a/examples/performance-thread/common/lthread_mutex.c
+++ b/examples/performance-thread/common/lthread_mutex.c
@@ -60,7 +60,7 @@ lthread_mutex_init(char *name, struct lthread_mutex **mutex,
 	m->root_sched = THIS_SCHED;
 	m->owner = NULL;
 
-	rte_atomic64_init(&m->count);
+	__atomic_store_n(&m->count, 0, __ATOMIC_RELAXED);
 
 	DIAG_CREATE_EVENT(m, LT_DIAG_MUTEX_CREATE);
 	/* success */
@@ -115,10 +115,11 @@ int lthread_mutex_lock(struct lthread_mutex *m)
 	}
 
 	for (;;) {
-		rte_atomic64_inc(&m->count);
+		__atomic_fetch_add(&m->count, 1, __ATOMIC_RELAXED);
 		do {
-			if (rte_atomic64_cmpset
-			    ((uint64_t *) &m->owner, 0, (uint64_t) lt)) {
+			uint64_t lt_init = 0;
+			if (__atomic_compare_exchange_n((uint64_t *) &m->owner, &lt_init,
+				(uint64_t) lt, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 				/* happy days, we got the lock */
 				DIAG_EVENT(m, LT_DIAG_MUTEX_LOCK, m, 0);
 				return 0;
@@ -126,7 +127,7 @@ int lthread_mutex_lock(struct lthread_mutex *m)
 			/* spin due to race with unlock when
 			* nothing was blocked
 			*/
-		} while ((rte_atomic64_read(&m->count) == 1) &&
+		} while ((__atomic_load_n(&m->count, __ATOMIC_RELAXED) == 1) &&
 				(m->owner == NULL));
 
 		/* queue the current thread in the blocked queue
@@ -160,16 +161,17 @@ int lthread_mutex_trylock(struct lthread_mutex *m)
 		return POSIX_ERRNO(EDEADLK);
 	}
 
-	rte_atomic64_inc(&m->count);
-	if (rte_atomic64_cmpset
-	    ((uint64_t *) &m->owner, (uint64_t) NULL, (uint64_t) lt)) {
+	__atomic_fetch_add(&m->count, 1, __ATOMIC_RELAXED);
+	uint64_t lt_init = 0;
+	if (__atomic_compare_exchange_n((uint64_t *) &m->owner, &lt_init,
+		(uint64_t) lt, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 		/* got the lock */
 		DIAG_EVENT(m, LT_DIAG_MUTEX_TRYLOCK, m, 0);
 		return 0;
 	}
 
 	/* failed so return busy */
-	rte_atomic64_dec(&m->count);
+	__atomic_fetch_sub(&m->count, 1, __ATOMIC_RELAXED);
 	DIAG_EVENT(m, LT_DIAG_MUTEX_TRYLOCK, m, POSIX_ERRNO(EBUSY));
 	return POSIX_ERRNO(EBUSY);
 }
@@ -193,13 +195,13 @@ int lthread_mutex_unlock(struct lthread_mutex *m)
 		return POSIX_ERRNO(EPERM);
 	}
 
-	rte_atomic64_dec(&m->count);
+	__atomic_fetch_sub(&m->count, 1, __ATOMIC_RELAXED);
 	/* if there are blocked threads then make one ready */
-	while (rte_atomic64_read(&m->count) > 0) {
+	while (__atomic_load_n(&m->count, __ATOMIC_RELAXED) > 0) {
 		unblocked = _lthread_queue_remove(m->blocked);
 
 		if (unblocked != NULL) {
-			rte_atomic64_dec(&m->count);
+			__atomic_fetch_sub(&m->count, 1, __ATOMIC_RELAXED);
 			DIAG_EVENT(m, LT_DIAG_MUTEX_UNLOCKED, m, unblocked);
 			RTE_ASSERT(unblocked->sched != NULL);
 			_ready_queue_insert((struct lthread_sched *)
diff --git a/examples/performance-thread/common/lthread_mutex.h b/examples/performance-thread/common/lthread_mutex.h
index cd866f87b8..730092bdf8 100644
--- a/examples/performance-thread/common/lthread_mutex.h
+++ b/examples/performance-thread/common/lthread_mutex.h
@@ -17,7 +17,7 @@ extern "C" {
 
 struct lthread_mutex {
 	struct lthread *owner;
-	rte_atomic64_t	count;
+	uint64_t count;
 	struct lthread_queue *blocked __rte_cache_aligned;
 	struct lthread_sched *root_sched;
 	char			name[MAX_MUTEX_NAME_SIZE];
diff --git a/examples/performance-thread/common/lthread_sched.c b/examples/performance-thread/common/lthread_sched.c
index 38ca0c45cb..3784b010c2 100644
--- a/examples/performance-thread/common/lthread_sched.c
+++ b/examples/performance-thread/common/lthread_sched.c
@@ -22,8 +22,6 @@
 
 #include <rte_prefetch.h>
 #include <rte_per_lcore.h>
-#include <rte_atomic.h>
-#include <rte_atomic_64.h>
 #include <rte_log.h>
 #include <rte_common.h>
 #include <rte_branch_prediction.h>
@@ -47,8 +45,8 @@
  * When a scheduler shuts down it is assumed that the application is terminating
  */
 
-static rte_atomic16_t num_schedulers;
-static rte_atomic16_t active_schedulers;
+static uint16_t num_schedulers;
+static uint16_t active_schedulers;
 
 /* one scheduler per lcore */
 RTE_DEFINE_PER_LCORE(struct lthread_sched *, this_sched) = NULL;
@@ -64,10 +62,8 @@ uint64_t diag_mask;
 RTE_INIT(lthread_sched_ctor)
 {
 	memset(schedcore, 0, sizeof(schedcore));
-	rte_atomic16_init(&num_schedulers);
-	rte_atomic16_set(&num_schedulers, 1);
-	rte_atomic16_init(&active_schedulers);
-	rte_atomic16_set(&active_schedulers, 0);
+	__atomic_store_n(&num_schedulers, 1, __ATOMIC_RELAXED);
+	__atomic_store_n(&active_schedulers, 0, __ATOMIC_RELAXED);
 	diag_cb = NULL;
 }
 
@@ -260,8 +256,8 @@ struct lthread_sched *_lthread_sched_create(size_t stack_size)
  */
 int lthread_num_schedulers_set(int num)
 {
-	rte_atomic16_set(&num_schedulers, num);
-	return (int)rte_atomic16_read(&num_schedulers);
+	__atomic_store_n(&num_schedulers, num, __ATOMIC_RELAXED);
+	return (int)__atomic_load_n(&num_schedulers, __ATOMIC_RELAXED);
 }
 
 /*
@@ -269,7 +265,7 @@ int lthread_num_schedulers_set(int num)
  */
 int lthread_active_schedulers(void)
 {
-	return (int)rte_atomic16_read(&active_schedulers);
+	return (int)__atomic_load_n(&active_schedulers, __ATOMIC_RELAXED);
 }
 
 
@@ -299,8 +295,8 @@ void lthread_scheduler_shutdown_all(void)
 	 * for the possibility of a pthread wrapper on lthread_yield(),
 	 * something that is not possible unless the scheduler is running.
 	 */
-	while (rte_atomic16_read(&active_schedulers) <
-	       rte_atomic16_read(&num_schedulers))
+	while (__atomic_load_n(&active_schedulers, __ATOMIC_RELAXED) <
+	       __atomic_load_n(&num_schedulers, __ATOMIC_RELAXED))
 		sched_yield();
 
 	for (i = 0; i < LTHREAD_MAX_LCORES; i++) {
@@ -415,15 +411,15 @@ static inline int _lthread_sched_isdone(struct lthread_sched *sched)
  */
 static inline void _lthread_schedulers_sync_start(void)
 {
-	rte_atomic16_inc(&active_schedulers);
+	__atomic_fetch_add(&active_schedulers, 1, __ATOMIC_RELAXED);
 
 	/* wait for lthread schedulers
 	 * Note we use sched_yield() rather than pthread_yield() to allow
 	 * for the possibility of a pthread wrapper on lthread_yield(),
 	 * something that is not possible unless the scheduler is running.
 	 */
-	while (rte_atomic16_read(&active_schedulers) <
-	       rte_atomic16_read(&num_schedulers))
+	while (__atomic_load_n(&active_schedulers, __ATOMIC_RELAXED) <
+	       __atomic_load_n(&num_schedulers, __ATOMIC_RELAXED))
 		sched_yield();
 
 }
@@ -433,15 +429,15 @@ static inline void _lthread_schedulers_sync_start(void)
  */
 static inline void _lthread_schedulers_sync_stop(void)
 {
-	rte_atomic16_dec(&active_schedulers);
-	rte_atomic16_dec(&num_schedulers);
+	__atomic_fetch_sub(&active_schedulers, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(&num_schedulers, 1, __ATOMIC_RELAXED);
 
 	/* wait for schedulers
 	 * Note we use sched_yield() rather than pthread_yield() to allow
 	 * for the possibility of a pthread wrapper on lthread_yield(),
 	 * something that is not possible unless the scheduler is running.
 	 */
-	while (rte_atomic16_read(&active_schedulers) > 0)
+	while (__atomic_load_n(&active_schedulers, __ATOMIC_RELAXED) > 0)
 		sched_yield();
 
 }
diff --git a/examples/performance-thread/common/lthread_tls.c b/examples/performance-thread/common/lthread_tls.c
index 07de6cafab..4ab2e3558b 100644
--- a/examples/performance-thread/common/lthread_tls.c
+++ b/examples/performance-thread/common/lthread_tls.c
@@ -18,7 +18,6 @@
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_ring.h>
-#include <rte_atomic_64.h>
 
 #include "lthread_tls.h"
 #include "lthread_queue.h"
@@ -52,8 +51,10 @@ void _lthread_key_pool_init(void)
 
 	bzero(key_table, sizeof(key_table));
 
+	uint64_t pool_init = 0;
 	/* only one lcore should do this */
-	if (rte_atomic64_cmpset(&key_pool_init, 0, 1)) {
+	if (__atomic_compare_exchange_n(&key_pool_init, &pool_init, 1, 0,
+			__ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 
 		snprintf(name,
 			MAX_LTHREAD_NAME_SIZE,
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 2f593abf26..ba9ad034e6 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -26,7 +26,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
@@ -570,8 +569,8 @@ RTE_DEFINE_PER_LCORE(struct lcore_conf *, lcore_conf);
  */
 static int lthreads_on = 1; /**< Use lthreads for processing*/
 
-rte_atomic16_t rx_counter;  /**< Number of spawned rx threads */
-rte_atomic16_t tx_counter;  /**< Number of spawned tx threads */
+uint16_t rx_counter;  /**< Number of spawned rx threads */
+uint16_t tx_counter;  /**< Number of spawned tx threads */
 
 struct thread_conf {
 	uint16_t lcore_id;      /**< Initial lcore for rx thread */
@@ -1910,11 +1909,8 @@ cpu_load_collector(__rte_unused void *arg) {
 	printf("Waiting for %d rx threads and %d tx threads\n", n_rx_thread,
 			n_tx_thread);
 
-	while (rte_atomic16_read(&rx_counter) < n_rx_thread)
-		rte_pause();
-
-	while (rte_atomic16_read(&tx_counter) < n_tx_thread)
-		rte_pause();
+	rte_wait_until_equal_16(&rx_counter, n_rx_thread, __ATOMIC_RELAXED);
+	rte_wait_until_equal_16(&tx_counter, n_tx_thread, __ATOMIC_RELAXED);
 
 	for (i = 0; i < n_rx_thread; i++) {
 
@@ -2036,7 +2032,7 @@ lthread_tx_per_ring(void *dummy)
 	RTE_LOG(INFO, L3FWD, "entering main tx loop on lcore %u\n", rte_lcore_id());
 
 	nb_rx = 0;
-	rte_atomic16_inc(&tx_counter);
+	__atomic_fetch_add(&tx_counter, 1, __ATOMIC_RELAXED);
 	while (1) {
 
 		/*
@@ -2161,7 +2157,7 @@ lthread_rx(void *dummy)
 	worker_id = 0;
 
 	rx_conf->conf.cpu_id = sched_getcpu();
-	rte_atomic16_inc(&rx_counter);
+	__atomic_fetch_add(&rx_counter, 1, __ATOMIC_RELAXED);
 	while (1) {
 
 		/*
@@ -2243,7 +2239,7 @@ lthread_spawner(__rte_unused void *arg)
 	 * scheduler as this lthread, yielding is required to let them to run and
 	 * prevent deadlock here.
 	 */
-	while (rte_atomic16_read(&rx_counter) < n_rx_thread)
+	while (__atomic_load_n(&rx_counter, __ATOMIC_RELAXED) < n_rx_thread)
 		lthread_sleep(100000);
 
 	/*
@@ -2323,7 +2319,7 @@ pthread_tx(void *dummy)
 	RTE_LOG(INFO, L3FWD, "Entering main Tx loop on lcore %u\n", rte_lcore_id());
 
 	tx_conf->conf.cpu_id = sched_getcpu();
-	rte_atomic16_inc(&tx_counter);
+	__atomic_fetch_add(&tx_counter, 1, __ATOMIC_RELAXED);
 	while (1) {
 
 		cur_tsc = rte_rdtsc();
@@ -2406,7 +2402,7 @@ pthread_rx(void *dummy)
 
 	worker_id = 0;
 	rx_conf->conf.cpu_id = sched_getcpu();
-	rte_atomic16_inc(&rx_counter);
+	__atomic_fetch_add(&rx_counter, 1, __ATOMIC_RELAXED);
 	while (1) {
 
 		/*
-- 
2.17.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 5/8] examples/l2fwd-jobstats: use compiler atomics for stats sync
  2021-08-23  5:49 [dpdk-dev] [PATCH v2 0/8] use compiler atomic builtins for examples Joyce Kong
                   ` (3 preceding siblings ...)
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 4/8] examples/performance-thread: use compiler atomics for sync Joyce Kong
@ 2021-08-23  5:49 ` Joyce Kong
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 6/8] examples/vm_power_manager: use compiler atomics for sync Joyce Kong
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Joyce Kong @ 2021-08-23  5:49 UTC (permalink / raw)
  Cc: dev, thomas, david.marchand, honnappa.nagarahalli, ruifeng.wang, nd

Convert rte_atomic usages to compiler atomic built-ins
for stats_read_pending sync in l2fwd_jobstats module.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/l2fwd-jobstats/main.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index bbb4a27a6d..99a17de181 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -16,7 +16,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
@@ -81,7 +80,7 @@ struct lcore_queue_conf {
 	struct rte_jobstats idle_job;
 	struct rte_jobstats_context jobs_context;
 
-	rte_atomic16_t stats_read_pending;
+	uint16_t stats_read_pending;
 	rte_spinlock_t lock;
 } __rte_cache_aligned;
 /* >8 End of list of queues to be polled for given lcore. */
@@ -155,9 +154,9 @@ show_lcore_stats(unsigned lcore_id)
 	uint64_t collection_time = rte_get_timer_cycles();
 
 	/* Ask forwarding thread to give us stats. */
-	rte_atomic16_set(&qconf->stats_read_pending, 1);
+	__atomic_store_n(&qconf->stats_read_pending, 1, __ATOMIC_RELAXED);
 	rte_spinlock_lock(&qconf->lock);
-	rte_atomic16_set(&qconf->stats_read_pending, 0);
+	__atomic_store_n(&qconf->stats_read_pending, 0, __ATOMIC_RELAXED);
 
 	/* Collect context statistics. */
 	stats_period = ctx->state_time - ctx->start_time;
@@ -526,8 +525,8 @@ l2fwd_main_loop(void)
 				repeats++;
 				need_manage = qconf->flush_timer.expire < now;
 				/* Check if we was esked to give a stats. */
-				stats_read_pending =
-						rte_atomic16_read(&qconf->stats_read_pending);
+				stats_read_pending = __atomic_load_n(&qconf->stats_read_pending,
+						__ATOMIC_RELAXED);
 				need_manage |= stats_read_pending;
 
 				for (i = 0; i < qconf->n_rx_port && !need_manage; i++)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 6/8] examples/vm_power_manager: use compiler atomics for sync
  2021-08-23  5:49 [dpdk-dev] [PATCH v2 0/8] use compiler atomic builtins for examples Joyce Kong
                   ` (4 preceding siblings ...)
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 5/8] examples/l2fwd-jobstats: use compiler atomics for stats sync Joyce Kong
@ 2021-08-23  5:49 ` Joyce Kong
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 7/8] examples/server_node_efd: " Joyce Kong
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Joyce Kong @ 2021-08-23  5:49 UTC (permalink / raw)
  To: David Hunt
  Cc: dev, thomas, david.marchand, honnappa.nagarahalli, ruifeng.wang, nd

Convert rte_atomic32_cmpset to compiler atomic CAS
operation for channel status sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/vm_power_manager/channel_monitor.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 99f81544d7..3c20406f7c 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -25,7 +25,6 @@
 #include <rte_log.h>
 #include <rte_memory.h>
 #include <rte_malloc.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_ethdev.h>
 #ifdef RTE_NET_I40E
@@ -829,8 +828,9 @@ process_request(struct rte_power_channel_packet *pkt,
 	if (chan_info == NULL)
 		return -1;
 
-	if (rte_atomic32_cmpset(&(chan_info->status), CHANNEL_MGR_CHANNEL_CONNECTED,
-			CHANNEL_MGR_CHANNEL_PROCESSING) == 0)
+	uint32_t channel_connected = CHANNEL_MGR_CHANNEL_CONNECTED;
+	if (__atomic_compare_exchange_n(&(chan_info->status), &channel_connected,
+		CHANNEL_MGR_CHANNEL_PROCESSING, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED) == 0)
 		return -1;
 
 	if (pkt->command == RTE_POWER_CPU_POWER) {
@@ -934,8 +934,9 @@ process_request(struct rte_power_channel_packet *pkt,
 	 * Return is not checked as channel status may have been set to DISABLED
 	 * from management thread
 	 */
-	rte_atomic32_cmpset(&(chan_info->status), CHANNEL_MGR_CHANNEL_PROCESSING,
-			CHANNEL_MGR_CHANNEL_CONNECTED);
+	uint32_t channel_processing = CHANNEL_MGR_CHANNEL_PROCESSING;
+	__atomic_compare_exchange_n(&(chan_info->status), &channel_processing,
+		CHANNEL_MGR_CHANNEL_CONNECTED, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
 	return 0;
 
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 7/8] examples/server_node_efd: use compiler atomics for sync
  2021-08-23  5:49 [dpdk-dev] [PATCH v2 0/8] use compiler atomic builtins for examples Joyce Kong
                   ` (5 preceding siblings ...)
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 6/8] examples/vm_power_manager: use compiler atomics for sync Joyce Kong
@ 2021-08-23  5:49 ` Joyce Kong
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 8/8] examples: remove unnecessary include of atomic Joyce Kong
  2021-10-13 18:53 ` [dpdk-dev] [PATCH v3 0/8] use compiler atomic builtins for examples Dharmik Thakkar
  8 siblings, 0 replies; 21+ messages in thread
From: Joyce Kong @ 2021-08-23  5:49 UTC (permalink / raw)
  To: Byron Marohn, Yipeng Wang
  Cc: dev, thomas, david.marchand, honnappa.nagarahalli, ruifeng.wang, nd

Convert rte_atomic32_test_and_set to compiler CAS atomic
operation for display_stats sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/server_node_efd/server/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c
index 7d07131dbf..b69beb012c 100644
--- a/examples/server_node_efd/server/main.c
+++ b/examples/server_node_efd/server/main.c
@@ -22,7 +22,6 @@
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
 #include <rte_branch_prediction.h>
-#include <rte_atomic.h>
 #include <rte_ring.h>
 #include <rte_log.h>
 #include <rte_debug.h>
@@ -180,10 +179,12 @@ static int
 sleep_lcore(__rte_unused void *dummy)
 {
 	/* Used to pick a display thread - static, so zero-initialised */
-	static rte_atomic32_t display_stats;
+	static uint32_t display_stats;
 
 	/* Only one core should display stats */
-	if (rte_atomic32_test_and_set(&display_stats)) {
+	uint32_t display_init = 0;
+	if (__atomic_compare_exchange_n(&display_stats, &display_init, 1, 0,
+			__ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 		const unsigned int sleeptime = 1;
 
 		printf("Core %u displaying statistics\n", rte_lcore_id());
-- 
2.17.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 8/8] examples: remove unnecessary include of atomic
  2021-08-23  5:49 [dpdk-dev] [PATCH v2 0/8] use compiler atomic builtins for examples Joyce Kong
                   ` (6 preceding siblings ...)
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 7/8] examples/server_node_efd: " Joyce Kong
@ 2021-08-23  5:49 ` Joyce Kong
  2021-08-23 11:29   ` Xia, Chenbo
  2021-10-13 18:53 ` [dpdk-dev] [PATCH v3 0/8] use compiler atomic builtins for examples Dharmik Thakkar
  8 siblings, 1 reply; 21+ messages in thread
From: Joyce Kong @ 2021-08-23  5:49 UTC (permalink / raw)
  To: Chas Williams, Min Hu (Connor),
	Konstantin Ananyev, Radu Nicolau, Akhil Goyal, Declan Doherty,
	Sunil Kumar Kori, Pavan Nikhilesh, Bruce Richardson, David Hunt,
	Anatoly Burakov, Byron Marohn, Yipeng Wang, Maxime Coquelin,
	Chenbo Xia
  Cc: dev, thomas, david.marchand, honnappa.nagarahalli, ruifeng.wang, nd

Remove the unnecessary header file rte_atomic.h
included in example module.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/bond/main.c                                       | 1 -
 examples/ip_fragmentation/main.c                           | 1 -
 examples/ip_reassembly/main.c                              | 1 -
 examples/ipsec-secgw/ipsec-secgw.c                         | 1 -
 examples/ipv4_multicast/main.c                             | 1 -
 examples/l2fwd-crypto/main.c                               | 1 -
 examples/l2fwd-event/l2fwd_common.h                        | 1 -
 examples/l2fwd-event/l2fwd_event.c                         | 1 -
 examples/l2fwd-keepalive/main.c                            | 1 -
 examples/l2fwd/main.c                                      | 1 -
 examples/l3fwd-acl/main.c                                  | 1 -
 examples/l3fwd-power/main.c                                | 1 -
 examples/l3fwd/main.c                                      | 1 -
 examples/link_status_interrupt/main.c                      | 1 -
 examples/multi_process/client_server_mp/mp_client/client.c | 1 -
 examples/multi_process/client_server_mp/mp_server/init.c   | 1 -
 examples/multi_process/simple_mp/main.c                    | 1 -
 examples/multi_process/simple_mp/mp_commands.c             | 1 -
 examples/multi_process/symmetric_mp/main.c                 | 1 -
 examples/server_node_efd/node/node.c                       | 1 -
 examples/server_node_efd/server/init.c                     | 1 -
 examples/vhost_blk/blk.c                                   | 1 -
 examples/vhost_blk/vhost_blk.c                             | 1 -
 examples/vm_power_manager/channel_manager.c                | 1 -
 examples/vm_power_manager/channel_manager.h                | 1 -
 examples/vmdq/main.c                                       | 1 -
 examples/vmdq_dcb/main.c                                   | 1 -
 27 files changed, 27 deletions(-)

diff --git a/examples/bond/main.c b/examples/bond/main.c
index f48400e211..de1e995a8a 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -24,7 +24,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index f245369720..f965624c8b 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -21,7 +21,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index 8645ac790b..6a8e91673d 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -22,7 +22,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index f252d34985..012b908410 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -24,7 +24,6 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c
index cc527d7f6b..5830ad61c1 100644
--- a/examples/ipv4_multicast/main.c
+++ b/examples/ipv4_multicast/main.c
@@ -20,7 +20,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 5f539c458c..e302ad022c 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -20,7 +20,6 @@
 #include <unistd.h>
 
 #include <rte_string_fns.h>
-#include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
diff --git a/examples/l2fwd-event/l2fwd_common.h b/examples/l2fwd-event/l2fwd_common.h
index 939221d45a..1a418e6a22 100644
--- a/examples/l2fwd-event/l2fwd_common.h
+++ b/examples/l2fwd-event/l2fwd_common.h
@@ -27,7 +27,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/l2fwd-event/l2fwd_event.c b/examples/l2fwd-event/l2fwd_event.c
index 7ba5311d66..acfacfa4fb 100644
--- a/examples/l2fwd-event/l2fwd_event.c
+++ b/examples/l2fwd-event/l2fwd_event.c
@@ -5,7 +5,6 @@
 #include <stdbool.h>
 #include <getopt.h>
 
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_ethdev.h>
 #include <rte_eventdev.h>
diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
index 4e1a17cfe4..cb7f267259 100644
--- a/examples/l2fwd-keepalive/main.c
+++ b/examples/l2fwd-keepalive/main.c
@@ -24,7 +24,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 911e40c66e..56a0663111 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -24,7 +24,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index a1f457b564..2a942731bc 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -20,7 +20,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index aa7b8db44a..c29b4fe034 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -24,7 +24,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 00ac267af1..518fefe90b 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -24,7 +24,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
index 7470aa539a..302a267e0e 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -22,7 +22,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c
index 6d4c246816..087c38ef73 100644
--- a/examples/multi_process/client_server_mp/mp_client/client.c
+++ b/examples/multi_process/client_server_mp/mp_client/client.c
@@ -17,7 +17,6 @@
 #include <rte_memory.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
-#include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_log.h>
 #include <rte_per_lcore.h>
diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c
index 1ad71ca7ec..be669c2bcc 100644
--- a/examples/multi_process/client_server_mp/mp_server/init.c
+++ b/examples/multi_process/client_server_mp/mp_server/init.c
@@ -15,7 +15,6 @@
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_byteorder.h>
-#include <rte_atomic.h>
 #include <rte_launch.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
diff --git a/examples/multi_process/simple_mp/main.c b/examples/multi_process/simple_mp/main.c
index df996f0f84..5df2a39000 100644
--- a/examples/multi_process/simple_mp/main.c
+++ b/examples/multi_process/simple_mp/main.c
@@ -30,7 +30,6 @@
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
 #include <rte_debug.h>
-#include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_ring.h>
 #include <rte_log.h>
diff --git a/examples/multi_process/simple_mp/mp_commands.c b/examples/multi_process/simple_mp/mp_commands.c
index 311d0fe775..a5f91b00be 100644
--- a/examples/multi_process/simple_mp/mp_commands.c
+++ b/examples/multi_process/simple_mp/mp_commands.c
@@ -14,7 +14,6 @@
 #include <rte_common.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_launch.h>
 #include <rte_log.h>
diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index 01dc3acf34..a66328ba0c 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -31,7 +31,6 @@
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
-#include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c
index 4580a44e3e..ba1c7e5153 100644
--- a/examples/server_node_efd/node/node.c
+++ b/examples/server_node_efd/node/node.c
@@ -17,7 +17,6 @@
 #include <rte_memory.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
-#include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_log.h>
 #include <rte_per_lcore.h>
diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/server/init.c
index 9ebd88bac2..a19934dbe0 100644
--- a/examples/server_node_efd/server/init.c
+++ b/examples/server_node_efd/server/init.c
@@ -15,7 +15,6 @@
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_byteorder.h>
-#include <rte_atomic.h>
 #include <rte_launch.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
diff --git a/examples/vhost_blk/blk.c b/examples/vhost_blk/blk.c
index f8c8549b3a..d082ab3c94 100644
--- a/examples/vhost_blk/blk.c
+++ b/examples/vhost_blk/blk.c
@@ -15,7 +15,6 @@
 #include <string.h>
 #include <stddef.h>
 
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
diff --git a/examples/vhost_blk/vhost_blk.c b/examples/vhost_blk/vhost_blk.c
index fe2b4e4803..9e291dc442 100644
--- a/examples/vhost_blk/vhost_blk.c
+++ b/examples/vhost_blk/vhost_blk.c
@@ -17,7 +17,6 @@
 #include <linux/virtio_blk.h>
 #include <linux/virtio_ring.h>
 
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index fe91567854..838465ab4b 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -21,7 +21,6 @@
 #include <rte_memory.h>
 #include <rte_mempool.h>
 #include <rte_log.h>
-#include <rte_atomic.h>
 #include <rte_spinlock.h>
 
 #include <libvirt/libvirt.h>
diff --git a/examples/vm_power_manager/channel_manager.h b/examples/vm_power_manager/channel_manager.h
index e55376fcdb..7038e9d83b 100644
--- a/examples/vm_power_manager/channel_manager.h
+++ b/examples/vm_power_manager/channel_manager.h
@@ -11,7 +11,6 @@ extern "C" {
 
 #include <linux/limits.h>
 #include <linux/un.h>
-#include <rte_atomic.h>
 #include <stdbool.h>
 
 /* Maximum name length including '\0' terminator */
diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
index d3bc19f78e..a958ad2167 100644
--- a/examples/vmdq/main.c
+++ b/examples/vmdq/main.c
@@ -20,7 +20,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c
index 685a03bdd1..52e930f83a 100644
--- a/examples/vmdq_dcb/main.c
+++ b/examples/vmdq_dcb/main.c
@@ -20,7 +20,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
-- 
2.17.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v2 8/8] examples: remove unnecessary include of atomic
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 8/8] examples: remove unnecessary include of atomic Joyce Kong
@ 2021-08-23 11:29   ` Xia, Chenbo
  2021-08-24  2:30     ` Joyce Kong
  0 siblings, 1 reply; 21+ messages in thread
From: Xia, Chenbo @ 2021-08-23 11:29 UTC (permalink / raw)
  To: Joyce Kong, Chas Williams, Min Hu (Connor),
	Ananyev, Konstantin, Nicolau, Radu, Akhil Goyal, Doherty, Declan,
	Sunil Kumar Kori, Pavan Nikhilesh, Richardson, Bruce, Hunt,
	David, Burakov, Anatoly, Marohn, Byron, Wang, Yipeng1,
	Maxime Coquelin
  Cc: dev, thomas, david.marchand, honnappa.nagarahalli, ruifeng.wang, nd

Hi Joyce,

> -----Original Message-----
> From: Joyce Kong <joyce.kong@arm.com>
> Sent: Monday, August 23, 2021 1:50 PM
> To: Chas Williams <chas3@att.com>; Min Hu (Connor) <humin29@huawei.com>;
> Ananyev, Konstantin <konstantin.ananyev@intel.com>; Nicolau, Radu
> <radu.nicolau@intel.com>; Akhil Goyal <gakhil@marvell.com>; Doherty, Declan
> <declan.doherty@intel.com>; Sunil Kumar Kori <skori@marvell.com>; Pavan
> Nikhilesh <pbhagavatula@marvell.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Hunt, David <david.hunt@intel.com>; Burakov,
> Anatoly <anatoly.burakov@intel.com>; Marohn, Byron <byron.marohn@intel.com>;
> Wang, Yipeng1 <yipeng1.wang@intel.com>; Maxime Coquelin
> <maxime.coquelin@redhat.com>; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; thomas@monjalon.net; david.marchand@redhat.com;
> honnappa.nagarahalli@arm.com; ruifeng.wang@arm.com; nd@arm.com
> Subject: [PATCH v2 8/8] examples: remove unnecessary include of atomic
> 
> Remove the unnecessary header file rte_atomic.h
> included in example module.
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  examples/bond/main.c                                       | 1 -
>  examples/ip_fragmentation/main.c                           | 1 -
>  examples/ip_reassembly/main.c                              | 1 -
>  examples/ipsec-secgw/ipsec-secgw.c                         | 1 -
>  examples/ipv4_multicast/main.c                             | 1 -
>  examples/l2fwd-crypto/main.c                               | 1 -
>  examples/l2fwd-event/l2fwd_common.h                        | 1 -
>  examples/l2fwd-event/l2fwd_event.c                         | 1 -
>  examples/l2fwd-keepalive/main.c                            | 1 -
>  examples/l2fwd/main.c                                      | 1 -
>  examples/l3fwd-acl/main.c                                  | 1 -
>  examples/l3fwd-power/main.c                                | 1 -
>  examples/l3fwd/main.c                                      | 1 -
>  examples/link_status_interrupt/main.c                      | 1 -
>  examples/multi_process/client_server_mp/mp_client/client.c | 1 -
>  examples/multi_process/client_server_mp/mp_server/init.c   | 1 -
>  examples/multi_process/simple_mp/main.c                    | 1 -
>  examples/multi_process/simple_mp/mp_commands.c             | 1 -
>  examples/multi_process/symmetric_mp/main.c                 | 1 -
>  examples/server_node_efd/node/node.c                       | 1 -
>  examples/server_node_efd/server/init.c                     | 1 -
>  examples/vhost_blk/blk.c                                   | 1 -
>  examples/vhost_blk/vhost_blk.c                             | 1 -

In vhost_blk.c, some atomic API is used (rte_atomic_thread_fence).
Although it compiles well, I think it's better to keep the include
rather than depending on other header includes rte_atomic.h.

Thanks,
Chenbo

>  examples/vm_power_manager/channel_manager.c                | 1 -
>  examples/vm_power_manager/channel_manager.h                | 1 -
>  examples/vmdq/main.c                                       | 1 -
>  examples/vmdq_dcb/main.c                                   | 1 -
>  27 files changed, 27 deletions(-)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v2 8/8] examples: remove unnecessary include of atomic
  2021-08-23 11:29   ` Xia, Chenbo
@ 2021-08-24  2:30     ` Joyce Kong
  0 siblings, 0 replies; 21+ messages in thread
From: Joyce Kong @ 2021-08-24  2:30 UTC (permalink / raw)
  To: Xia, Chenbo, Chas Williams, Min Hu (Connor),
	Ananyev, Konstantin, Nicolau, Radu, Akhil Goyal, Doherty, Declan,
	Sunil Kumar Kori, Pavan Nikhilesh, Richardson, Bruce, Hunt,
	David, Burakov, Anatoly, Marohn, Byron, Wang, Yipeng1,
	Maxime Coquelin
  Cc: dev, thomas, david.marchand, Honnappa Nagarahalli, Ruifeng Wang, nd

<snip>

> Hi Joyce,
> 
> > -----Original Message-----
> > From: Joyce Kong <joyce.kong@arm.com>
> > Sent: Monday, August 23, 2021 1:50 PM
> > To: Chas Williams <chas3@att.com>; Min Hu (Connor)
> > <humin29@huawei.com>; Ananyev, Konstantin
> > <konstantin.ananyev@intel.com>; Nicolau, Radu
> > <radu.nicolau@intel.com>; Akhil Goyal <gakhil@marvell.com>; Doherty,
> > Declan <declan.doherty@intel.com>; Sunil Kumar Kori
> > <skori@marvell.com>; Pavan Nikhilesh <pbhagavatula@marvell.com>;
> > Richardson, Bruce <bruce.richardson@intel.com>; Hunt, David
> > <david.hunt@intel.com>; Burakov, Anatoly <anatoly.burakov@intel.com>;
> > Marohn, Byron <byron.marohn@intel.com>; Wang, Yipeng1
> > <yipeng1.wang@intel.com>; Maxime Coquelin
> > <maxime.coquelin@redhat.com>; Xia, Chenbo <chenbo.xia@intel.com>
> > Cc: dev@dpdk.org; thomas@monjalon.net; david.marchand@redhat.com;
> > honnappa.nagarahalli@arm.com; ruifeng.wang@arm.com; nd@arm.com
> > Subject: [PATCH v2 8/8] examples: remove unnecessary include of atomic
> >
> > Remove the unnecessary header file rte_atomic.h included in example
> > module.
> >
> > Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > ---
> >  examples/bond/main.c                                       | 1 -
> >  examples/ip_fragmentation/main.c                           | 1 -
> >  examples/ip_reassembly/main.c                              | 1 -
> >  examples/ipsec-secgw/ipsec-secgw.c                         | 1 -
> >  examples/ipv4_multicast/main.c                             | 1 -
> >  examples/l2fwd-crypto/main.c                               | 1 -
> >  examples/l2fwd-event/l2fwd_common.h                        | 1 -
> >  examples/l2fwd-event/l2fwd_event.c                         | 1 -
> >  examples/l2fwd-keepalive/main.c                            | 1 -
> >  examples/l2fwd/main.c                                      | 1 -
> >  examples/l3fwd-acl/main.c                                  | 1 -
> >  examples/l3fwd-power/main.c                                | 1 -
> >  examples/l3fwd/main.c                                      | 1 -
> >  examples/link_status_interrupt/main.c                      | 1 -
> >  examples/multi_process/client_server_mp/mp_client/client.c | 1 -
> >  examples/multi_process/client_server_mp/mp_server/init.c   | 1 -
> >  examples/multi_process/simple_mp/main.c                    | 1 -
> >  examples/multi_process/simple_mp/mp_commands.c             | 1 -
> >  examples/multi_process/symmetric_mp/main.c                 | 1 -
> >  examples/server_node_efd/node/node.c                       | 1 -
> >  examples/server_node_efd/server/init.c                     | 1 -
> >  examples/vhost_blk/blk.c                                   | 1 -
> >  examples/vhost_blk/vhost_blk.c                             | 1 -
> 
> In vhost_blk.c, some atomic API is used (rte_atomic_thread_fence).
> Although it compiles well, I think it's better to keep the include rather than
> depending on other header includes rte_atomic.h.
> 
> Thanks,
> Chenbo
> 

Hi Chenbo, thanks for your suggestion, I'll rework with this patch in next version.

Joyce

> >  examples/vm_power_manager/channel_manager.c                | 1 -
> >  examples/vm_power_manager/channel_manager.h                | 1 -
> >  examples/vmdq/main.c                                       | 1 -
> >  examples/vmdq_dcb/main.c                                   | 1 -
> >  27 files changed, 27 deletions(-)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 0/8] use compiler atomic builtins for examples
  2021-08-23  5:49 [dpdk-dev] [PATCH v2 0/8] use compiler atomic builtins for examples Joyce Kong
                   ` (7 preceding siblings ...)
  2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 8/8] examples: remove unnecessary include of atomic Joyce Kong
@ 2021-10-13 18:53 ` Dharmik Thakkar
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 1/8] examples/bbdev_app: use compiler atomics for flag sync Dharmik Thakkar
                     ` (7 more replies)
  8 siblings, 8 replies; 21+ messages in thread
From: Dharmik Thakkar @ 2021-10-13 18:53 UTC (permalink / raw)
  Cc: dev, nd, honnappa.nagarahalli, ruifeng.wang, joyce.kong, dharmik.thakkar

Since atomic operations have been adopted in DPDK now[1],
change rte_atomicNN_xxx APIs to compiler's atomic built-ins
in examples module[2].

[1] https://www.dpdk.org/blog/2021/03/26/dpdk-adopts-the-c11-memory-model/
[2] https://doc.dpdk.org/guides/rel_notes/deprecation.html

v3:
  Keep rte_atomic.h in examples/vhost_blk/vhost_blk.c (Chenbo)

v2:
  Fix the compiling error of performance-thread patch.

Joyce Kong (8):
  examples/bbdev_app: use compiler atomics for flag sync
  examples/multi_process: use compiler atomics for sync
  examples/kni: use compiler atomics for status sync
  examples/performance-thread: use compiler atomics for sync
  examples/l2fwd-jobstats: use compiler atomics for stats sync
  examples/vm_power_manager: use compiler atomics for sync
  examples/server_node_efd: use compiler atomics for sync
  examples: remove unnecessary include of atomic

 examples/bbdev_app/main.c                     | 13 ++++---
 examples/bond/main.c                          |  1 -
 examples/ip_fragmentation/main.c              |  1 -
 examples/ip_reassembly/main.c                 |  1 -
 examples/ipsec-secgw/ipsec-secgw.c            |  1 -
 examples/ipv4_multicast/main.c                |  1 -
 examples/kni/main.c                           | 27 +++++++--------
 examples/l2fwd-crypto/main.c                  |  1 -
 examples/l2fwd-event/l2fwd_common.h           |  1 -
 examples/l2fwd-event/l2fwd_event.c            |  1 -
 examples/l2fwd-jobstats/main.c                | 11 +++---
 examples/l2fwd-keepalive/main.c               |  1 -
 examples/l2fwd/main.c                         |  1 -
 examples/l3fwd-acl/main.c                     |  1 -
 examples/l3fwd-power/main.c                   |  1 -
 examples/l3fwd/main.c                         |  1 -
 examples/link_status_interrupt/main.c         |  1 -
 .../client_server_mp/mp_client/client.c       |  1 -
 .../client_server_mp/mp_server/init.c         |  1 -
 .../client_server_mp/mp_server/main.c         |  7 ++--
 examples/multi_process/simple_mp/main.c       |  1 -
 .../multi_process/simple_mp/mp_commands.c     |  1 -
 examples/multi_process/symmetric_mp/main.c    |  1 -
 examples/performance-thread/common/lthread.c  | 10 +++---
 .../performance-thread/common/lthread_diag.h  | 10 +++---
 .../performance-thread/common/lthread_int.h   |  1 -
 .../performance-thread/common/lthread_mutex.c | 26 +++++++-------
 .../performance-thread/common/lthread_mutex.h |  2 +-
 .../performance-thread/common/lthread_sched.c | 34 ++++++++-----------
 .../performance-thread/common/lthread_tls.c   |  5 +--
 .../performance-thread/l3fwd-thread/main.c    | 22 +++++-------
 examples/server_node_efd/node/node.c          |  1 -
 examples/server_node_efd/server/init.c        |  1 -
 examples/server_node_efd/server/main.c        |  7 ++--
 examples/vhost_blk/blk.c                      |  1 -
 examples/vm_power_manager/channel_manager.c   |  1 -
 examples/vm_power_manager/channel_manager.h   |  1 -
 examples/vm_power_manager/channel_monitor.c   | 11 +++---
 examples/vmdq/main.c                          |  1 -
 examples/vmdq_dcb/main.c                      |  1 -
 40 files changed, 91 insertions(+), 121 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 1/8] examples/bbdev_app: use compiler atomics for flag sync
  2021-10-13 18:53 ` [dpdk-dev] [PATCH v3 0/8] use compiler atomic builtins for examples Dharmik Thakkar
@ 2021-10-13 18:54   ` Dharmik Thakkar
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 2/8] examples/multi_process: use compiler atomics for sync Dharmik Thakkar
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Dharmik Thakkar @ 2021-10-13 18:54 UTC (permalink / raw)
  To: Nicolas Chautru
  Cc: dev, nd, honnappa.nagarahalli, ruifeng.wang, joyce.kong, dharmik.thakkar

From: Joyce Kong <joyce.kong@arm.com>

Convert rte_atomic usages to compiler atomic built-ins
for global_exit_flag sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/bbdev_app/main.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index adbd40808396..95fd0b814494 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -18,7 +18,6 @@
 #include <getopt.h>
 #include <signal.h>
 
-#include <rte_atomic.h>
 #include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_cycles.h>
@@ -167,7 +166,7 @@ static const struct app_config_params def_app_config = {
 	.num_dec_cores = 1,
 };
 
-static rte_atomic16_t global_exit_flag;
+static uint16_t global_exit_flag;
 
 /* display usage */
 static inline void
@@ -279,7 +278,7 @@ static void
 signal_handler(int signum)
 {
 	printf("\nSignal %d received\n", signum);
-	rte_atomic16_set(&global_exit_flag, 1);
+	__atomic_store_n(&global_exit_flag, 1, __ATOMIC_RELAXED);
 }
 
 static void
@@ -323,7 +322,7 @@ check_port_link_status(uint16_t port_id)
 	fflush(stdout);
 
 	for (count = 0; count <= MAX_CHECK_TIME &&
-			!rte_atomic16_read(&global_exit_flag); count++) {
+			!__atomic_load_n(&global_exit_flag, __ATOMIC_RELAXED); count++) {
 		memset(&link, 0, sizeof(link));
 		link_get_err = rte_eth_link_get_nowait(port_id, &link);
 
@@ -677,7 +676,7 @@ stats_loop(void *arg)
 {
 	struct stats_lcore_params *stats_lcore = arg;
 
-	while (!rte_atomic16_read(&global_exit_flag)) {
+	while (!__atomic_load_n(&global_exit_flag, __ATOMIC_RELAXED)) {
 		print_stats(stats_lcore);
 		rte_delay_ms(500);
 	}
@@ -923,7 +922,7 @@ processing_loop(void *arg)
 	const bool run_decoder = (lcore_conf->core_type &
 			(1 << RTE_BBDEV_OP_TURBO_DEC));
 
-	while (!rte_atomic16_read(&global_exit_flag)) {
+	while (!__atomic_load_n(&global_exit_flag, __ATOMIC_RELAXED)) {
 		if (run_encoder)
 			run_encoding(lcore_conf);
 		if (run_decoder)
@@ -1057,7 +1056,7 @@ main(int argc, char **argv)
 		.align = __alignof__(struct rte_mbuf *),
 	};
 
-	rte_atomic16_init(&global_exit_flag);
+	__atomic_store_n(&global_exit_flag, 0, __ATOMIC_RELAXED);
 
 	sigret = signal(SIGTERM, signal_handler);
 	if (sigret == SIG_ERR)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 2/8] examples/multi_process: use compiler atomics for sync
  2021-10-13 18:53 ` [dpdk-dev] [PATCH v3 0/8] use compiler atomic builtins for examples Dharmik Thakkar
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 1/8] examples/bbdev_app: use compiler atomics for flag sync Dharmik Thakkar
@ 2021-10-13 18:54   ` Dharmik Thakkar
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 3/8] examples/kni: use compiler atomics for status sync Dharmik Thakkar
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Dharmik Thakkar @ 2021-10-13 18:54 UTC (permalink / raw)
  To: Anatoly Burakov
  Cc: dev, nd, honnappa.nagarahalli, ruifeng.wang, joyce.kong, dharmik.thakkar

From: Joyce Kong <joyce.kong@arm.com>

Convert rte_atomic32_test_and_set usage to compiler atomic
CAS operation for display_stats sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/multi_process/client_server_mp/mp_server/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c
index 9bcee460fd24..b4761ebc7b05 100644
--- a/examples/multi_process/client_server_mp/mp_server/main.c
+++ b/examples/multi_process/client_server_mp/mp_server/main.c
@@ -20,7 +20,6 @@
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
 #include <rte_branch_prediction.h>
-#include <rte_atomic.h>
 #include <rte_ring.h>
 #include <rte_log.h>
 #include <rte_debug.h>
@@ -158,10 +157,12 @@ static int
 sleep_lcore(__rte_unused void *dummy)
 {
 	/* Used to pick a display thread - static, so zero-initialised */
-	static rte_atomic32_t display_stats;
+	static uint32_t display_stats;
 
+	uint32_t status = 0;
 	/* Only one core should display stats */
-	if (rte_atomic32_test_and_set(&display_stats)) {
+	if (__atomic_compare_exchange_n(&display_stats, &status, 1, 0,
+			__ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 		const unsigned sleeptime = 1;
 		printf("Core %u displaying statistics\n", rte_lcore_id());
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 3/8] examples/kni: use compiler atomics for status sync
  2021-10-13 18:53 ` [dpdk-dev] [PATCH v3 0/8] use compiler atomic builtins for examples Dharmik Thakkar
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 1/8] examples/bbdev_app: use compiler atomics for flag sync Dharmik Thakkar
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 2/8] examples/multi_process: use compiler atomics for sync Dharmik Thakkar
@ 2021-10-13 18:54   ` Dharmik Thakkar
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 4/8] examples/performance-thread: use compiler atomics for sync Dharmik Thakkar
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Dharmik Thakkar @ 2021-10-13 18:54 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: dev, nd, honnappa.nagarahalli, ruifeng.wang, joyce.kong, dharmik.thakkar

From: Joyce Kong <joyce.kong@arm.com>

Convert rte_atomic usages to compiler atomic builit-ins
for kni_stop and kni_pause sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/kni/main.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/examples/kni/main.c b/examples/kni/main.c
index 2a993a0ca460..4d049d844e0b 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -27,7 +27,6 @@
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_lcore.h>
 #include <rte_branch_prediction.h>
 #include <rte_interrupts.h>
@@ -131,8 +130,8 @@ static int kni_change_mtu(uint16_t port_id, unsigned int new_mtu);
 static int kni_config_network_interface(uint16_t port_id, uint8_t if_up);
 static int kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]);
 
-static rte_atomic32_t kni_stop = RTE_ATOMIC32_INIT(0);
-static rte_atomic32_t kni_pause = RTE_ATOMIC32_INIT(0);
+static uint32_t kni_stop;
+static uint32_t kni_pause;
 
 /* Print out statistics on packets handled */
 static void
@@ -185,7 +184,7 @@ signal_handler(int signum)
 	if (signum == SIGRTMIN || signum == SIGINT || signum == SIGTERM) {
 		printf("\nSIGRTMIN/SIGINT/SIGTERM received. "
 			"KNI processing stopping.\n");
-		rte_atomic32_inc(&kni_stop);
+		__atomic_fetch_add(&kni_stop, 1, __ATOMIC_RELAXED);
 		return;
         }
 }
@@ -311,8 +310,8 @@ main_loop(__rte_unused void *arg)
 					kni_port_params_array[i]->lcore_rx,
 					kni_port_params_array[i]->port_id);
 		while (1) {
-			f_stop = rte_atomic32_read(&kni_stop);
-			f_pause = rte_atomic32_read(&kni_pause);
+			f_stop = __atomic_load_n(&kni_stop, __ATOMIC_RELAXED);
+			f_pause = __atomic_load_n(&kni_pause, __ATOMIC_RELAXED);
 			if (f_stop)
 				break;
 			if (f_pause)
@@ -324,8 +323,8 @@ main_loop(__rte_unused void *arg)
 					kni_port_params_array[i]->lcore_tx,
 					kni_port_params_array[i]->port_id);
 		while (1) {
-			f_stop = rte_atomic32_read(&kni_stop);
-			f_pause = rte_atomic32_read(&kni_pause);
+			f_stop = __atomic_load_n(&kni_stop, __ATOMIC_RELAXED);
+			f_pause = __atomic_load_n(&kni_pause, __ATOMIC_RELAXED);
 			if (f_stop)
 				break;
 			if (f_pause)
@@ -856,9 +855,9 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
 {
 	int ret;
 
-	rte_atomic32_inc(&kni_pause);
+	__atomic_fetch_add(&kni_pause, 1, __ATOMIC_RELAXED);
 	ret =  kni_change_mtu_(port_id, new_mtu);
-	rte_atomic32_dec(&kni_pause);
+	__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
 
 	return ret;
 }
@@ -877,14 +876,14 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up)
 	RTE_LOG(INFO, APP, "Configure network interface of %d %s\n",
 					port_id, if_up ? "up" : "down");
 
-	rte_atomic32_inc(&kni_pause);
+	__atomic_fetch_add(&kni_pause, 1, __ATOMIC_RELAXED);
 
 	if (if_up != 0) { /* Configure network interface up */
 		ret = rte_eth_dev_stop(port_id);
 		if (ret != 0) {
 			RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
 				port_id, rte_strerror(-ret));
-			rte_atomic32_dec(&kni_pause);
+			__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
 			return ret;
 		}
 		ret = rte_eth_dev_start(port_id);
@@ -893,12 +892,12 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up)
 		if (ret != 0) {
 			RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
 				port_id, rte_strerror(-ret));
-			rte_atomic32_dec(&kni_pause);
+			__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
 			return ret;
 		}
 	}
 
-	rte_atomic32_dec(&kni_pause);
+	__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);
 
 	if (ret < 0)
 		RTE_LOG(ERR, APP, "Failed to start port %d\n", port_id);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 4/8] examples/performance-thread: use compiler atomics for sync
  2021-10-13 18:53 ` [dpdk-dev] [PATCH v3 0/8] use compiler atomic builtins for examples Dharmik Thakkar
                     ` (2 preceding siblings ...)
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 3/8] examples/kni: use compiler atomics for status sync Dharmik Thakkar
@ 2021-10-13 18:54   ` Dharmik Thakkar
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 5/8] examples/l2fwd-jobstats: use compiler atomics for stats sync Dharmik Thakkar
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Dharmik Thakkar @ 2021-10-13 18:54 UTC (permalink / raw)
  To: John McNamara
  Cc: dev, nd, honnappa.nagarahalli, ruifeng.wang, joyce.kong, dharmik.thakkar

From: Joyce Kong <joyce.kong@arm.com>

Convert rte_atomic usages to compiler atomic built-ins
for thread sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/performance-thread/common/lthread.c  | 10 +++---
 .../performance-thread/common/lthread_diag.h  | 10 +++---
 .../performance-thread/common/lthread_int.h   |  1 -
 .../performance-thread/common/lthread_mutex.c | 26 +++++++-------
 .../performance-thread/common/lthread_mutex.h |  2 +-
 .../performance-thread/common/lthread_sched.c | 34 ++++++++-----------
 .../performance-thread/common/lthread_tls.c   |  5 +--
 .../performance-thread/l3fwd-thread/main.c    | 22 +++++-------
 8 files changed, 53 insertions(+), 57 deletions(-)

diff --git a/examples/performance-thread/common/lthread.c b/examples/performance-thread/common/lthread.c
index 3f1f48db433e..98123f34f840 100644
--- a/examples/performance-thread/common/lthread.c
+++ b/examples/performance-thread/common/lthread.c
@@ -357,9 +357,10 @@ void lthread_exit(void *ptr)
 	 *  - if exit before join then we suspend and resume on join
 	 *  - if join before exit then we resume the joining thread
 	 */
+	uint64_t join_initial = LT_JOIN_INITIAL;
 	if ((lt->join == LT_JOIN_INITIAL)
-	    && rte_atomic64_cmpset(&lt->join, LT_JOIN_INITIAL,
-				   LT_JOIN_EXITING)) {
+	    && __atomic_compare_exchange_n(&lt->join, &join_initial,
+		LT_JOIN_EXITING, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 
 		DIAG_EVENT(lt, LT_DIAG_LTHREAD_EXIT, 1, 0);
 		_suspend();
@@ -415,9 +416,10 @@ int lthread_join(struct lthread *lt, void **ptr)
 	 *  - if join before exit we suspend and will resume when exit is called
 	 *  - if exit before join we resume the exiting thread
 	 */
+	uint64_t join_initial = LT_JOIN_INITIAL;
 	if ((lt->join == LT_JOIN_INITIAL)
-	    && rte_atomic64_cmpset(&lt->join, LT_JOIN_INITIAL,
-				   LT_JOIN_THREAD_SET)) {
+	    && __atomic_compare_exchange_n(&lt->join, &join_initial,
+		LT_JOIN_THREAD_SET, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 
 		DIAG_EVENT(current, LT_DIAG_LTHREAD_JOIN, lt, 1);
 		_suspend();
diff --git a/examples/performance-thread/common/lthread_diag.h b/examples/performance-thread/common/lthread_diag.h
index e876dda6da3a..7ee89eef388d 100644
--- a/examples/performance-thread/common/lthread_diag.h
+++ b/examples/performance-thread/common/lthread_diag.h
@@ -78,11 +78,11 @@ extern uint64_t diag_mask;
 	}								\
 } while (0)
 
-#define DIAG_COUNT_DEFINE(x) rte_atomic64_t count_##x
-#define DIAG_COUNT_INIT(o, x) rte_atomic64_init(&((o)->count_##x))
-#define DIAG_COUNT_INC(o, x) rte_atomic64_inc(&((o)->count_##x))
-#define DIAG_COUNT_DEC(o, x) rte_atomic64_dec(&((o)->count_##x))
-#define DIAG_COUNT(o, x) rte_atomic64_read(&((o)->count_##x))
+#define DIAG_COUNT_DEFINE(x) uint64_t count_##x
+#define DIAG_COUNT_INIT(o, x) __atomic_store_n(&((o)->count_##x), 0, __ATOMIC_RELAXED)
+#define DIAG_COUNT_INC(o, x) __atomic_fetch_add(&((o)->count_##x), 1, __ATOMIC_RELAXED)
+#define DIAG_COUNT_DEC(o, x) __atomic_fetch_sub(&((o)->count_##x), 1, __ATOMIC_RELAXED)
+#define DIAG_COUNT(o, x) __atomic_load_n(&((o)->count_##x), __ATOMIC_RELAXED)
 
 #define DIAG_USED
 
diff --git a/examples/performance-thread/common/lthread_int.h b/examples/performance-thread/common/lthread_int.h
index a352f13b7568..d010126f1681 100644
--- a/examples/performance-thread/common/lthread_int.h
+++ b/examples/performance-thread/common/lthread_int.h
@@ -21,7 +21,6 @@ extern "C" {
 #include <rte_cycles.h>
 #include <rte_per_lcore.h>
 #include <rte_timer.h>
-#include <rte_atomic_64.h>
 #include <rte_spinlock.h>
 #include <ctx.h>
 
diff --git a/examples/performance-thread/common/lthread_mutex.c b/examples/performance-thread/common/lthread_mutex.c
index 01da6cad4f61..061fc5c19a6b 100644
--- a/examples/performance-thread/common/lthread_mutex.c
+++ b/examples/performance-thread/common/lthread_mutex.c
@@ -60,7 +60,7 @@ lthread_mutex_init(char *name, struct lthread_mutex **mutex,
 	m->root_sched = THIS_SCHED;
 	m->owner = NULL;
 
-	rte_atomic64_init(&m->count);
+	__atomic_store_n(&m->count, 0, __ATOMIC_RELAXED);
 
 	DIAG_CREATE_EVENT(m, LT_DIAG_MUTEX_CREATE);
 	/* success */
@@ -115,10 +115,11 @@ int lthread_mutex_lock(struct lthread_mutex *m)
 	}
 
 	for (;;) {
-		rte_atomic64_inc(&m->count);
+		__atomic_fetch_add(&m->count, 1, __ATOMIC_RELAXED);
 		do {
-			if (rte_atomic64_cmpset
-			    ((uint64_t *) &m->owner, 0, (uint64_t) lt)) {
+			uint64_t lt_init = 0;
+			if (__atomic_compare_exchange_n((uint64_t *) &m->owner, &lt_init,
+				(uint64_t) lt, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 				/* happy days, we got the lock */
 				DIAG_EVENT(m, LT_DIAG_MUTEX_LOCK, m, 0);
 				return 0;
@@ -126,7 +127,7 @@ int lthread_mutex_lock(struct lthread_mutex *m)
 			/* spin due to race with unlock when
 			* nothing was blocked
 			*/
-		} while ((rte_atomic64_read(&m->count) == 1) &&
+		} while ((__atomic_load_n(&m->count, __ATOMIC_RELAXED) == 1) &&
 				(m->owner == NULL));
 
 		/* queue the current thread in the blocked queue
@@ -160,16 +161,17 @@ int lthread_mutex_trylock(struct lthread_mutex *m)
 		return POSIX_ERRNO(EDEADLK);
 	}
 
-	rte_atomic64_inc(&m->count);
-	if (rte_atomic64_cmpset
-	    ((uint64_t *) &m->owner, (uint64_t) NULL, (uint64_t) lt)) {
+	__atomic_fetch_add(&m->count, 1, __ATOMIC_RELAXED);
+	uint64_t lt_init = 0;
+	if (__atomic_compare_exchange_n((uint64_t *) &m->owner, &lt_init,
+		(uint64_t) lt, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 		/* got the lock */
 		DIAG_EVENT(m, LT_DIAG_MUTEX_TRYLOCK, m, 0);
 		return 0;
 	}
 
 	/* failed so return busy */
-	rte_atomic64_dec(&m->count);
+	__atomic_fetch_sub(&m->count, 1, __ATOMIC_RELAXED);
 	DIAG_EVENT(m, LT_DIAG_MUTEX_TRYLOCK, m, POSIX_ERRNO(EBUSY));
 	return POSIX_ERRNO(EBUSY);
 }
@@ -193,13 +195,13 @@ int lthread_mutex_unlock(struct lthread_mutex *m)
 		return POSIX_ERRNO(EPERM);
 	}
 
-	rte_atomic64_dec(&m->count);
+	__atomic_fetch_sub(&m->count, 1, __ATOMIC_RELAXED);
 	/* if there are blocked threads then make one ready */
-	while (rte_atomic64_read(&m->count) > 0) {
+	while (__atomic_load_n(&m->count, __ATOMIC_RELAXED) > 0) {
 		unblocked = _lthread_queue_remove(m->blocked);
 
 		if (unblocked != NULL) {
-			rte_atomic64_dec(&m->count);
+			__atomic_fetch_sub(&m->count, 1, __ATOMIC_RELAXED);
 			DIAG_EVENT(m, LT_DIAG_MUTEX_UNLOCKED, m, unblocked);
 			RTE_ASSERT(unblocked->sched != NULL);
 			_ready_queue_insert((struct lthread_sched *)
diff --git a/examples/performance-thread/common/lthread_mutex.h b/examples/performance-thread/common/lthread_mutex.h
index cd866f87b889..730092bdf8bb 100644
--- a/examples/performance-thread/common/lthread_mutex.h
+++ b/examples/performance-thread/common/lthread_mutex.h
@@ -17,7 +17,7 @@ extern "C" {
 
 struct lthread_mutex {
 	struct lthread *owner;
-	rte_atomic64_t	count;
+	uint64_t count;
 	struct lthread_queue *blocked __rte_cache_aligned;
 	struct lthread_sched *root_sched;
 	char			name[MAX_MUTEX_NAME_SIZE];
diff --git a/examples/performance-thread/common/lthread_sched.c b/examples/performance-thread/common/lthread_sched.c
index 38ca0c45cbf8..3784b010c221 100644
--- a/examples/performance-thread/common/lthread_sched.c
+++ b/examples/performance-thread/common/lthread_sched.c
@@ -22,8 +22,6 @@
 
 #include <rte_prefetch.h>
 #include <rte_per_lcore.h>
-#include <rte_atomic.h>
-#include <rte_atomic_64.h>
 #include <rte_log.h>
 #include <rte_common.h>
 #include <rte_branch_prediction.h>
@@ -47,8 +45,8 @@
  * When a scheduler shuts down it is assumed that the application is terminating
  */
 
-static rte_atomic16_t num_schedulers;
-static rte_atomic16_t active_schedulers;
+static uint16_t num_schedulers;
+static uint16_t active_schedulers;
 
 /* one scheduler per lcore */
 RTE_DEFINE_PER_LCORE(struct lthread_sched *, this_sched) = NULL;
@@ -64,10 +62,8 @@ uint64_t diag_mask;
 RTE_INIT(lthread_sched_ctor)
 {
 	memset(schedcore, 0, sizeof(schedcore));
-	rte_atomic16_init(&num_schedulers);
-	rte_atomic16_set(&num_schedulers, 1);
-	rte_atomic16_init(&active_schedulers);
-	rte_atomic16_set(&active_schedulers, 0);
+	__atomic_store_n(&num_schedulers, 1, __ATOMIC_RELAXED);
+	__atomic_store_n(&active_schedulers, 0, __ATOMIC_RELAXED);
 	diag_cb = NULL;
 }
 
@@ -260,8 +256,8 @@ struct lthread_sched *_lthread_sched_create(size_t stack_size)
  */
 int lthread_num_schedulers_set(int num)
 {
-	rte_atomic16_set(&num_schedulers, num);
-	return (int)rte_atomic16_read(&num_schedulers);
+	__atomic_store_n(&num_schedulers, num, __ATOMIC_RELAXED);
+	return (int)__atomic_load_n(&num_schedulers, __ATOMIC_RELAXED);
 }
 
 /*
@@ -269,7 +265,7 @@ int lthread_num_schedulers_set(int num)
  */
 int lthread_active_schedulers(void)
 {
-	return (int)rte_atomic16_read(&active_schedulers);
+	return (int)__atomic_load_n(&active_schedulers, __ATOMIC_RELAXED);
 }
 
 
@@ -299,8 +295,8 @@ void lthread_scheduler_shutdown_all(void)
 	 * for the possibility of a pthread wrapper on lthread_yield(),
 	 * something that is not possible unless the scheduler is running.
 	 */
-	while (rte_atomic16_read(&active_schedulers) <
-	       rte_atomic16_read(&num_schedulers))
+	while (__atomic_load_n(&active_schedulers, __ATOMIC_RELAXED) <
+	       __atomic_load_n(&num_schedulers, __ATOMIC_RELAXED))
 		sched_yield();
 
 	for (i = 0; i < LTHREAD_MAX_LCORES; i++) {
@@ -415,15 +411,15 @@ static inline int _lthread_sched_isdone(struct lthread_sched *sched)
  */
 static inline void _lthread_schedulers_sync_start(void)
 {
-	rte_atomic16_inc(&active_schedulers);
+	__atomic_fetch_add(&active_schedulers, 1, __ATOMIC_RELAXED);
 
 	/* wait for lthread schedulers
 	 * Note we use sched_yield() rather than pthread_yield() to allow
 	 * for the possibility of a pthread wrapper on lthread_yield(),
 	 * something that is not possible unless the scheduler is running.
 	 */
-	while (rte_atomic16_read(&active_schedulers) <
-	       rte_atomic16_read(&num_schedulers))
+	while (__atomic_load_n(&active_schedulers, __ATOMIC_RELAXED) <
+	       __atomic_load_n(&num_schedulers, __ATOMIC_RELAXED))
 		sched_yield();
 
 }
@@ -433,15 +429,15 @@ static inline void _lthread_schedulers_sync_start(void)
  */
 static inline void _lthread_schedulers_sync_stop(void)
 {
-	rte_atomic16_dec(&active_schedulers);
-	rte_atomic16_dec(&num_schedulers);
+	__atomic_fetch_sub(&active_schedulers, 1, __ATOMIC_RELAXED);
+	__atomic_fetch_sub(&num_schedulers, 1, __ATOMIC_RELAXED);
 
 	/* wait for schedulers
 	 * Note we use sched_yield() rather than pthread_yield() to allow
 	 * for the possibility of a pthread wrapper on lthread_yield(),
 	 * something that is not possible unless the scheduler is running.
 	 */
-	while (rte_atomic16_read(&active_schedulers) > 0)
+	while (__atomic_load_n(&active_schedulers, __ATOMIC_RELAXED) > 0)
 		sched_yield();
 
 }
diff --git a/examples/performance-thread/common/lthread_tls.c b/examples/performance-thread/common/lthread_tls.c
index 07de6cafabf5..4ab2e3558b1c 100644
--- a/examples/performance-thread/common/lthread_tls.c
+++ b/examples/performance-thread/common/lthread_tls.c
@@ -18,7 +18,6 @@
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_ring.h>
-#include <rte_atomic_64.h>
 
 #include "lthread_tls.h"
 #include "lthread_queue.h"
@@ -52,8 +51,10 @@ void _lthread_key_pool_init(void)
 
 	bzero(key_table, sizeof(key_table));
 
+	uint64_t pool_init = 0;
 	/* only one lcore should do this */
-	if (rte_atomic64_cmpset(&key_pool_init, 0, 1)) {
+	if (__atomic_compare_exchange_n(&key_pool_init, &pool_init, 1, 0,
+			__ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 
 		snprintf(name,
 			MAX_LTHREAD_NAME_SIZE,
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 2905199743a7..50ecc4e820f6 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -26,7 +26,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
@@ -570,8 +569,8 @@ RTE_DEFINE_PER_LCORE(struct lcore_conf *, lcore_conf);
  */
 static int lthreads_on = 1; /**< Use lthreads for processing*/
 
-rte_atomic16_t rx_counter;  /**< Number of spawned rx threads */
-rte_atomic16_t tx_counter;  /**< Number of spawned tx threads */
+uint16_t rx_counter;  /**< Number of spawned rx threads */
+uint16_t tx_counter;  /**< Number of spawned tx threads */
 
 struct thread_conf {
 	uint16_t lcore_id;      /**< Initial lcore for rx thread */
@@ -1910,11 +1909,8 @@ cpu_load_collector(__rte_unused void *arg) {
 	printf("Waiting for %d rx threads and %d tx threads\n", n_rx_thread,
 			n_tx_thread);
 
-	while (rte_atomic16_read(&rx_counter) < n_rx_thread)
-		rte_pause();
-
-	while (rte_atomic16_read(&tx_counter) < n_tx_thread)
-		rte_pause();
+	rte_wait_until_equal_16(&rx_counter, n_rx_thread, __ATOMIC_RELAXED);
+	rte_wait_until_equal_16(&tx_counter, n_tx_thread, __ATOMIC_RELAXED);
 
 	for (i = 0; i < n_rx_thread; i++) {
 
@@ -2036,7 +2032,7 @@ lthread_tx_per_ring(void *dummy)
 	RTE_LOG(INFO, L3FWD, "entering main tx loop on lcore %u\n", rte_lcore_id());
 
 	nb_rx = 0;
-	rte_atomic16_inc(&tx_counter);
+	__atomic_fetch_add(&tx_counter, 1, __ATOMIC_RELAXED);
 	while (1) {
 
 		/*
@@ -2161,7 +2157,7 @@ lthread_rx(void *dummy)
 	worker_id = 0;
 
 	rx_conf->conf.cpu_id = sched_getcpu();
-	rte_atomic16_inc(&rx_counter);
+	__atomic_fetch_add(&rx_counter, 1, __ATOMIC_RELAXED);
 	while (1) {
 
 		/*
@@ -2243,7 +2239,7 @@ lthread_spawner(__rte_unused void *arg)
 	 * scheduler as this lthread, yielding is required to let them to run and
 	 * prevent deadlock here.
 	 */
-	while (rte_atomic16_read(&rx_counter) < n_rx_thread)
+	while (__atomic_load_n(&rx_counter, __ATOMIC_RELAXED) < n_rx_thread)
 		lthread_sleep(100000);
 
 	/*
@@ -2323,7 +2319,7 @@ pthread_tx(void *dummy)
 	RTE_LOG(INFO, L3FWD, "Entering main Tx loop on lcore %u\n", rte_lcore_id());
 
 	tx_conf->conf.cpu_id = sched_getcpu();
-	rte_atomic16_inc(&tx_counter);
+	__atomic_fetch_add(&tx_counter, 1, __ATOMIC_RELAXED);
 	while (1) {
 
 		cur_tsc = rte_rdtsc();
@@ -2406,7 +2402,7 @@ pthread_rx(void *dummy)
 
 	worker_id = 0;
 	rx_conf->conf.cpu_id = sched_getcpu();
-	rte_atomic16_inc(&rx_counter);
+	__atomic_fetch_add(&rx_counter, 1, __ATOMIC_RELAXED);
 	while (1) {
 
 		/*
-- 
2.25.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 5/8] examples/l2fwd-jobstats: use compiler atomics for stats sync
  2021-10-13 18:53 ` [dpdk-dev] [PATCH v3 0/8] use compiler atomic builtins for examples Dharmik Thakkar
                     ` (3 preceding siblings ...)
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 4/8] examples/performance-thread: use compiler atomics for sync Dharmik Thakkar
@ 2021-10-13 18:54   ` Dharmik Thakkar
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 6/8] examples/vm_power_manager: use compiler atomics for sync Dharmik Thakkar
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Dharmik Thakkar @ 2021-10-13 18:54 UTC (permalink / raw)
  Cc: dev, nd, honnappa.nagarahalli, ruifeng.wang, joyce.kong, dharmik.thakkar

From: Joyce Kong <joyce.kong@arm.com>

Convert rte_atomic usages to compiler atomic built-ins
for stats_read_pending sync in l2fwd_jobstats module.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/l2fwd-jobstats/main.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index 06280321b1f2..62981663ea78 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -16,7 +16,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
@@ -81,7 +80,7 @@ struct lcore_queue_conf {
 	struct rte_jobstats idle_job;
 	struct rte_jobstats_context jobs_context;
 
-	rte_atomic16_t stats_read_pending;
+	uint16_t stats_read_pending;
 	rte_spinlock_t lock;
 } __rte_cache_aligned;
 /* >8 End of list of queues to be polled for given lcore. */
@@ -155,9 +154,9 @@ show_lcore_stats(unsigned lcore_id)
 	uint64_t collection_time = rte_get_timer_cycles();
 
 	/* Ask forwarding thread to give us stats. */
-	rte_atomic16_set(&qconf->stats_read_pending, 1);
+	__atomic_store_n(&qconf->stats_read_pending, 1, __ATOMIC_RELAXED);
 	rte_spinlock_lock(&qconf->lock);
-	rte_atomic16_set(&qconf->stats_read_pending, 0);
+	__atomic_store_n(&qconf->stats_read_pending, 0, __ATOMIC_RELAXED);
 
 	/* Collect context statistics. */
 	stats_period = ctx->state_time - ctx->start_time;
@@ -526,8 +525,8 @@ l2fwd_main_loop(void)
 				repeats++;
 				need_manage = qconf->flush_timer.expire < now;
 				/* Check if we was esked to give a stats. */
-				stats_read_pending =
-						rte_atomic16_read(&qconf->stats_read_pending);
+				stats_read_pending = __atomic_load_n(&qconf->stats_read_pending,
+						__ATOMIC_RELAXED);
 				need_manage |= stats_read_pending;
 
 				for (i = 0; i < qconf->n_rx_port && !need_manage; i++)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 6/8] examples/vm_power_manager: use compiler atomics for sync
  2021-10-13 18:53 ` [dpdk-dev] [PATCH v3 0/8] use compiler atomic builtins for examples Dharmik Thakkar
                     ` (4 preceding siblings ...)
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 5/8] examples/l2fwd-jobstats: use compiler atomics for stats sync Dharmik Thakkar
@ 2021-10-13 18:54   ` Dharmik Thakkar
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 7/8] examples/server_node_efd: " Dharmik Thakkar
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 8/8] examples: remove unnecessary include of atomic Dharmik Thakkar
  7 siblings, 0 replies; 21+ messages in thread
From: Dharmik Thakkar @ 2021-10-13 18:54 UTC (permalink / raw)
  To: David Hunt
  Cc: dev, nd, honnappa.nagarahalli, ruifeng.wang, joyce.kong, dharmik.thakkar

From: Joyce Kong <joyce.kong@arm.com>

Convert rte_atomic32_cmpset to compiler atomic CAS
operation for channel status sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/vm_power_manager/channel_monitor.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index f03102eb1b93..d767423a401b 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -25,7 +25,6 @@
 #include <rte_log.h>
 #include <rte_memory.h>
 #include <rte_malloc.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_ethdev.h>
 #ifdef RTE_NET_I40E
@@ -827,8 +826,9 @@ process_request(struct rte_power_channel_packet *pkt,
 	if (chan_info == NULL)
 		return -1;
 
-	if (rte_atomic32_cmpset(&(chan_info->status), CHANNEL_MGR_CHANNEL_CONNECTED,
-			CHANNEL_MGR_CHANNEL_PROCESSING) == 0)
+	uint32_t channel_connected = CHANNEL_MGR_CHANNEL_CONNECTED;
+	if (__atomic_compare_exchange_n(&(chan_info->status), &channel_connected,
+		CHANNEL_MGR_CHANNEL_PROCESSING, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED) == 0)
 		return -1;
 
 	if (pkt->command == RTE_POWER_CPU_POWER) {
@@ -932,8 +932,9 @@ process_request(struct rte_power_channel_packet *pkt,
 	 * Return is not checked as channel status may have been set to DISABLED
 	 * from management thread
 	 */
-	rte_atomic32_cmpset(&(chan_info->status), CHANNEL_MGR_CHANNEL_PROCESSING,
-			CHANNEL_MGR_CHANNEL_CONNECTED);
+	uint32_t channel_processing = CHANNEL_MGR_CHANNEL_PROCESSING;
+	__atomic_compare_exchange_n(&(chan_info->status), &channel_processing,
+		CHANNEL_MGR_CHANNEL_CONNECTED, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
 	return 0;
 
 }
-- 
2.25.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 7/8] examples/server_node_efd: use compiler atomics for sync
  2021-10-13 18:53 ` [dpdk-dev] [PATCH v3 0/8] use compiler atomic builtins for examples Dharmik Thakkar
                     ` (5 preceding siblings ...)
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 6/8] examples/vm_power_manager: use compiler atomics for sync Dharmik Thakkar
@ 2021-10-13 18:54   ` Dharmik Thakkar
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 8/8] examples: remove unnecessary include of atomic Dharmik Thakkar
  7 siblings, 0 replies; 21+ messages in thread
From: Dharmik Thakkar @ 2021-10-13 18:54 UTC (permalink / raw)
  To: Byron Marohn, Yipeng Wang
  Cc: dev, nd, honnappa.nagarahalli, ruifeng.wang, joyce.kong, dharmik.thakkar

From: Joyce Kong <joyce.kong@arm.com>

Convert rte_atomic32_test_and_set to compiler CAS atomic
operation for display_stats sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/server_node_efd/server/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c
index 0d0d5679e4c4..fd72882e3a1c 100644
--- a/examples/server_node_efd/server/main.c
+++ b/examples/server_node_efd/server/main.c
@@ -22,7 +22,6 @@
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
 #include <rte_branch_prediction.h>
-#include <rte_atomic.h>
 #include <rte_ring.h>
 #include <rte_log.h>
 #include <rte_debug.h>
@@ -178,10 +177,12 @@ static int
 sleep_lcore(__rte_unused void *dummy)
 {
 	/* Used to pick a display thread - static, so zero-initialised */
-	static rte_atomic32_t display_stats;
+	static uint32_t display_stats;
 
 	/* Only one core should display stats */
-	if (rte_atomic32_test_and_set(&display_stats)) {
+	uint32_t display_init = 0;
+	if (__atomic_compare_exchange_n(&display_stats, &display_init, 1, 0,
+			__ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
 		const unsigned int sleeptime = 1;
 
 		printf("Core %u displaying statistics\n", rte_lcore_id());
-- 
2.25.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 8/8] examples: remove unnecessary include of atomic
  2021-10-13 18:53 ` [dpdk-dev] [PATCH v3 0/8] use compiler atomic builtins for examples Dharmik Thakkar
                     ` (6 preceding siblings ...)
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 7/8] examples/server_node_efd: " Dharmik Thakkar
@ 2021-10-13 18:54   ` Dharmik Thakkar
  2021-10-15 23:30     ` Dharmik Thakkar
  7 siblings, 1 reply; 21+ messages in thread
From: Dharmik Thakkar @ 2021-10-13 18:54 UTC (permalink / raw)
  To: Chas Williams, Min Hu (Connor),
	Konstantin Ananyev, Radu Nicolau, Akhil Goyal, Declan Doherty,
	Sunil Kumar Kori, Pavan Nikhilesh, Bruce Richardson, David Hunt,
	Anatoly Burakov, Byron Marohn, Yipeng Wang, Maxime Coquelin,
	Chenbo Xia
  Cc: dev, nd, honnappa.nagarahalli, ruifeng.wang, joyce.kong, dharmik.thakkar

From: Joyce Kong <joyce.kong@arm.com>

Remove the unnecessary header file rte_atomic.h
included in example module.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 examples/bond/main.c                                       | 1 -
 examples/ip_fragmentation/main.c                           | 1 -
 examples/ip_reassembly/main.c                              | 1 -
 examples/ipsec-secgw/ipsec-secgw.c                         | 1 -
 examples/ipv4_multicast/main.c                             | 1 -
 examples/l2fwd-crypto/main.c                               | 1 -
 examples/l2fwd-event/l2fwd_common.h                        | 1 -
 examples/l2fwd-event/l2fwd_event.c                         | 1 -
 examples/l2fwd-keepalive/main.c                            | 1 -
 examples/l2fwd/main.c                                      | 1 -
 examples/l3fwd-acl/main.c                                  | 1 -
 examples/l3fwd-power/main.c                                | 1 -
 examples/l3fwd/main.c                                      | 1 -
 examples/link_status_interrupt/main.c                      | 1 -
 examples/multi_process/client_server_mp/mp_client/client.c | 1 -
 examples/multi_process/client_server_mp/mp_server/init.c   | 1 -
 examples/multi_process/simple_mp/main.c                    | 1 -
 examples/multi_process/simple_mp/mp_commands.c             | 1 -
 examples/multi_process/symmetric_mp/main.c                 | 1 -
 examples/server_node_efd/node/node.c                       | 1 -
 examples/server_node_efd/server/init.c                     | 1 -
 examples/vhost_blk/blk.c                                   | 1 -
 examples/vm_power_manager/channel_manager.c                | 1 -
 examples/vm_power_manager/channel_manager.h                | 1 -
 examples/vmdq/main.c                                       | 1 -
 examples/vmdq_dcb/main.c                                   | 1 -
 26 files changed, 26 deletions(-)

diff --git a/examples/bond/main.c b/examples/bond/main.c
index 7adaa93cad5c..ed39b7237fbb 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -24,7 +24,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index a7f40970f27f..cc338f4269b0 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -21,7 +21,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index d611c7d01609..f513e2f87937 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -22,7 +22,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 7b01872c6f9f..393e30d78063 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -24,7 +24,6 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c
index d10de30ddbae..818843c8b6c8 100644
--- a/examples/ipv4_multicast/main.c
+++ b/examples/ipv4_multicast/main.c
@@ -20,7 +20,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index c2ffbdd50636..83bbea89c703 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -20,7 +20,6 @@
 #include <unistd.h>
 
 #include <rte_string_fns.h>
-#include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
 #include <rte_cryptodev.h>
diff --git a/examples/l2fwd-event/l2fwd_common.h b/examples/l2fwd-event/l2fwd_common.h
index cecbd9b70e31..ad453b4dc983 100644
--- a/examples/l2fwd-event/l2fwd_common.h
+++ b/examples/l2fwd-event/l2fwd_common.h
@@ -27,7 +27,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/l2fwd-event/l2fwd_event.c b/examples/l2fwd-event/l2fwd_event.c
index 7ba5311d6688..acfacfa4fb34 100644
--- a/examples/l2fwd-event/l2fwd_event.c
+++ b/examples/l2fwd-event/l2fwd_event.c
@@ -5,7 +5,6 @@
 #include <stdbool.h>
 #include <getopt.h>
 
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_ethdev.h>
 #include <rte_eventdev.h>
diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
index 07271affb4a9..af59d51b3ec4 100644
--- a/examples/l2fwd-keepalive/main.c
+++ b/examples/l2fwd-keepalive/main.c
@@ -24,7 +24,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index f3deeba0a665..8feb50e0f542 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -24,7 +24,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index 60545f305934..add5e3c7c459 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -20,7 +20,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 73a3ab5bc0eb..be0d4f161685 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -24,7 +24,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 00ac267af1dd..518fefe90b90 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -24,7 +24,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
index e4542df11f87..ce8ae059d789 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -22,7 +22,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c
index 6d4c2468164f..087c38ef73c8 100644
--- a/examples/multi_process/client_server_mp/mp_client/client.c
+++ b/examples/multi_process/client_server_mp/mp_client/client.c
@@ -17,7 +17,6 @@
 #include <rte_memory.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
-#include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_log.h>
 #include <rte_per_lcore.h>
diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c
index 1ad71ca7ec5f..be669c2bcc06 100644
--- a/examples/multi_process/client_server_mp/mp_server/init.c
+++ b/examples/multi_process/client_server_mp/mp_server/init.c
@@ -15,7 +15,6 @@
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_byteorder.h>
-#include <rte_atomic.h>
 #include <rte_launch.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
diff --git a/examples/multi_process/simple_mp/main.c b/examples/multi_process/simple_mp/main.c
index df996f0f84e1..5df2a3900012 100644
--- a/examples/multi_process/simple_mp/main.c
+++ b/examples/multi_process/simple_mp/main.c
@@ -30,7 +30,6 @@
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
 #include <rte_debug.h>
-#include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_ring.h>
 #include <rte_log.h>
diff --git a/examples/multi_process/simple_mp/mp_commands.c b/examples/multi_process/simple_mp/mp_commands.c
index 311d0fe77538..a5f91b00be36 100644
--- a/examples/multi_process/simple_mp/mp_commands.c
+++ b/examples/multi_process/simple_mp/mp_commands.c
@@ -14,7 +14,6 @@
 #include <rte_common.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
-#include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_launch.h>
 #include <rte_log.h>
diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index 01dc3acf34d5..a66328ba0caf 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -31,7 +31,6 @@
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
-#include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_debug.h>
 #include <rte_interrupts.h>
diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c
index 4580a44e3e5d..ba1c7e515326 100644
--- a/examples/server_node_efd/node/node.c
+++ b/examples/server_node_efd/node/node.c
@@ -17,7 +17,6 @@
 #include <rte_memory.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
-#include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_log.h>
 #include <rte_per_lcore.h>
diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/server/init.c
index 9ebd88bac20e..a19934dbe0c8 100644
--- a/examples/server_node_efd/server/init.c
+++ b/examples/server_node_efd/server/init.c
@@ -15,7 +15,6 @@
 #include <rte_memzone.h>
 #include <rte_eal.h>
 #include <rte_byteorder.h>
-#include <rte_atomic.h>
 #include <rte_launch.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
diff --git a/examples/vhost_blk/blk.c b/examples/vhost_blk/blk.c
index f8c8549b3acc..d082ab3c94e5 100644
--- a/examples/vhost_blk/blk.c
+++ b/examples/vhost_blk/blk.c
@@ -15,7 +15,6 @@
 #include <string.h>
 #include <stddef.h>
 
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index fe915678541e..838465ab4b18 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -21,7 +21,6 @@
 #include <rte_memory.h>
 #include <rte_mempool.h>
 #include <rte_log.h>
-#include <rte_atomic.h>
 #include <rte_spinlock.h>
 
 #include <libvirt/libvirt.h>
diff --git a/examples/vm_power_manager/channel_manager.h b/examples/vm_power_manager/channel_manager.h
index e55376fcdbb1..7038e9d83bb8 100644
--- a/examples/vm_power_manager/channel_manager.h
+++ b/examples/vm_power_manager/channel_manager.h
@@ -11,7 +11,6 @@ extern "C" {
 
 #include <linux/limits.h>
 #include <linux/un.h>
-#include <rte_atomic.h>
 #include <stdbool.h>
 
 /* Maximum name length including '\0' terminator */
diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
index ee7f4324e141..85996bf864b7 100644
--- a/examples/vmdq/main.c
+++ b/examples/vmdq/main.c
@@ -20,7 +20,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c
index 14c20e6a8b26..be0179fdeaf0 100644
--- a/examples/vmdq_dcb/main.c
+++ b/examples/vmdq_dcb/main.c
@@ -20,7 +20,6 @@
 #include <rte_memcpy.h>
 #include <rte_eal.h>
 #include <rte_launch.h>
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_lcore.h>
-- 
2.25.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v3 8/8] examples: remove unnecessary include of atomic
  2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 8/8] examples: remove unnecessary include of atomic Dharmik Thakkar
@ 2021-10-15 23:30     ` Dharmik Thakkar
  0 siblings, 0 replies; 21+ messages in thread
From: Dharmik Thakkar @ 2021-10-15 23:30 UTC (permalink / raw)
  To: Chas Williams, Min Hu (Connor),
	Konstantin Ananyev, Radu Nicolau, Akhil Goyal, Declan Doherty,
	Sunil Kumar Kori, Pavan Nikhilesh, Bruce Richardson, David Hunt,
	Anatoly Burakov, Byron Marohn, Yipeng Wang, Maxime Coquelin,
	Chenbo Xia
  Cc: dev, nd, Honnappa Nagarahalli, Ruifeng Wang, Joyce Kong, David Marchand

Hi,

I am seeing the following CI failures on this series:
a) 1.3% nic_single_core_perf degradation with Mellanox ConnectX-4 Lx 40000 Mbps.
b) dpdk_unit_test failure with RHEL 7 VM due to red_autotest failure.

These issues are not related to the patch series since the patches are only targeted towards examples dir.
Another recently upstreamed patch series [1] also reported a similar CI failure.
Thus, this looks like a common CI issue.

[1]
https://lab.dpdk.org/results/dashboard/patchsets/19456/

> On Oct 13, 2021, at 1:54 PM, Dharmik Thakkar <Dharmik.Thakkar@arm.com> wrote:
> 
> From: Joyce Kong <joyce.kong@arm.com>
> 
> Remove the unnecessary header file rte_atomic.h
> included in example module.
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
> examples/bond/main.c                                       | 1 -
> examples/ip_fragmentation/main.c                           | 1 -
> examples/ip_reassembly/main.c                              | 1 -
> examples/ipsec-secgw/ipsec-secgw.c                         | 1 -
> examples/ipv4_multicast/main.c                             | 1 -
> examples/l2fwd-crypto/main.c                               | 1 -
> examples/l2fwd-event/l2fwd_common.h                        | 1 -
> examples/l2fwd-event/l2fwd_event.c                         | 1 -
> examples/l2fwd-keepalive/main.c                            | 1 -
> examples/l2fwd/main.c                                      | 1 -
> examples/l3fwd-acl/main.c                                  | 1 -
> examples/l3fwd-power/main.c                                | 1 -
> examples/l3fwd/main.c                                      | 1 -
> examples/link_status_interrupt/main.c                      | 1 -
> examples/multi_process/client_server_mp/mp_client/client.c | 1 -
> examples/multi_process/client_server_mp/mp_server/init.c   | 1 -
> examples/multi_process/simple_mp/main.c                    | 1 -
> examples/multi_process/simple_mp/mp_commands.c             | 1 -
> examples/multi_process/symmetric_mp/main.c                 | 1 -
> examples/server_node_efd/node/node.c                       | 1 -
> examples/server_node_efd/server/init.c                     | 1 -
> examples/vhost_blk/blk.c                                   | 1 -
> examples/vm_power_manager/channel_manager.c                | 1 -
> examples/vm_power_manager/channel_manager.h                | 1 -
> examples/vmdq/main.c                                       | 1 -
> examples/vmdq_dcb/main.c                                   | 1 -
> 26 files changed, 26 deletions(-)
> 
> diff --git a/examples/bond/main.c b/examples/bond/main.c
> index 7adaa93cad5c..ed39b7237fbb 100644
> --- a/examples/bond/main.c
> +++ b/examples/bond/main.c
> @@ -24,7 +24,6 @@
> #include <rte_memcpy.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
> index a7f40970f27f..cc338f4269b0 100644
> --- a/examples/ip_fragmentation/main.c
> +++ b/examples/ip_fragmentation/main.c
> @@ -21,7 +21,6 @@
> #include <rte_memcpy.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
> index d611c7d01609..f513e2f87937 100644
> --- a/examples/ip_reassembly/main.c
> +++ b/examples/ip_reassembly/main.c
> @@ -22,7 +22,6 @@
> #include <rte_memcpy.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
> index 7b01872c6f9f..393e30d78063 100644
> --- a/examples/ipsec-secgw/ipsec-secgw.c
> +++ b/examples/ipsec-secgw/ipsec-secgw.c
> @@ -24,7 +24,6 @@
> #include <rte_log.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c
> index d10de30ddbae..818843c8b6c8 100644
> --- a/examples/ipv4_multicast/main.c
> +++ b/examples/ipv4_multicast/main.c
> @@ -20,7 +20,6 @@
> #include <rte_memcpy.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
> index c2ffbdd50636..83bbea89c703 100644
> --- a/examples/l2fwd-crypto/main.c
> +++ b/examples/l2fwd-crypto/main.c
> @@ -20,7 +20,6 @@
> #include <unistd.h>
> 
> #include <rte_string_fns.h>
> -#include <rte_atomic.h>
> #include <rte_branch_prediction.h>
> #include <rte_common.h>
> #include <rte_cryptodev.h>
> diff --git a/examples/l2fwd-event/l2fwd_common.h b/examples/l2fwd-event/l2fwd_common.h
> index cecbd9b70e31..ad453b4dc983 100644
> --- a/examples/l2fwd-event/l2fwd_common.h
> +++ b/examples/l2fwd-event/l2fwd_common.h
> @@ -27,7 +27,6 @@
> #include <rte_memcpy.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> diff --git a/examples/l2fwd-event/l2fwd_event.c b/examples/l2fwd-event/l2fwd_event.c
> index 7ba5311d6688..acfacfa4fb34 100644
> --- a/examples/l2fwd-event/l2fwd_event.c
> +++ b/examples/l2fwd-event/l2fwd_event.c
> @@ -5,7 +5,6 @@
> #include <stdbool.h>
> #include <getopt.h>
> 
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_ethdev.h>
> #include <rte_eventdev.h>
> diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
> index 07271affb4a9..af59d51b3ec4 100644
> --- a/examples/l2fwd-keepalive/main.c
> +++ b/examples/l2fwd-keepalive/main.c
> @@ -24,7 +24,6 @@
> #include <rte_memcpy.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
> index f3deeba0a665..8feb50e0f542 100644
> --- a/examples/l2fwd/main.c
> +++ b/examples/l2fwd/main.c
> @@ -24,7 +24,6 @@
> #include <rte_memcpy.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
> index 60545f305934..add5e3c7c459 100644
> --- a/examples/l3fwd-acl/main.c
> +++ b/examples/l3fwd-acl/main.c
> @@ -20,7 +20,6 @@
> #include <rte_memcpy.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> index 73a3ab5bc0eb..be0d4f161685 100644
> --- a/examples/l3fwd-power/main.c
> +++ b/examples/l3fwd-power/main.c
> @@ -24,7 +24,6 @@
> #include <rte_memcpy.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
> index 00ac267af1dd..518fefe90b90 100644
> --- a/examples/l3fwd/main.c
> +++ b/examples/l3fwd/main.c
> @@ -24,7 +24,6 @@
> #include <rte_memcpy.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
> index e4542df11f87..ce8ae059d789 100644
> --- a/examples/link_status_interrupt/main.c
> +++ b/examples/link_status_interrupt/main.c
> @@ -22,7 +22,6 @@
> #include <rte_memcpy.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c
> index 6d4c2468164f..087c38ef73c8 100644
> --- a/examples/multi_process/client_server_mp/mp_client/client.c
> +++ b/examples/multi_process/client_server_mp/mp_client/client.c
> @@ -17,7 +17,6 @@
> #include <rte_memory.h>
> #include <rte_memzone.h>
> #include <rte_eal.h>
> -#include <rte_atomic.h>
> #include <rte_branch_prediction.h>
> #include <rte_log.h>
> #include <rte_per_lcore.h>
> diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c
> index 1ad71ca7ec5f..be669c2bcc06 100644
> --- a/examples/multi_process/client_server_mp/mp_server/init.c
> +++ b/examples/multi_process/client_server_mp/mp_server/init.c
> @@ -15,7 +15,6 @@
> #include <rte_memzone.h>
> #include <rte_eal.h>
> #include <rte_byteorder.h>
> -#include <rte_atomic.h>
> #include <rte_launch.h>
> #include <rte_per_lcore.h>
> #include <rte_lcore.h>
> diff --git a/examples/multi_process/simple_mp/main.c b/examples/multi_process/simple_mp/main.c
> index df996f0f84e1..5df2a3900012 100644
> --- a/examples/multi_process/simple_mp/main.c
> +++ b/examples/multi_process/simple_mp/main.c
> @@ -30,7 +30,6 @@
> #include <rte_per_lcore.h>
> #include <rte_lcore.h>
> #include <rte_debug.h>
> -#include <rte_atomic.h>
> #include <rte_branch_prediction.h>
> #include <rte_ring.h>
> #include <rte_log.h>
> diff --git a/examples/multi_process/simple_mp/mp_commands.c b/examples/multi_process/simple_mp/mp_commands.c
> index 311d0fe77538..a5f91b00be36 100644
> --- a/examples/multi_process/simple_mp/mp_commands.c
> +++ b/examples/multi_process/simple_mp/mp_commands.c
> @@ -14,7 +14,6 @@
> #include <rte_common.h>
> #include <rte_memory.h>
> #include <rte_eal.h>
> -#include <rte_atomic.h>
> #include <rte_branch_prediction.h>
> #include <rte_launch.h>
> #include <rte_log.h>
> diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
> index 01dc3acf34d5..a66328ba0caf 100644
> --- a/examples/multi_process/symmetric_mp/main.c
> +++ b/examples/multi_process/symmetric_mp/main.c
> @@ -31,7 +31,6 @@
> #include <rte_eal.h>
> #include <rte_per_lcore.h>
> #include <rte_lcore.h>
> -#include <rte_atomic.h>
> #include <rte_branch_prediction.h>
> #include <rte_debug.h>
> #include <rte_interrupts.h>
> diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c
> index 4580a44e3e5d..ba1c7e515326 100644
> --- a/examples/server_node_efd/node/node.c
> +++ b/examples/server_node_efd/node/node.c
> @@ -17,7 +17,6 @@
> #include <rte_memory.h>
> #include <rte_memzone.h>
> #include <rte_eal.h>
> -#include <rte_atomic.h>
> #include <rte_branch_prediction.h>
> #include <rte_log.h>
> #include <rte_per_lcore.h>
> diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/server/init.c
> index 9ebd88bac20e..a19934dbe0c8 100644
> --- a/examples/server_node_efd/server/init.c
> +++ b/examples/server_node_efd/server/init.c
> @@ -15,7 +15,6 @@
> #include <rte_memzone.h>
> #include <rte_eal.h>
> #include <rte_byteorder.h>
> -#include <rte_atomic.h>
> #include <rte_launch.h>
> #include <rte_per_lcore.h>
> #include <rte_lcore.h>
> diff --git a/examples/vhost_blk/blk.c b/examples/vhost_blk/blk.c
> index f8c8549b3acc..d082ab3c94e5 100644
> --- a/examples/vhost_blk/blk.c
> +++ b/examples/vhost_blk/blk.c
> @@ -15,7 +15,6 @@
> #include <string.h>
> #include <stddef.h>
> 
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_log.h>
> #include <rte_malloc.h>
> diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
> index fe915678541e..838465ab4b18 100644
> --- a/examples/vm_power_manager/channel_manager.c
> +++ b/examples/vm_power_manager/channel_manager.c
> @@ -21,7 +21,6 @@
> #include <rte_memory.h>
> #include <rte_mempool.h>
> #include <rte_log.h>
> -#include <rte_atomic.h>
> #include <rte_spinlock.h>
> 
> #include <libvirt/libvirt.h>
> diff --git a/examples/vm_power_manager/channel_manager.h b/examples/vm_power_manager/channel_manager.h
> index e55376fcdbb1..7038e9d83bb8 100644
> --- a/examples/vm_power_manager/channel_manager.h
> +++ b/examples/vm_power_manager/channel_manager.h
> @@ -11,7 +11,6 @@ extern "C" {
> 
> #include <linux/limits.h>
> #include <linux/un.h>
> -#include <rte_atomic.h>
> #include <stdbool.h>
> 
> /* Maximum name length including '\0' terminator */
> diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
> index ee7f4324e141..85996bf864b7 100644
> --- a/examples/vmdq/main.c
> +++ b/examples/vmdq/main.c
> @@ -20,7 +20,6 @@
> #include <rte_memcpy.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c
> index 14c20e6a8b26..be0179fdeaf0 100644
> --- a/examples/vmdq_dcb/main.c
> +++ b/examples/vmdq_dcb/main.c
> @@ -20,7 +20,6 @@
> #include <rte_memcpy.h>
> #include <rte_eal.h>
> #include <rte_launch.h>
> -#include <rte_atomic.h>
> #include <rte_cycles.h>
> #include <rte_prefetch.h>
> #include <rte_lcore.h>
> -- 
> 2.25.1
> 


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-10-15 23:30 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23  5:49 [dpdk-dev] [PATCH v2 0/8] use compiler atomic builtins for examples Joyce Kong
2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 1/8] examples/bbdev_app: use compiler atomics for flag sync Joyce Kong
2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 2/8] examples/multi_process: use compiler atomics for sync Joyce Kong
2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 3/8] examples/kni: use compiler atomics for status sync Joyce Kong
2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 4/8] examples/performance-thread: use compiler atomics for sync Joyce Kong
2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 5/8] examples/l2fwd-jobstats: use compiler atomics for stats sync Joyce Kong
2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 6/8] examples/vm_power_manager: use compiler atomics for sync Joyce Kong
2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 7/8] examples/server_node_efd: " Joyce Kong
2021-08-23  5:49 ` [dpdk-dev] [PATCH v2 8/8] examples: remove unnecessary include of atomic Joyce Kong
2021-08-23 11:29   ` Xia, Chenbo
2021-08-24  2:30     ` Joyce Kong
2021-10-13 18:53 ` [dpdk-dev] [PATCH v3 0/8] use compiler atomic builtins for examples Dharmik Thakkar
2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 1/8] examples/bbdev_app: use compiler atomics for flag sync Dharmik Thakkar
2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 2/8] examples/multi_process: use compiler atomics for sync Dharmik Thakkar
2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 3/8] examples/kni: use compiler atomics for status sync Dharmik Thakkar
2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 4/8] examples/performance-thread: use compiler atomics for sync Dharmik Thakkar
2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 5/8] examples/l2fwd-jobstats: use compiler atomics for stats sync Dharmik Thakkar
2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 6/8] examples/vm_power_manager: use compiler atomics for sync Dharmik Thakkar
2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 7/8] examples/server_node_efd: " Dharmik Thakkar
2021-10-13 18:54   ` [dpdk-dev] [PATCH v3 8/8] examples: remove unnecessary include of atomic Dharmik Thakkar
2021-10-15 23:30     ` Dharmik Thakkar

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git