From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id EB1CAA0096 for ; Wed, 5 Jun 2019 17:59:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A8D7C1BBB4; Wed, 5 Jun 2019 17:59:41 +0200 (CEST) Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 7D44B1BBA1 for ; Wed, 5 Jun 2019 17:59:40 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 90373374; Wed, 5 Jun 2019 08:59:39 -0700 (PDT) Received: from phil-VirtualBox.shanghai.arm.com (unknown [10.171.20.59]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 124083F246; Wed, 5 Jun 2019 08:59:37 -0700 (PDT) From: Phil Yang To: dev@dpdk.org Cc: thomas@monjalon.net, jerinj@marvell.com, hemant.agrawal@nxp.com, Honnappa.Nagarahalli@arm.com, gavin.hu@arm.com, phil.yang@arm.com, nd@arm.com Date: Wed, 5 Jun 2019 23:58:45 +0800 Message-Id: <1559750328-22377-1-git-send-email-phil.yang@arm.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH v1 0/3] MCS queued lock implementation 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 set added MCS lock library and its unit test. The MCS lock (proposed by JOHN M. MELLOR-CRUMMEY and MICHAEL L. SCOTT) provides scalability by spinning on a CPU/thread local variable which avoids expensive cache bouncings. It provides fairness by maintaining a list of acquirers and passing the lock to each CPU/thread in the order they acquired the lock. References: 1. http://web.mit.edu/6.173/www/currentsemester/readings/R06-scalable-synchronization-1991.pdf 2. https://lwn.net/Articles/590243/ Mirco-benchmarking result: ------------------------------------------------------------------------------------------------ MCS lock | spinlock | ticket lock ------------------------------+--------------------------------+-------------------------------- Test with lock on 13 cores... | Test with lock on 14 cores... | Test with lock on 14 cores... Core [15] Cost Time = 22426 us| Core [14] Cost Time = 47974 us| Core [14] cost time = 66761 us Core [16] Cost Time = 22382 us| Core [15] Cost Time = 46979 us| Core [15] cost time = 66766 us Core [17] Cost Time = 22294 us| Core [16] Cost Time = 46044 us| Core [16] cost time = 66761 us Core [18] Cost Time = 22412 us| Core [17] Cost Time = 28793 us| Core [17] cost time = 66767 us Core [19] Cost Time = 22407 us| Core [18] Cost Time = 48349 us| Core [18] cost time = 66758 us Core [20] Cost Time = 22436 us| Core [19] Cost Time = 19381 us| Core [19] cost time = 66766 us Core [21] Cost Time = 22414 us| Core [20] Cost Time = 47914 us| Core [20] cost time = 66763 us Core [22] Cost Time = 22405 us| Core [21] Cost Time = 48333 us| Core [21] cost time = 66766 us Core [23] Cost Time = 22435 us| Core [22] Cost Time = 38900 us| Core [22] cost time = 66749 us Core [24] Cost Time = 22401 us| Core [23] Cost Time = 45374 us| Core [23] cost time = 66765 us Core [25] Cost Time = 22408 us| Core [24] Cost Time = 16121 us| Core [24] cost time = 66762 us Core [26] Cost Time = 22380 us| Core [25] Cost Time = 42731 us| Core [25] cost time = 66768 us Core [27] Cost Time = 22395 us| Core [26] Cost Time = 29439 us| Core [26] cost time = 66768 us | Core [27] Cost Time = 38071 us| Core [27] cost time = 66767 us ------------------------------+--------------------------------+-------------------------------- Total Cost Time = 291195 us | Total Cost Time = 544403 us | Total cost time = 934687 us ------------------------------------------------------------------------------------------------ Phil Yang (3): eal/mcslock: add mcs queued lock implementation eal/mcslock: use generic msc queued lock on all arch test/mcslock: add mcs queued lock unit test MAINTAINERS | 5 + app/test/Makefile | 1 + app/test/autotest_data.py | 6 + app/test/autotest_test_funcs.py | 32 +++ app/test/meson.build | 2 + app/test/test_mcslock.c | 248 +++++++++++++++++++++ doc/api/doxy-api-index.md | 1 + doc/guides/rel_notes/release_19_08.rst | 6 + lib/librte_eal/common/Makefile | 2 +- .../common/include/arch/arm/rte_mcslock.h | 23 ++ .../common/include/arch/ppc_64/rte_mcslock.h | 19 ++ .../common/include/arch/x86/rte_mcslock.h | 19 ++ .../common/include/generic/rte_mcslock.h | 169 ++++++++++++++ lib/librte_eal/common/meson.build | 1 + 14 files changed, 533 insertions(+), 1 deletion(-) create mode 100644 app/test/test_mcslock.c create mode 100644 lib/librte_eal/common/include/arch/arm/rte_mcslock.h create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_mcslock.h create mode 100644 lib/librte_eal/common/include/arch/x86/rte_mcslock.h create mode 100644 lib/librte_eal/common/include/generic/rte_mcslock.h -- 2.7.4