From patchwork Wed Mar 20 20:51:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 138624 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BA8B643D09; Wed, 20 Mar 2024 21:56:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3422942F35; Wed, 20 Mar 2024 21:52:36 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 6EB5842E05 for ; Wed, 20 Mar 2024 21:51:47 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 540D520B479B; Wed, 20 Mar 2024 13:51:34 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 540D520B479B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1710967896; bh=U8WDf8G5jX+zk/g8bVd6/9MDjhwsJuzIjEV1TzjhvAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IoXnnwE5l+rGp3oR4RachemP8KLyLn31TkADLicPd7oF9dQzOJRdRb+TP2qId7PCc 4ddNP3QNz1V5O9i+nPuJUcTKf+n4/3C9VwggJLMfHeWv9VPZWdH8ha7oqZtJVtCDWa /Qu0iRfBktjZjQozqwjNqOfA+P5/syPOQx2Oeq4w= From: Tyler Retzlaff To: dev@dpdk.org Cc: =?utf-8?q?Mattias_R=C3=B6nnblom?= , =?utf-8?q?Morten_Br=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 45/46] app/test-compress-perf: use rte stdatomic API Date: Wed, 20 Mar 2024 13:51:31 -0700 Message-Id: <1710967892-7046-46-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1710967892-7046-1-git-send-email-roretzla@linux.microsoft.com> References: <1710967892-7046-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 --- 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 [%]"); }