From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C0F91A04B1 for ; Sat, 10 Oct 2020 18:06:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0B97B1D979; Sat, 10 Oct 2020 18:06:04 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 4891A1D960 for ; Sat, 10 Oct 2020 18:05:59 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201010160549euoutp01179a359712c66965cf1d25c64645424b~8rSayF4yk0390103901euoutp01a for ; Sat, 10 Oct 2020 16:05:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201010160549euoutp01179a359712c66965cf1d25c64645424b~8rSayF4yk0390103901euoutp01a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602345949; bh=9P4E0B5kieQ8/tBzQ8nyDsGgZm6tUvk7hTzdKz8POqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V5siXtX0970R2CEgJrRJSLNMlQFTNF/kyI9Gq+g3NLqBax3sX7wHr3gh50nm1XL+p rYyfEEvxN49BaJu0WAPfLD58eS2Sywvckh1letuxGoKa+z2X6sVkrIc1+uaFBoALQp PFLp/ZYFhCinTa317SPWc7KJLobaMr2aPtWy2Iqw= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201010160543eucas1p2c6c7e89a21659cf16efcbed3d60b27b5~8rSVEWFWb0083200832eucas1p2t; Sat, 10 Oct 2020 16:05:43 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id BF.B2.06318.6DBD18F5; Sat, 10 Oct 2020 17:05:42 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201010160541eucas1p11d079bad2b7500f9ab927463e1eeac04~8rSUD_XnE2236122361eucas1p13; Sat, 10 Oct 2020 16:05:41 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201010160541eusmtrp2da7990605f67bcc7dbf003d604f70fdd~8rSUDd2_N1692616926eusmtrp2J; Sat, 10 Oct 2020 16:05:41 +0000 (GMT) X-AuditID: cbfec7f5-371ff700000018ae-d1-5f81dbd63cc1 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 1B.A6.06017.5DBD18F5; Sat, 10 Oct 2020 17:05:41 +0100 (BST) Received: from Padamandas.fritz.box (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201010160541eusmtip108e5bc475dd9393beb671ed0c77eae70~8rSTWfho52442224422eusmtip15; Sat, 10 Oct 2020 16:05:41 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 10 Oct 2020 18:05:02 +0200 Message-Id: <20201010160508.19709-12-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRmVeSWpSXmKPExsWy7djP87rXbjfGG6xfbGlxY5W9Rd+kj0wW 7z5tZ7J41rOO0eJfxx92B1aPXwuWsnos3vOSyePguz1MAcxRXDYpqTmZZalF+nYJXBnvN69g LOgSrTh28iBzA+MawS5GTg4JAROJjbP3MXUxcnEICaxglPi+dwsrhPOFUeLUpY3sEM5nR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l1i94QBYPSdQ/GzXQahdjYwSJ27fZJvAyLeAkWEVo0hqaXFuem6xkV5xYm5xaV66XnJ+ 7iZGYChuO/Zzyw7GrnfBhxgFOBiVeHglTjXGC7EmlhVX5h5ilOBgVhLhdTp7Ok6INyWxsiq1 KD++qDQntfgQoynQVROZpUST84FxklcSb2hqaG5haWhubG5sZqEkztshcDBGSCA9sSQ1OzW1 ILUIpo+Jg1OqgTH8fuX8HSvWLr/06vKWZxfYP9+e6loa4/Ftk0JCrNGFAnY2oYpAt0lOZ3VT zfUTV7VmP/KojGcRFFBmays6IuYi/HTTGcVNS4L2xHf6ZL8L2ZNePWlPzpMpuz/YcGybI384 9L4Sk//FE05hnB99bGSKFvbO3HJ89YHFq1YXLl68L2SxSVm3oZgSS3FGoqEWc1FxIgAC992p WwIAAA== X-CMS-MailID: 20201010160541eucas1p11d079bad2b7500f9ab927463e1eeac04 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20201010160541eucas1p11d079bad2b7500f9ab927463e1eeac04 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201010160541eucas1p11d079bad2b7500f9ab927463e1eeac04 References: <20201009220202.20834-1-l.wojciechow@partner.samsung.com> <20201010160508.19709-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-stable] [PATCH v7 11/16] test/distributor: replace delays with spin locks X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Instead of making delays in test code and waiting for worker hopefully to reach proper states, synchronize worker shutdown test cases with spin lock on atomic variable. Fixes: c0de0eb82e40 ("distributor: switch over to new API") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- app/test/test_distributor.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index ed03040d1..e8dd75078 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -27,6 +27,7 @@ struct worker_params worker_params; /* statics - all zero-initialized by default */ static volatile int quit; /**< general quit variable for all threads */ static volatile int zero_quit; /**< var for when we just want thr0 to quit*/ +static volatile int zero_sleep; /**< thr0 has quit basic loop and is sleeping*/ static volatile unsigned worker_idx; static volatile unsigned zero_idx; @@ -376,8 +377,10 @@ handle_work_for_shutdown_test(void *arg) /* for worker zero, allow it to restart to pick up last packet * when all workers are shutting down. */ + __atomic_store_n(&zero_sleep, 1, __ATOMIC_RELEASE); while (zero_quit) usleep(100); + __atomic_store_n(&zero_sleep, 0, __ATOMIC_RELEASE); num = rte_distributor_get_pkt(d, id, buf, NULL, 0); @@ -445,7 +448,12 @@ sanity_test_with_worker_shutdown(struct worker_params *wp, /* flush the distributor */ rte_distributor_flush(d); - rte_delay_us(10000); + while (!__atomic_load_n(&zero_sleep, __ATOMIC_ACQUIRE)) + rte_distributor_flush(d); + + zero_quit = 0; + while (__atomic_load_n(&zero_sleep, __ATOMIC_ACQUIRE)) + rte_delay_us(100); for (i = 0; i < rte_lcore_count() - 1; i++) printf("Worker %u handled %u packets\n", i, @@ -505,9 +513,14 @@ test_flush_with_worker_shutdown(struct worker_params *wp, /* flush the distributor */ rte_distributor_flush(d); - rte_delay_us(10000); + while (!__atomic_load_n(&zero_sleep, __ATOMIC_ACQUIRE)) + rte_distributor_flush(d); zero_quit = 0; + + while (__atomic_load_n(&zero_sleep, __ATOMIC_ACQUIRE)) + rte_delay_us(100); + for (i = 0; i < rte_lcore_count() - 1; i++) printf("Worker %u handled %u packets\n", i, __atomic_load_n(&worker_stats[i].handled_packets, @@ -615,6 +628,8 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p) quit = 0; worker_idx = 0; zero_idx = RTE_MAX_LCORE; + zero_quit = 0; + zero_sleep = 0; } static int -- 2.17.1