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 A759AC25B4F for ; Mon, 6 May 2024 18:03:45 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 67DCB42D7D; Mon, 6 May 2024 19:59:32 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id E6A4F402F1 for ; Mon, 6 May 2024 19:58:38 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 5C780207E7E3; Mon, 6 May 2024 10:58:28 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5C780207E7E3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1715018310; bh=SDax7dAECVtCppBj6PIAjg3aKSYmxK9hky5toyf31ek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fwBqVkAYUxDvuQ7B3MJ3iRIC7DykljcD4N4znjbIWGCX1urx+Wg/UxPUdgLVTWIhu 4SxBETrISk0JwVec81Xj8QMwDpaiSW9HS0hO2R0istNlGvl+EI/pfJoVw7kytsNlmk 3RcP8zTNEdav0HO2niaxKifTFtMErTkP9C1JiNO0= 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 , Ziyang Xuan , Tyler Retzlaff Subject: [PATCH v5 43/45] app/test-crypto-perf: use rte stdatomic API Date: Mon, 6 May 2024 10:58:24 -0700 Message-Id: <1715018306-13741-44-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1715018306-13741-1-git-send-email-roretzla@linux.microsoft.com> References: <1710967892-7046-1-git-send-email-roretzla@linux.microsoft.com> <1715018306-13741-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-crypto-perf/cperf_test_latency.c | 6 +++--- app/test-crypto-perf/cperf_test_pmd_cyclecount.c | 10 +++++----- app/test-crypto-perf/cperf_test_throughput.c | 10 +++++----- app/test-crypto-perf/cperf_test_verify.c | 10 +++++----- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c index 99b7d7c..b8ad6bf 100644 --- a/app/test-crypto-perf/cperf_test_latency.c +++ b/app/test-crypto-perf/cperf_test_latency.c @@ -136,7 +136,7 @@ struct priv_op_data { uint32_t imix_idx = 0; int ret = 0; - static uint16_t display_once; + static RTE_ATOMIC(uint16_t) display_once; if (ctx == NULL) return 0; @@ -341,8 +341,8 @@ struct priv_op_data { uint16_t exp = 0; if (ctx->options->csv) { - 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# lcore, Buffer Size, Burst Size, Pakt Seq #, " "cycles, time (us)"); diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c index 4a60f6d..7191d99 100644 --- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c +++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c @@ -396,7 +396,7 @@ struct pmd_cyclecount_state { state.lcore = rte_lcore_id(); state.linearize = 0; - static uint16_t display_once; + static RTE_ATOMIC(uint16_t) display_once; static bool warmup = true; /* @@ -443,8 +443,8 @@ struct pmd_cyclecount_state { uint16_t exp = 0; if (!opts->csv) { - 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(PRETTY_HDR_FMT, "lcore id", "Buf Size", "Burst Size", "Enqueued", "Dequeued", "Enq Retries", @@ -460,8 +460,8 @@ struct pmd_cyclecount_state { state.cycles_per_enq, state.cycles_per_deq); } else { - 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(CSV_HDR_FMT, "# lcore id", "Buf Size", "Burst Size", "Enqueued", "Dequeued", "Enq Retries", diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c index e3d266d..c0891e7 100644 --- a/app/test-crypto-perf/cperf_test_throughput.c +++ b/app/test-crypto-perf/cperf_test_throughput.c @@ -107,7 +107,7 @@ struct cperf_throughput_ctx { uint8_t burst_size_idx = 0; uint32_t imix_idx = 0; - static uint16_t display_once; + static RTE_ATOMIC(uint16_t) display_once; struct rte_crypto_op *ops[ctx->options->max_burst_size]; struct rte_crypto_op *ops_processed[ctx->options->max_burst_size]; @@ -277,8 +277,8 @@ struct cperf_throughput_ctx { uint16_t exp = 0; if (!ctx->options->csv) { - 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%12s%12s%12s%12s%12s%12s%12s%12s%12s\n\n", "lcore id", "Buf Size", "Burst Size", "Enqueued", "Dequeued", "Failed Enq", @@ -298,8 +298,8 @@ struct cperf_throughput_ctx { throughput_gbps, cycles_per_packet); } else { - 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("#lcore id,Buffer Size(B)," "Burst Size,Enqueued,Dequeued,Failed Enq," "Failed Deq,Ops(Millions),Throughput(Gbps)," diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c index 3548509..222c7a1 100644 --- a/app/test-crypto-perf/cperf_test_verify.c +++ b/app/test-crypto-perf/cperf_test_verify.c @@ -216,7 +216,7 @@ struct cperf_op_result { uint64_t ops_deqd = 0, ops_deqd_total = 0, ops_deqd_failed = 0; uint64_t ops_failed = 0; - static uint16_t display_once; + static RTE_ATOMIC(uint16_t) display_once; uint64_t i; uint16_t ops_unused = 0; @@ -370,8 +370,8 @@ struct cperf_op_result { uint16_t exp = 0; if (!ctx->options->csv) { - 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%12s%12s%12s%12s%12s%12s%12s\n\n", "lcore id", "Buf Size", "Burst size", "Enqueued", "Dequeued", "Failed Enq", @@ -388,8 +388,8 @@ struct cperf_op_result { ops_deqd_failed, ops_failed); } else { - 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# lcore id, Buffer Size(B), " "Burst Size,Enqueued,Dequeued,Failed Enq," "Failed Deq,Failed Ops\n"); -- 1.8.3.1