From patchwork Sat Oct 17 03:06:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81164 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CDD16A04DB; Sat, 17 Oct 2020 05:07:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B24CE272; Sat, 17 Oct 2020 05:07:29 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id CF95DE272 for ; Sat, 17 Oct 2020 05:07:27 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030716euoutp012cc1905259f9e2808c3f248e6fb32a5c~_qLptjio21628816288euoutp01R for ; Sat, 17 Oct 2020 03:07:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201017030716euoutp012cc1905259f9e2808c3f248e6fb32a5c~_qLptjio21628816288euoutp01R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904036; bh=y6oH84LOyQidGvtZPI5vaKTB3y7Q4/P5Rv9uclyMxdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uuXRTtb4GPPaXPorAwwoBYceRAU7RQZ8GYpSGOCkRz8z4neNFUL3J7QytDRJc/eFf IxDQYuAAkG68XUpgS4s9EqhwlwcaBBBrusCE6Wieh/99gjamO8CtHu5pJkI88vGIFu EK4nZWPDvEgtO5O+z1CPBrrex8NUZA7Pj6XIRLt8= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201017030710eucas1p2bdf52b58769d92324bd756c7569df0d0~_qLk1iQ3Z1097310973eucas1p22; Sat, 17 Oct 2020 03:07:10 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 67.E8.06456.EDF5A8F5; Sat, 17 Oct 2020 04:07:10 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201017030709eucas1p11285f14ee4fe2e79ad5791b0e9b9c653~_qLkCRryP0897308973eucas1p1n; Sat, 17 Oct 2020 03:07:09 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201017030709eusmtrp2ba8a011c835dbc76788c3e33d73be693~_qLj8E5942572125721eusmtrp2g; Sat, 17 Oct 2020 03:07:09 +0000 (GMT) X-AuditID: cbfec7f2-7efff70000001938-28-5f8a5fde6886 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 1A.99.06314.DDF5A8F5; Sat, 17 Oct 2020 04:07:09 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030709eusmtip100b58c98c091647b6b57cba888cb1d4d~_qLjf1aqd0424404244eusmtip1M; Sat, 17 Oct 2020 03:07:09 +0000 (GMT) From: Lukasz Wojciechowski To: Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com Date: Sat, 17 Oct 2020 05:06:44 +0200 Message-Id: <20201017030701.16134-1-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+NgFrrCIsWRmVeSWpSXmKPExsWy7djP87r34rviDd7f0bJ492k7k8WznnWM DkwevxYsZfU4+G4PUwBTFJdNSmpOZllq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3cWEJsZaOTt eU1g9cICDhL9H94wgdgsAqoSh/Z1MoLYvAKuEt/O72WGmC8vsXrDATCbU8BN4mzXQTaQE4SA an5NsJvAyLeAkWEVo0hqaXFuem6xoV5xYm5xaV66XnJ+7iZGYHhtO/Zz8w7GSxuDDzEKcDAq 8fBuWNQZL8SaWFZcmXuIUYKDWUmE1+ns6Tgh3pTEyqrUovz4otKc1OJDjKZAN01klhJNzgeG fl5JvKGpobmFpaG5sbmxmYWSOG+HwMEYIYH0xJLU7NTUgtQimD4mDk6pBkb3o/d/RS/o0Ji0 xerwp6/qt2qioxUsdFpfpsw/vX+Jk4vNgjjW21yOrtfa7OQmKMnWzrH6vmD6Xg7uA7/jHZjX 9nMv2XPcjvezdlRAwPyLl1u3a4nYq6xlfLknUvS1k2xM9mYp0ccxP05/On7kpGgRu+LLdA+e 7QKLzVmc/7OdFNyn+W6SiZESS3FGoqEWc1FxIgCnG6hJRQIAAA== X-CMS-MailID: 20201017030709eucas1p11285f14ee4fe2e79ad5791b0e9b9c653 X-Msg-Generator: CA X-RootMTR: 20201017030709eucas1p11285f14ee4fe2e79ad5791b0e9b9c653 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030709eucas1p11285f14ee4fe2e79ad5791b0e9b9c653 References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 00/17] fix distributor synchronization issues 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" During review and verification of the patch created by Sarosh Arif: "test_distributor: prevent memory leakages from the pool" I found out that running distributor unit tests multiple times in a row causes fails. So I investigated all the issues I found. There are few synchronization issues that might cause deadlocks or corrupted data. They are fixed with this set of patches for both tests and librte_distributor library. --- v8: * simplify memory model to relaxed and remove extra variable in patch 1 * rearrange order of patches: "synchronize lcores statistics" and "fix freeing mbufs" to avoid changing same code twice * reword "packages" -> "packets" in "collect return mbufs" commit message * add patch 17 fixing quitting of workers in distributor tests v7: * add patch 16 ensuring that tests will try sending packets until workers are started and requested for packets v6: * fix comments indentation * fix stats atomic operations memory mode from ACQUIRE/RELEASE to RELAXED v5: * implement missing functionality in burst mode - worker shutdown * fix shutdown test to always shutdown busy worker * use atomic stores instead of barrier in tests clear_packet_count() * reorder patches * new patch 7: fix call to return_pkt in single mode * new patch 11: replacing delays with spinlock on atomics in tests * new patch 12: fix scalar matching algorithm * new patch 13: new test with marking and checking every packet * new patch 14: flush also in flight packets * new patch 15: fix clearing returns buffer * minor fixes in other patches v4: * adjust commit name prefixes app/test -> test/distributor: * reorder patches * use NULL oldpkt in rte_distributor_get_pkt() calls in tests v3: * add missing acked and tested by statements from v1 v2: * assign NULL to freed mbufs in distributor test * fix handshake check on legacy single distributor rte_distributor_return_pkt_single() * add patch 7 passing NULL to legacy API calls if no bufs are returned * add patch 8 fixing API documentation Lukasz Wojciechowski (17): distributor: fix missing handshake synchronization distributor: fix handshake deadlock distributor: do not use oldpkt when not needed distributor: handle worker shutdown in burst mode test/distributor: fix shutdown of busy worker distributor: fix return pkt calls in single mode test/distributor: fix freeing mbufs test/distributor: synchronize lcores statistics test/distributor: collect return mbufs distributor: align API documentation with code test/distributor: replace delays with spin locks distributor: fix scalar matching test/distributor: add test with packets marking distributor: fix flushing in flight packets distributor: fix clearing returns buffer test/distributor: ensure all packets are delivered test/distributor: fix quitting workers app/test/test_distributor.c | 353 ++++++++++++++---- lib/librte_distributor/distributor_private.h | 3 + lib/librte_distributor/rte_distributor.c | 217 ++++++++--- lib/librte_distributor/rte_distributor.h | 23 +- .../rte_distributor_single.c | 4 + 5 files changed, 473 insertions(+), 127 deletions(-)