From patchwork Thu Sep 9 23:13:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 508376 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp767851jai; Thu, 9 Sep 2021 16:14:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLI0fWOR8cUTpa/Ngwj2oOSzWNuojzVTHDfftp6oyXYNmdNpPGdhe4zmjIu6tb+zf7MzSY X-Received: by 2002:a5d:6781:: with SMTP id v1mr6343482wru.249.1631229242888; Thu, 09 Sep 2021 16:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631229242; cv=none; d=google.com; s=arc-20160816; b=XqbTGosVMapchfq4rgiWr9LgvOnaztAR5I57PgSewkpK/gAw/NM2WCWlXJ2ECNXF18 I3ShKuMMP44AEu2dHyVDlOfMaE+SlZjPQ0OCxX7fl8DoihHs/V+tSerYHxCtFta8XA9Z qBOr1L0PERs1DJGcZUaqUIz2Q+/g8nv5eNmCFhreSSPgC4MTXmCDMLut6pw2EOeOKjXT ZrAnLEFTlTIpIzpCFjt86+9Fb2ZW8PNMQ0B9zIEvSo9QmMv4/LU9AJRUevR9yV9KOFFT EflFh9whd4LUzCZeZw7Wt+w9c+8sD0wQrKzEZvGcP4t6ftlLr1+pv5uNHvwZiFG5NRGw Q37A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:cc:to:from; bh=xZC03eVHiRLWhj8duFzhkKEjizGRYylA/AyAuZKS2G8=; b=a39/wAHEABT9S28y1Ns9tBoOBWx+uC9wEi2ukCod/vgBiHqoXGhZDAPysqBwP8FGQ7 XzBlbmQ7c2Avw7bO9QJVAO/kiK8kzTqRY8egAKt++lJ18f3oV8n7iB9RpD763yy/70DP OtmRZWT2xZqhMcyMwIdsTjalDsnGQJzenFbJY8L9fHSeBtDQIIXEZXSqbx6hTGU0KB2I 8PJiYWFzDeFa5ru2V5LgvBnjHCVv3fKviapq6O69B9YdHKwyFmcUq4w0jBSuI8Mio4mO p8buFRkbPXWuBA/MPl9djBXmnf0786kNwnoAcMR++Q9e9sic9SN+kVUF3TxCRp1P31Hs 76og== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id 138si3172299wmb.107.2021.09.09.16.14.02; Thu, 09 Sep 2021 16:14:02 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD6FE41142; Fri, 10 Sep 2021 01:13:47 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id B3BF941120 for ; Fri, 10 Sep 2021 01:13:42 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 29CAB106F; Thu, 9 Sep 2021 16:13:42 -0700 (PDT) Received: from 2p2660v4-1.austin.arm.com (2p2660v4-1.austin.arm.com [10.118.13.211]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 21C553F73D; Thu, 9 Sep 2021 16:13:42 -0700 (PDT) From: Honnappa Nagarahalli To: dev@dpdk.org, honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com, david.marchand@redhat.com, feifei.wang2@arm.com Cc: ruifeng.wang@arm.com, nd@arm.com, Ola Liljedahl , Feifei Wang Date: Thu, 9 Sep 2021 18:13:12 -0500 Message-Id: <20210909231312.2572006-7-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210909231312.2572006-1-honnappa.nagarahalli@arm.com> References: <20210224212018.17576-1-honnappa.nagarahalli@arm.com> <20210909231312.2572006-1-honnappa.nagarahalli@arm.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 6/6] test/ring: use relaxed barriers for ring stress test 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 Sender: "dev" wrk_cmd variable is used to signal the worker thread to start or stop the stress test loop. Relaxed barriers are used to achieve the same. Signed-off-by: Honnappa Nagarahalli Reviewed-by: Ola Liljedahl Reviewed-by: Feifei Wang --- app/test/test_ring_stress_impl.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/app/test/test_ring_stress_impl.h b/app/test/test_ring_stress_impl.h index f9ca63b908..ee8293bb04 100644 --- a/app/test/test_ring_stress_impl.h +++ b/app/test/test_ring_stress_impl.h @@ -22,7 +22,7 @@ enum { WRK_CMD_RUN, }; -static volatile uint32_t wrk_cmd __rte_cache_aligned; +static volatile uint32_t wrk_cmd __rte_cache_aligned = WRK_CMD_STOP; /* test run-time in seconds */ static const uint32_t run_time = 60; @@ -197,10 +197,12 @@ test_worker(void *arg, const char *fname, int32_t prcs) fill_ring_elm(&def_elm, UINT32_MAX); fill_ring_elm(&loc_elm, lc); - while (wrk_cmd != WRK_CMD_RUN) { - rte_smp_rmb(); + /* Acquire ordering is not required as the main is not + * really releasing any data through 'wrk_cmd' to + * the worker. + */ + while (__atomic_load_n(&wrk_cmd, __ATOMIC_RELAXED) != WRK_CMD_RUN) rte_pause(); - } cl = rte_rdtsc_precise(); @@ -242,7 +244,7 @@ test_worker(void *arg, const char *fname, int32_t prcs) lcore_stat_update(&la->stats, 1, num, tm0 + tm1, prcs); - } while (wrk_cmd == WRK_CMD_RUN); + } while (__atomic_load_n(&wrk_cmd, __ATOMIC_RELAXED) == WRK_CMD_RUN); cl = rte_rdtsc_precise() - cl; if (prcs == 0) @@ -356,14 +358,12 @@ test_mt1(int (*test)(void *)) } /* signal worker to start test */ - wrk_cmd = WRK_CMD_RUN; - rte_smp_wmb(); + __atomic_store_n(&wrk_cmd, WRK_CMD_RUN, __ATOMIC_RELEASE); usleep(run_time * US_PER_S); /* signal worker to start test */ - wrk_cmd = WRK_CMD_STOP; - rte_smp_wmb(); + __atomic_store_n(&wrk_cmd, WRK_CMD_STOP, __ATOMIC_RELEASE); /* wait for workers and collect stats. */ mc = rte_lcore_id();