From patchwork Wed Feb 24 21:20:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 386880 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp697981jap; Wed, 24 Feb 2021 13:21:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyE4aTxhumFcl28AEgQGvpDWTFFmEITadxUGnoh/Xi4L/iyeVeWTroeV6FaFWVglHssAZTR X-Received: by 2002:a17:906:9259:: with SMTP id c25mr33198729ejx.37.1614201666810; Wed, 24 Feb 2021 13:21:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614201666; cv=none; d=google.com; s=arc-20160816; b=e+J1iNOzlC0XNupFgkJMwkg7ncs76n1/Q8wJaTS+YdIkka9Cn9x9WuELEMXN+CXAiB t0R3LvT4ijLElJm3++Ezysq78nUPNvnwCsPBGPSLlKWRfn9r7qwYbcm3xcConPveAdwO bq+/xWRSwkzkCb9E1PM/BIyTpbjEusu4/tAuowqvbMTgk1RUI/D0R04fKtO/p0JtupDC U7UaQ1WjB15Q+73BxM205QLq0+QUQa5TGxsfYP5kigLM/rdQEfU5/UMJV57Q3ZcTqgD8 48Do485Gdji28dvpQJd19gmVbvyyzEh26ihtmsplOLI0m1DL0iwwspu00RXVFqgFz7tj 9Wpw== 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:references:in-reply-to :message-id:date:cc:to:from; bh=/h8PysL3obZArLafWYOhnt8yRwXj7SizuxB9R0sPXfo=; b=QFxbesemYFK17OZNHLOjADZzh8sVRjjYU88pw6BzMErMkEQUMtH0NOam8fQredtz/r yX8sVsIZpDTlRNPSolpz0o4DILdomM4w5obGe/JUzrg8OLug+AcK2uts2Z4LGHG+AvxG taCE13r62GP8Rz8bYhqbjon25HTgO48Rm2OfwAZzlI+3UIGK4/xUzdTv+E+fwL+cjHcC xQmYKsHIy53+huDB6HcfyqbwuOQgRX9cGpIebMXiYoxUh8GecJlKlBhM8BimerbL/4Xx pG15gYK9FRTo+CWmhlbb4F3R38+VwGk7enNbMExa32+sYH/6wkE0uuRuTQOz0LZsl+g2 j+aw== 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 v1si2211512ejg.518.2021.02.24.13.21.06; Wed, 24 Feb 2021 13:21:06 -0800 (PST) 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 02E5516077E; Wed, 24 Feb 2021 22:20:53 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 8719216077C for ; Wed, 24 Feb 2021 22:20:51 +0100 (CET) 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 EC595101E; Wed, 24 Feb 2021 13:20:50 -0800 (PST) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E0E843F73D; Wed, 24 Feb 2021 13:20:50 -0800 (PST) From: Honnappa Nagarahalli To: Honnappa Nagarahalli , Konstantin Ananyev Cc: dev@dpdk.org, ruifeng.wang@arm.com, feifei.wang@arm.com, nd@arm.com Date: Wed, 24 Feb 2021 15:20:18 -0600 Message-Id: <20210224212018.17576-6-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210224212018.17576-1-honnappa.nagarahalli@arm.com> References: <20210224212018.17576-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [RFC 5/5] 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 --- app/test/test_ring_stress_impl.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/app/test/test_ring_stress_impl.h b/app/test/test_ring_stress_impl.h index f9ca63b90..ee8293bb0 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();