From patchwork Fri Jun 14 22:28:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Tomasz_J=C3=B3=C5=BAwiak?= X-Patchwork-Id: 54813 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 862581D5EE; Sat, 15 Jun 2019 00:28:44 +0200 (CEST) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by dpdk.org (Postfix) with ESMTP id A58EF1D5DE; Sat, 15 Jun 2019 00:28:42 +0200 (CEST) Received: by mail-wr1-f52.google.com with SMTP id x4so4032954wrt.6; Fri, 14 Jun 2019 15:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=zO+ksxVNJQ1ja4EZypPVq0bNqwPHJG1BaMPB6Yy3JcU=; b=jxu4I6UWLF029DrkNdDeVCRukRH3HdYSERP22iQIEllFn1px98CpCH2OxcxumGY08d jdpUZ6k3FzL8ep9P5fpMiqKiNFs82P5SGX5y++mPW5qnQ1YY6K+qYbTjdO8O4af6aX5I w8PBh7wQgb5s5HsoNZMIK3nmuYyO7c38tTsPKvxQI9IQa9T1gPGnktqsStBo8/v/uptB FxOTVsVO30a4HM4laH3nGQAaBDipm9tYoHw8ludmbhHupGI6PkwJSqz6g/YRYmd7LLNC TmpN6R7y3+zd/sxEPZfFhgXa02Gbwevu87UcT59a7kGFZ1QfQmEGpXxZwmpc9s48PWzX SDDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=zO+ksxVNJQ1ja4EZypPVq0bNqwPHJG1BaMPB6Yy3JcU=; b=q/G/4tTPDSJy44VGtWHJ+BfkPTPw6xr1HV7goxPAxPWPv2RbfKfNo/xgKAAAlg9kRd SOsaaAAI6faFbA/1SW8yfeLRHZ4C7FrD0V6t+dXsgBHRWA81qxh8MMzGtuX1OAwlyVaM MWr6xuk4E6fuDVdKYjqcBsUu3IGZF5+IOKirzU9ZTaZ+de4vc4qeUkz8YW+aIE7wOEr7 C/R5u+WBSUttN5qjaI6al/1YrqIRboQX2rSWy0/TVDrUTTzx9gGKMZgC+VCDzet+qV/J BZWV+D7SFeEiW/noBzrjPuH4ndprw7cbZNGHXtNu8oHLwBCzbjluC47B+47H8ynuddlX I83Q== X-Gm-Message-State: APjAAAVTMo8SXCWh5ytPNYDPrfe/EHa6kujoZPtxrpVviC/XNgQqxCZR 6DeEhFLsVQA1NCFcK+2kA8EiEFHjiQc= X-Google-Smtp-Source: APXvYqyiF1PVOkwI+pnJP/SGDxqAysBOAmcC2urwZ3nxK4FS7rQpMhrF8a7QcnRykCm8Hr1VQ3UA5w== X-Received: by 2002:adf:afd0:: with SMTP id y16mr66934826wrd.22.1560551322162; Fri, 14 Jun 2019 15:28:42 -0700 (PDT) Received: from localhost.localdomain (178.43.191.94.ipv4.supernova.orange.pl. [178.43.191.94]) by smtp.gmail.com with ESMTPSA id q20sm8026608wra.36.2019.06.14.15.28.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Jun 2019 15:28:41 -0700 (PDT) From: Tomasz Jozwiak To: dev@dpdk.org, fiona.trahe@intel.com, tjozwiakgm@gmail.com, pablo.de.lara.guarch@intel.com, stable@dpdk.org Date: Sat, 15 Jun 2019 00:28:35 +0200 Message-Id: <1560551315-19244-1-git-send-email-tjozwiakgm@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] app/crypto-perf: fix display once detection X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch changes 'only_once' variable to 'display_once', which should be atomic type due to fact, that all runner functions can be executed in paraller way on different lcores. Fixes: df52cb3b6e13 ("app/crypto-perf: move verify as single test type") Cc: stable@dpdk.org Signed-off-by: Tomasz Jozwiak Acked-by: Akhil Goyal --- app/test-crypto-perf/cperf_test_latency.c | 5 ++--- app/test-crypto-perf/cperf_test_pmd_cyclecount.c | 8 +++----- app/test-crypto-perf/cperf_test_throughput.c | 8 +++----- app/test-crypto-perf/cperf_test_verify.c | 8 +++----- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c index 0fc3a66..62478a2 100644 --- a/app/test-crypto-perf/cperf_test_latency.c +++ b/app/test-crypto-perf/cperf_test_latency.c @@ -129,7 +129,7 @@ cperf_latency_test_runner(void *arg) uint8_t burst_size_idx = 0; uint32_t imix_idx = 0; - static int only_once; + static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0); if (ctx == NULL) return 0; @@ -311,7 +311,7 @@ cperf_latency_test_runner(void *arg) time_min = tunit*(double)(tsc_min) / tsc_hz; if (ctx->options->csv) { - if (!only_once) + if (rte_atomic16_test_and_set(&display_once)) printf("\n# lcore, Buffer Size, Burst Size, Pakt Seq #, " "Packet Size, cycles, time (us)"); @@ -326,7 +326,6 @@ cperf_latency_test_runner(void *arg) / tsc_hz); } - only_once = 1; } else { printf("\n# Device %d on lcore %u\n", ctx->dev_id, ctx->lcore_id); diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c index 92af5ec..70ffd6b 100644 --- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c +++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c @@ -391,7 +391,7 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx) state.lcore = rte_lcore_id(); state.linearize = 0; - static int only_once; + static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0); static bool warmup = true; /* @@ -437,13 +437,12 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx) } if (!opts->csv) { - if (!only_once) + if (rte_atomic16_test_and_set(&display_once)) printf(PRETTY_HDR_FMT, "lcore id", "Buf Size", "Burst Size", "Enqueued", "Dequeued", "Enq Retries", "Deq Retries", "Cycles/Op", "Cycles/Enq", "Cycles/Deq"); - only_once = 1; printf(PRETTY_LINE_FMT, state.ctx->lcore_id, opts->test_buffer_size, test_burst_size, @@ -454,13 +453,12 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx) state.cycles_per_enq, state.cycles_per_deq); } else { - if (!only_once) + if (rte_atomic16_test_and_set(&display_once)) printf(CSV_HDR_FMT, "# lcore id", "Buf Size", "Burst Size", "Enqueued", "Dequeued", "Enq Retries", "Deq Retries", "Cycles/Op", "Cycles/Enq", "Cycles/Deq"); - only_once = 1; printf(CSV_LINE_FMT, state.ctx->lcore_id, opts->test_buffer_size, test_burst_size, diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c index 2767f4e..972d520 100644 --- a/app/test-crypto-perf/cperf_test_throughput.c +++ b/app/test-crypto-perf/cperf_test_throughput.c @@ -95,7 +95,7 @@ cperf_throughput_test_runner(void *test_ctx) uint8_t burst_size_idx = 0; uint32_t imix_idx = 0; - static int only_once; + static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0); struct rte_crypto_op *ops[ctx->options->max_burst_size]; struct rte_crypto_op *ops_processed[ctx->options->max_burst_size]; @@ -262,13 +262,12 @@ cperf_throughput_test_runner(void *test_ctx) ctx->options->total_ops); if (!ctx->options->csv) { - if (!only_once) + if (rte_atomic16_test_and_set(&display_once)) printf("%12s%12s%12s%12s%12s%12s%12s%12s%12s%12s\n\n", "lcore id", "Buf Size", "Burst Size", "Enqueued", "Dequeued", "Failed Enq", "Failed Deq", "MOps", "Gbps", "Cycles/Buf"); - only_once = 1; printf("%12u%12u%12u%12"PRIu64"%12"PRIu64"%12"PRIu64 "%12"PRIu64"%12.4f%12.4f%12.2f\n", @@ -283,12 +282,11 @@ cperf_throughput_test_runner(void *test_ctx) throughput_gbps, cycles_per_packet); } else { - if (!only_once) + if (rte_atomic16_test_and_set(&display_once)) printf("#lcore id,Buffer Size(B)," "Burst Size,Enqueued,Dequeued,Failed Enq," "Failed Deq,Ops(Millions),Throughput(Gbps)," "Cycles/Buf\n\n"); - only_once = 1; printf("%u;%u;%u;%"PRIu64";%"PRIu64";%"PRIu64";%"PRIu64";" "%.3f;%.3f;%.3f\n", diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c index 0497cf9..bbdf37d 100644 --- a/app/test-crypto-perf/cperf_test_verify.c +++ b/app/test-crypto-perf/cperf_test_verify.c @@ -233,7 +233,7 @@ cperf_verify_test_runner(void *test_ctx) uint64_t ops_deqd = 0, ops_deqd_total = 0, ops_deqd_failed = 0; uint64_t ops_failed = 0; - static int only_once; + static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0); uint64_t i; uint16_t ops_unused = 0; @@ -376,12 +376,11 @@ cperf_verify_test_runner(void *test_ctx) } if (!ctx->options->csv) { - if (!only_once) + if (rte_atomic16_test_and_set(&display_once)) printf("%12s%12s%12s%12s%12s%12s%12s%12s\n\n", "lcore id", "Buf Size", "Burst size", "Enqueued", "Dequeued", "Failed Enq", "Failed Deq", "Failed Ops"); - only_once = 1; printf("%12u%12u%12u%12"PRIu64"%12"PRIu64"%12"PRIu64 "%12"PRIu64"%12"PRIu64"\n", @@ -394,11 +393,10 @@ cperf_verify_test_runner(void *test_ctx) ops_deqd_failed, ops_failed); } else { - if (!only_once) + if (rte_atomic16_test_and_set(&display_once)) printf("\n# lcore id, Buffer Size(B), " "Burst Size,Enqueued,Dequeued,Failed Enq," "Failed Deq,Failed Ops\n"); - only_once = 1; printf("%10u;%10u;%u;%"PRIu64";%"PRIu64";%"PRIu64";%"PRIu64";" "%"PRIu64"\n",