From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BA1E943EB4; Sat, 20 Apr 2024 01:12:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0B24C42DE7; Sat, 20 Apr 2024 01:08:01 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 5CB2840DFB for ; Sat, 20 Apr 2024 01:06:59 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 3DE3C20FEA2A; Fri, 19 Apr 2024 16:06:49 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3DE3C20FEA2A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713568011; bh=g3va/qrxUJF469/qfA0wu3GpMYxdZnvrIQXAj72TaP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GqRRwKeybELg1cMtSIM7rIhGVlKwqXS8eyPC1zHMWiwi2CbacEfXOZKzQ/fmQDE3h UaR17APaw2M4DJuZ6XJphv4T69sVcF+DyR6KVHA8P5nDFPKw6nNJ1v1Vw2fJytLJfV 7HQ6rTw4o1p61KJYZcEhxOx5qXrgqhNh9+aa/K3Y= From: Tyler Retzlaff To: dev@dpdk.org Cc: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Abdullah Sevincer , Ajit Khaparde , Alok Prasad , Anatoly Burakov , Andrew Rybchenko , Anoob Joseph , Bruce Richardson , Byron Marohn , Chenbo Xia , Chengwen Feng , Ciara Loftus , Ciara Power , Dariusz Sosnowski , David Hunt , Devendra Singh Rawat , Erik Gabriel Carrillo , Guoyang Zhou , Harman Kalra , Harry van Haaren , Honnappa Nagarahalli , Jakub Grajciar , Jerin Jacob , Jeroen de Borst , Jian Wang , Jiawen Wu , Jie Hai , Jingjing Wu , Joshua Washington , Joyce Kong , Junfeng Guo , Kevin Laatz , Konstantin Ananyev , Liang Ma , Long Li , Maciej Czekaj , Matan Azrad , Maxime Coquelin , Nicolas Chautru , Ori Kam , Pavan Nikhilesh , Peter Mccarthy , Rahul Lakkireddy , Reshma Pattan , Rosen Xu , Ruifeng Wang , Rushil Gupta , Sameh Gobriel , Sivaprasad Tummala , Somnath Kotur , Stephen Hemminger , Suanming Mou , Sunil Kumar Kori , Sunil Uttarwar , Tetsuya Mukawa , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Xiaoyun Wang , Yipeng Wang , Yisen Zhuang , Yuying Zhang , Yuying Zhang , Ziyang Xuan , Tyler Retzlaff Subject: [PATCH v4 44/45] app/test-compress-perf: use rte stdatomic API Date: Fri, 19 Apr 2024 16:06:42 -0700 Message-Id: <1713568003-30453-45-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1713568003-30453-1-git-send-email-roretzla@linux.microsoft.com> References: <1710967892-7046-1-git-send-email-roretzla@linux.microsoft.com> <1713568003-30453-1-git-send-email-roretzla@linux.microsoft.com> 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 Replace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional rte stdatomic API. Signed-off-by: Tyler Retzlaff Acked-by: Stephen Hemminger --- app/test-compress-perf/comp_perf_test_common.h | 2 +- app/test-compress-perf/comp_perf_test_cyclecount.c | 4 ++-- app/test-compress-perf/comp_perf_test_throughput.c | 10 +++++----- app/test-compress-perf/comp_perf_test_verify.c | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/test-compress-perf/comp_perf_test_common.h b/app/test-compress-perf/comp_perf_test_common.h index d039e5a..085e269 100644 --- a/app/test-compress-perf/comp_perf_test_common.h +++ b/app/test-compress-perf/comp_perf_test_common.h @@ -14,7 +14,7 @@ struct cperf_mem_resources { uint16_t qp_id; uint8_t lcore_id; - uint16_t print_info_once; + RTE_ATOMIC(uint16_t) print_info_once; uint32_t total_bufs; uint8_t *compressed_data; diff --git a/app/test-compress-perf/comp_perf_test_cyclecount.c b/app/test-compress-perf/comp_perf_test_cyclecount.c index 4d336ec..64e8faa 100644 --- a/app/test-compress-perf/comp_perf_test_cyclecount.c +++ b/app/test-compress-perf/comp_perf_test_cyclecount.c @@ -498,8 +498,8 @@ struct cperf_cyclecount_ctx { /* * printing information about current compression thread */ - if (__atomic_compare_exchange_n(&ctx->ver.mem.print_info_once, &exp, - 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) + if (rte_atomic_compare_exchange_strong_explicit(&ctx->ver.mem.print_info_once, &exp, + 1, rte_memory_order_relaxed, rte_memory_order_relaxed)) printf(" lcore: %u," " driver name: %s," " device name: %s," diff --git a/app/test-compress-perf/comp_perf_test_throughput.c b/app/test-compress-perf/comp_perf_test_throughput.c index 1f7072d..089d19c 100644 --- a/app/test-compress-perf/comp_perf_test_throughput.c +++ b/app/test-compress-perf/comp_perf_test_throughput.c @@ -336,7 +336,7 @@ struct cperf_benchmark_ctx *ctx = test_ctx; struct comp_test_data *test_data = ctx->ver.options; uint32_t lcore = rte_lcore_id(); - static uint16_t display_once; + static RTE_ATOMIC(uint16_t) display_once; int i, ret = EXIT_SUCCESS; ctx->ver.mem.lcore_id = lcore; @@ -345,8 +345,8 @@ /* * printing information about current compression thread */ - if (__atomic_compare_exchange_n(&ctx->ver.mem.print_info_once, &exp, - 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) + if (rte_atomic_compare_exchange_strong_explicit(&ctx->ver.mem.print_info_once, &exp, + 1, rte_memory_order_relaxed, rte_memory_order_relaxed)) printf(" lcore: %u," " driver name: %s," " device name: %s," @@ -413,8 +413,8 @@ } exp = 0; - if (__atomic_compare_exchange_n(&display_once, &exp, 1, 0, - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { + if (rte_atomic_compare_exchange_strong_explicit(&display_once, &exp, 1, + rte_memory_order_relaxed, rte_memory_order_relaxed)) { printf("\n%12s%6s%12s%17s%15s%16s\n", "lcore id", "Level", "Comp size", "Comp ratio [%]", "Comp [Gbps]", "Decomp [Gbps]"); diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c index 7bd1807..09d97c5 100644 --- a/app/test-compress-perf/comp_perf_test_verify.c +++ b/app/test-compress-perf/comp_perf_test_verify.c @@ -396,7 +396,7 @@ struct cperf_verify_ctx *ctx = test_ctx; struct comp_test_data *test_data = ctx->options; int ret = EXIT_SUCCESS; - static uint16_t display_once; + static RTE_ATOMIC(uint16_t) display_once; uint32_t lcore = rte_lcore_id(); uint16_t exp = 0; @@ -452,8 +452,8 @@ test_data->input_data_sz * 100; if (!ctx->silent) { - if (__atomic_compare_exchange_n(&display_once, &exp, 1, 0, - __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { + if (rte_atomic_compare_exchange_strong_explicit(&display_once, &exp, 1, + rte_memory_order_relaxed, rte_memory_order_relaxed)) { printf("%12s%6s%12s%17s\n", "lcore id", "Level", "Comp size", "Comp ratio [%]"); } -- 1.8.3.1