From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29B3AC982D0 for ; Thu, 17 Sep 2026 20:13:05 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D032743289; Thu, 17 Sep 2026 22:11:44 +0200 (CEST) Received: from mail-pj2-f42.google.com (mail-pj2-f42.google.com [74.125.227.170]) by mails.dpdk.org (Postfix) with ESMTP id 63AB842FDD for ; Thu, 17 Sep 2026 22:11:39 +0200 (CEST) Received: by mail-pj2-f42.google.com with SMTP id d9443c01a7336-2ddaa08c890so389175ad.0 for ; Thu, 17 Sep 2026 13:11:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20251104.gappssmtp.com; s=20251104; t=1789675898; x=1790280698; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=UjrxmA2pT5zIXwxt9qK2KBnRK/G2I1BiLZ7w9vnJIlQ=; b=J1L7a7wD8AryWUUurHLGQIgJVn3XdpBeuIRUNXAFFDfcOMS/e/o8Y0FhLBL8P+TnY2 n731Pe9kNfGqMa63kQ1hl3SSvkMYItVlUiDzICn6Cr6OtyX/BwZf1DJlE2003VWTtTCt Km69vUZjIhT9TxN+9Tdn0EgrTZekvstLtg5lhclBznL4IIsIoDX4t5X9C0zlh03i5TdA Foj/3HgXt7GHucf7/69BfYBHLYI0QTRZX/GoOJuAmCkfztap9dqgFgosd+irSUfS3b0h SgHpw2MYkgYudVmfQMJE9mgYdyLngFIZUtLCeszShbRcaRqYSsjJcjt+sNlGVGJFDKtu yqdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789675898; x=1790280698; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=UjrxmA2pT5zIXwxt9qK2KBnRK/G2I1BiLZ7w9vnJIlQ=; b=A/GEWdQMGsTJodGxXENquH6qeyXopfcMIVFIvBp0WC/97A3U2cnZipnxwTd2bOndpf tPHswDqvJWzycZ4BQ2LF1YpkqakZPmi2O8uOPRZjK9hGNujG8SqUaJP3Ee4Zcg3Hgxi6 Xz9jMNNvZQijSoIPs4CyS7UbC/Nl53mcB4AIk9hkc1khh+UPmUzoGXQjBQJwN11kRty8 M+6GHLg+mvfFazuZ0d/LCPxHZvg3Ou9Ga9zAagBoen1R60j4W+4cOBs/KqjhEqgBxh0G EE4HqPr1hjj5KUsWczHoylKme0/Mtpem5IaLJ7QHlonhWV1kMNz35FPJNKe9vQy36XJd mRkg== X-Gm-Message-State: AFuF++n24dFTRWZLoRnu45PuHX7NgpAyvffkIgtsneKjmOoIkdrdmiEu sxRq9VmxfkMaWpjt9Xx7qfQygd+vjQnQFEgO3S6XYM+apZOZkBYyc5oM4tJGIB8itF65ANPaV/x gI7oI X-Gm-Gg: AYBFou2xES6BGWw92mysJ3Iu4x0VqA8H8OwJ/dURACI+RmY7hUfObL545SuzAD4Tmfx vyHZYIdAtzECNzQvPuc4Wrviflhf51Wd8CXgC+duXU691RyqQSR+/DznT5A0PxE5GhVR315c4Xc k7ba9u/ftBsdE5C+1xQblLcdHl9Y3V6KciHehIjIb+pFUuRy45uGQzTT8/fDwRpCEnyveL6bqAf l7ZPeFQJxcQSUETFDN9Cu0qrMr4WTS9vB7u9Noad1UU4mk8vfTGbyrz5LY1e9RnNk//2liNW11N 5zs4vvxp44saFUnNxyEO7C9qAvcXVmRaepfExvpQ7JUa7CIAEDIHfPzGgviMoNEbFo623O0Ym8P m2QG4ZOkmHZdbWY1nRX2i7Ar41+lws78HK81IKNcwFtconsB+oI0+E/hyTuB0jSGGOoSsEYd6d9 bSAnaJAId3f0p7Y/U2uthx6kvMF+d3Mkga+gBd/b3MlHPWzfgTkn8Et9gJ+/XAc5+vGdd3kE4b4 CUPNo2GiG9tSLKaCo1zpHuQhhyC+GFCY+8aIg== X-Received: by 2002:a17:902:c402:b0:2d7:3f6e:5cb9 with SMTP id d9443c01a7336-2ddb1b7a04cmr5299895ad.8.1789675898452; Thu, 17 Sep 2026 13:11:38 -0700 (PDT) Received: from phoenix.lan (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2dd89f0870bsm31368345ad.63.2026.09.17.13.11.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 13:11:38 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Hemant Agrawal , Sachin Saxena , Jerin Jacob Subject: [PATCH v8 18/25] drivers/event: replace rte_atomic32 in selftests Date: Thu, 17 Sep 2026 13:10:22 -0700 Message-ID: <20260917201119.2168234-19-stephen@networkplumber.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917201119.2168234-1-stephen@networkplumber.org> References: <20260521042043.1590536-1-stephen@networkplumber.org> <20260917201119.2168234-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Last callers in these selftests of the rte_atomicNN_*() family, which is being deprecated. Convert total_events from rte_atomic32_t to RTE_ATOMIC(uint32_t) for the stack-local instance and __rte_atomic uint32_t * for the pointer in test_core_param. Switch reads and updates to rte_atomic_*_explicit(). Reads in the busy-loop checks and progress logs use relaxed: the counter is purely a "drained yet?" signal and no data is published through it. The fetch_sub on the dequeue path uses release in octeontx (preserving the publish-after-mbuf-free ordering already implied by the seq_cst sub it replaces) and relaxed in dpaa2. The stack-local atomic_total_events is initialized by direct assignment instead of rte_atomic32_set(), since it is written before any worker is launched. Signed-off-by: Stephen Hemminger --- drivers/event/dpaa2/dpaa2_eventdev_selftest.c | 26 +++++---- drivers/event/octeontx/ssovf_evdev_selftest.c | 57 ++++++++++--------- 2 files changed, 43 insertions(+), 40 deletions(-) diff --git a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c index 9d4938efe6..2c688bd194 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c +++ b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c @@ -2,7 +2,7 @@ * Copyright 2018-2019 NXP */ -#include +#include #include #include #include @@ -49,7 +49,7 @@ struct event_attr { }; struct test_core_param { - rte_atomic32_t *total_events; + __rte_atomic uint32_t *total_events; uint64_t dequeue_tmo_ticks; uint8_t port; uint8_t sched_type; @@ -444,10 +444,10 @@ worker_multi_port_fn(void *arg) struct rte_event ev; uint16_t valid_event; uint8_t port = param->port; - rte_atomic32_t *total_events = param->total_events; + __rte_atomic uint32_t *total_events = param->total_events; int ret; - while (rte_atomic32_read(total_events) > 0) { + while (rte_atomic_load_explicit(total_events, rte_memory_order_relaxed) > 0) { valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); if (!valid_event) continue; @@ -455,13 +455,15 @@ worker_multi_port_fn(void *arg) ret = validate_event(&ev); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate event"); rte_pktmbuf_free(ev.mbuf); - rte_atomic32_sub(total_events, 1); + + rte_atomic_fetch_sub_explicit(total_events, 1, + rte_memory_order_relaxed); } return 0; } static int -wait_workers_to_join(int lcore, const rte_atomic32_t *count) +wait_workers_to_join(int lcore, const __rte_atomic uint32_t *count) { uint64_t cycles, print_cycles; @@ -472,15 +474,15 @@ wait_workers_to_join(int lcore, const rte_atomic32_t *count) uint64_t new_cycles = rte_get_timer_cycles(); if (new_cycles - print_cycles > rte_get_timer_hz()) { - dpaa2_evdev_dbg("\r%s: events %d", __func__, - rte_atomic32_read(count)); + dpaa2_evdev_dbg("\r%s: events %u", __func__, + rte_atomic_load_explicit(count, rte_memory_order_relaxed)); print_cycles = new_cycles; } if (new_cycles - cycles > rte_get_timer_hz() * 10) { dpaa2_evdev_info( - "%s: No schedules for seconds, deadlock (%d)", + "%s: No schedules for seconds, deadlock (%u)", __func__, - rte_atomic32_read(count)); + rte_atomic_load_explicit(count, rte_memory_order_relaxed)); rte_event_dev_dump(evdev, stdout); cycles = new_cycles; return -1; @@ -500,13 +502,13 @@ launch_workers_and_wait(int (*main_worker)(void *), int w_lcore; int ret; struct test_core_param *param; - rte_atomic32_t atomic_total_events; + RTE_ATOMIC(uint32_t) atomic_total_events; uint64_t dequeue_tmo_ticks; if (!nb_workers) return 0; - rte_atomic32_set(&atomic_total_events, total_events); + atomic_total_events = total_events; RTE_BUILD_BUG_ON(NUM_PACKETS < MAX_EVENTS); param = malloc(sizeof(struct test_core_param) * nb_workers); diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c index b54ae126d2..e51b89a31e 100644 --- a/drivers/event/octeontx/ssovf_evdev_selftest.c +++ b/drivers/event/octeontx/ssovf_evdev_selftest.c @@ -4,7 +4,7 @@ #include -#include +#include #include #include #include @@ -84,7 +84,7 @@ seqn_list_check(int limit) } struct test_core_param { - rte_atomic32_t *total_events; + __rte_atomic uint32_t *total_events; uint64_t dequeue_tmo_ticks; uint8_t port; uint8_t sched_type; @@ -558,10 +558,10 @@ worker_multi_port_fn(void *arg) struct rte_event ev; uint16_t valid_event; uint8_t port = param->port; - rte_atomic32_t *total_events = param->total_events; + __rte_atomic uint32_t *total_events = param->total_events; int ret; - while (rte_atomic32_read(total_events) > 0) { + while (rte_atomic_load_explicit(total_events, rte_memory_order_relaxed) > 0) { valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); if (!valid_event) continue; @@ -569,13 +569,14 @@ worker_multi_port_fn(void *arg) ret = validate_event(&ev); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to validate event"); rte_pktmbuf_free(ev.mbuf); - rte_atomic32_sub(total_events, 1); + + rte_atomic_fetch_sub_explicit(total_events, 1, rte_memory_order_release); } return 0; } static inline int -wait_workers_to_join(int lcore, const rte_atomic32_t *count) +wait_workers_to_join(int lcore, const __rte_atomic uint32_t *count) { uint64_t cycles, print_cycles; RTE_SET_USED(count); @@ -583,17 +584,16 @@ wait_workers_to_join(int lcore, const rte_atomic32_t *count) print_cycles = cycles = rte_get_timer_cycles(); while (rte_eal_get_lcore_state(lcore) != WAIT) { uint64_t new_cycles = rte_get_timer_cycles(); + uint32_t cur_count = rte_atomic_load_explicit(count, rte_memory_order_relaxed); if (new_cycles - print_cycles > rte_get_timer_hz()) { - ssovf_log_dbg("\r%s: events %d", __func__, - rte_atomic32_read(count)); + ssovf_log_dbg("\r%s: events %u", __func__, cur_count); print_cycles = new_cycles; } if (new_cycles - cycles > rte_get_timer_hz() * 10) { ssovf_log_dbg( - "%s: No schedules for seconds, deadlock (%d)", - __func__, - rte_atomic32_read(count)); + "%s: No schedules for seconds, deadlock (%u)", + __func__, cur_count); rte_event_dev_dump(evdev, stdout); cycles = new_cycles; return -1; @@ -613,13 +613,12 @@ launch_workers_and_wait(int (*main_worker)(void *), int w_lcore; int ret; struct test_core_param *param; - rte_atomic32_t atomic_total_events; + RTE_ATOMIC(uint32_t) atomic_total_events = total_events; uint64_t dequeue_tmo_ticks; if (!nb_workers) return 0; - rte_atomic32_set(&atomic_total_events, total_events); seqn_list_init(); param = malloc(sizeof(struct test_core_param) * nb_workers); @@ -889,10 +888,10 @@ worker_flow_based_pipeline(void *arg) uint16_t valid_event; uint8_t port = param->port; uint8_t new_sched_type = param->sched_type; - rte_atomic32_t *total_events = param->total_events; + __rte_atomic uint32_t *total_events = param->total_events; uint64_t dequeue_tmo_ticks = param->dequeue_tmo_ticks; - while (rte_atomic32_read(total_events) > 0) { + while (rte_atomic_load_explicit(total_events, rte_memory_order_relaxed) > 0) { valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, dequeue_tmo_ticks); if (!valid_event) @@ -910,7 +909,8 @@ worker_flow_based_pipeline(void *arg) } else if (ev.sub_event_type == 1) { /* Events from stage 1*/ if (seqn_list_update(*rte_event_pmd_selftest_seqn(ev.mbuf)) == 0) { rte_pktmbuf_free(ev.mbuf); - rte_atomic32_sub(total_events, 1); + rte_atomic_fetch_sub_explicit(total_events, 1, + rte_memory_order_release); } else { ssovf_log_dbg("Failed to update seqn_list"); return -1; @@ -1044,10 +1044,10 @@ worker_group_based_pipeline(void *arg) uint16_t valid_event; uint8_t port = param->port; uint8_t new_sched_type = param->sched_type; - rte_atomic32_t *total_events = param->total_events; + __rte_atomic uint32_t *total_events = param->total_events; uint64_t dequeue_tmo_ticks = param->dequeue_tmo_ticks; - while (rte_atomic32_read(total_events) > 0) { + while (rte_atomic_load_explicit(total_events, rte_memory_order_relaxed) > 0) { valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, dequeue_tmo_ticks); if (!valid_event) @@ -1065,7 +1065,8 @@ worker_group_based_pipeline(void *arg) } else if (ev.queue_id == 1) { /* Events from stage 1(group 1)*/ if (seqn_list_update(*rte_event_pmd_selftest_seqn(ev.mbuf)) == 0) { rte_pktmbuf_free(ev.mbuf); - rte_atomic32_sub(total_events, 1); + rte_atomic_fetch_sub_explicit(total_events, 1, + rte_memory_order_release); } else { ssovf_log_dbg("Failed to update seqn_list"); return -1; @@ -1203,16 +1204,16 @@ worker_flow_based_pipeline_max_stages_rand_sched_type(void *arg) struct rte_event ev; uint16_t valid_event; uint8_t port = param->port; - rte_atomic32_t *total_events = param->total_events; + __rte_atomic uint32_t *total_events = param->total_events; - while (rte_atomic32_read(total_events) > 0) { + while (rte_atomic_load_explicit(total_events, rte_memory_order_relaxed) > 0) { valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); if (!valid_event) continue; if (ev.sub_event_type == 255) { /* last stage */ rte_pktmbuf_free(ev.mbuf); - rte_atomic32_sub(total_events, 1); + rte_atomic_fetch_sub_explicit(total_events, 1, rte_memory_order_release); } else { ev.event_type = RTE_EVENT_TYPE_CPU; ev.sub_event_type++; @@ -1278,16 +1279,16 @@ worker_queue_based_pipeline_max_stages_rand_sched_type(void *arg) RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint8_t nr_queues = queue_count; - rte_atomic32_t *total_events = param->total_events; + __rte_atomic uint32_t *total_events = param->total_events; - while (rte_atomic32_read(total_events) > 0) { + while (rte_atomic_load_explicit(total_events, rte_memory_order_relaxed) > 0) { valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); if (!valid_event) continue; if (ev.queue_id == nr_queues - 1) { /* last stage */ rte_pktmbuf_free(ev.mbuf); - rte_atomic32_sub(total_events, 1); + rte_atomic_fetch_sub_explicit(total_events, 1, rte_memory_order_release); } else { ev.event_type = RTE_EVENT_TYPE_CPU; ev.queue_id++; @@ -1320,16 +1321,16 @@ worker_mixed_pipeline_max_stages_rand_sched_type(void *arg) RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count), "Queue count get failed"); uint8_t nr_queues = queue_count; - rte_atomic32_t *total_events = param->total_events; + __rte_atomic uint32_t *total_events = param->total_events; - while (rte_atomic32_read(total_events) > 0) { + while (rte_atomic_load_explicit(total_events, rte_memory_order_relaxed) > 0) { valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); if (!valid_event) continue; if (ev.queue_id == nr_queues - 1) { /* Last stage */ rte_pktmbuf_free(ev.mbuf); - rte_atomic32_sub(total_events, 1); + rte_atomic_fetch_sub_explicit(total_events, 1, rte_memory_order_release); } else { ev.event_type = RTE_EVENT_TYPE_CPU; ev.queue_id++; -- 2.53.0