From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 0B3A52B9A for ; Mon, 25 Mar 2019 12:11:22 +0100 (CET) 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 40A2C15AB; Mon, 25 Mar 2019 04:11:22 -0700 (PDT) Received: from net-arm-thunderx2.shanghai.arm.com (net-arm-thunderx2.shanghai.arm.com [10.169.40.112]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C52B93F575; Mon, 25 Mar 2019 04:11:20 -0700 (PDT) From: Joyce Kong To: dev@dpdk.org Cc: nd@arm.com, stephen@networkplumber.org, jerin.jacob@caviumnetworks.com, konstantin.ananyev@intel.com, thomas@monjalon.net, honnappa.nagarahalli@arm.com, gavin.hu@arm.com Date: Mon, 25 Mar 2019 19:11:06 +0800 Message-Id: <1553512269-146074-1-git-send-email-joyce.kong@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547802943-18711-1-git-send-email-joyce.kong@arm.com> References: <1547802943-18711-1-git-send-email-joyce.kong@arm.com> Subject: [dpdk-dev] [PATCH v8 0/3] ticketlock: implement ticketlock and add test case 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: , X-List-Received-Date: Mon, 25 Mar 2019 11:11:23 -0000 v8: 1. Enhance functional test for ticketlock by adding extra verification to ensure correct locking in MT env. 2. Amortize the cost of getting time in test case. (Suggested by Konstantin Ananyev) v7: 1. Modify trylock to compare both current and next fields to gurantee the lock being obtained only if tl->current==1(lock is free). As within the trylock function, suppose next==curr=1, then this thread will experience really long context switch, and next time it continues its execution and tl->next wraps around to 1 again and tl_couurent==0(lock held by another thread),this trylock will return a success, that means two threads holding the lock. (Suggested by Konstantin Ananyev) 2. Let all archs use generic ticketlock implementation. v6: Add rte_ticketlock.h in lib/librte_eal/common/include/arch/arm/. Sort header inside ticketlock files by alphabetical order. v5: Change the variants inside rte_ticket_lock from unint to uint16_t for binary compatibility with the plain spin lock(suggested by Honnappa Nagarahalli)). v4: Change some assignment operation in recursive ticket lock to __atomic. V3: 1.Update ticketlock intrduction(suggested by Honnappa Nagarahalli). 2.Change the implementation of rte_ticketlock_trylock to CAS(suggested by Honnappa Nagarahalli). V2: 1.Update commit message(suggested by Jerin Jacob). 2.Add ticketlock test cases(suggested by Jerin Jacob). V1: Implement ticket lock to improve lock fairness and prdictability. As shown on thundex-2 platform: *** ticketlock_autotest with this patch *** Core [0] count = 496 Core [1] count = 495 Core [2] count = 498 ... Core [209] count = 488 Core [210] count = 490 Core [211] count = 474 Joyce Kong (3): eal/ticketlock: ticket based to improve fairness eal/ticketlock: enable generic ticketlock on all arch test/ticketlock: add ticket lock test case MAINTAINERS | 5 + app/test/Makefile | 1 + app/test/autotest_data.py | 6 + app/test/meson.build | 1 + app/test/test_ticketlock.c | 319 +++++++++++++++++++++ doc/api/doxy-api-index.md | 1 + lib/librte_eal/common/Makefile | 2 +- .../common/include/arch/arm/rte_ticketlock.h | 22 ++ .../common/include/arch/ppc_64/rte_ticketlock.h | 18 ++ .../common/include/arch/x86/rte_ticketlock.h | 18 ++ .../common/include/generic/rte_ticketlock.h | 215 ++++++++++++++ lib/librte_eal/common/meson.build | 1 + 12 files changed, 608 insertions(+), 1 deletion(-) create mode 100644 app/test/test_ticketlock.c create mode 100644 lib/librte_eal/common/include/arch/arm/rte_ticketlock.h create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_ticketlock.h create mode 100644 lib/librte_eal/common/include/arch/x86/rte_ticketlock.h create mode 100644 lib/librte_eal/common/include/generic/rte_ticketlock.h -- 2.7.4 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 CA1BFA05D3 for ; Mon, 25 Mar 2019 12:11:25 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DFA582B9A; Mon, 25 Mar 2019 12:11:24 +0100 (CET) Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 0B3A52B9A for ; Mon, 25 Mar 2019 12:11:22 +0100 (CET) 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 40A2C15AB; Mon, 25 Mar 2019 04:11:22 -0700 (PDT) Received: from net-arm-thunderx2.shanghai.arm.com (net-arm-thunderx2.shanghai.arm.com [10.169.40.112]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C52B93F575; Mon, 25 Mar 2019 04:11:20 -0700 (PDT) From: Joyce Kong To: dev@dpdk.org Cc: nd@arm.com, stephen@networkplumber.org, jerin.jacob@caviumnetworks.com, konstantin.ananyev@intel.com, thomas@monjalon.net, honnappa.nagarahalli@arm.com, gavin.hu@arm.com Date: Mon, 25 Mar 2019 19:11:06 +0800 Message-Id: <1553512269-146074-1-git-send-email-joyce.kong@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547802943-18711-1-git-send-email-joyce.kong@arm.com> References: <1547802943-18711-1-git-send-email-joyce.kong@arm.com> Subject: [dpdk-dev] [PATCH v8 0/3] ticketlock: implement ticketlock and add test case 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190325111106.hl7MCkjLGs_vCHILPMPSqkyYuTdsm5-wgit_-LoZaHQ@z> v8: 1. Enhance functional test for ticketlock by adding extra verification to ensure correct locking in MT env. 2. Amortize the cost of getting time in test case. (Suggested by Konstantin Ananyev) v7: 1. Modify trylock to compare both current and next fields to gurantee the lock being obtained only if tl->current==1(lock is free). As within the trylock function, suppose next==curr=1, then this thread will experience really long context switch, and next time it continues its execution and tl->next wraps around to 1 again and tl_couurent==0(lock held by another thread),this trylock will return a success, that means two threads holding the lock. (Suggested by Konstantin Ananyev) 2. Let all archs use generic ticketlock implementation. v6: Add rte_ticketlock.h in lib/librte_eal/common/include/arch/arm/. Sort header inside ticketlock files by alphabetical order. v5: Change the variants inside rte_ticket_lock from unint to uint16_t for binary compatibility with the plain spin lock(suggested by Honnappa Nagarahalli)). v4: Change some assignment operation in recursive ticket lock to __atomic. V3: 1.Update ticketlock intrduction(suggested by Honnappa Nagarahalli). 2.Change the implementation of rte_ticketlock_trylock to CAS(suggested by Honnappa Nagarahalli). V2: 1.Update commit message(suggested by Jerin Jacob). 2.Add ticketlock test cases(suggested by Jerin Jacob). V1: Implement ticket lock to improve lock fairness and prdictability. As shown on thundex-2 platform: *** ticketlock_autotest with this patch *** Core [0] count = 496 Core [1] count = 495 Core [2] count = 498 ... Core [209] count = 488 Core [210] count = 490 Core [211] count = 474 Joyce Kong (3): eal/ticketlock: ticket based to improve fairness eal/ticketlock: enable generic ticketlock on all arch test/ticketlock: add ticket lock test case MAINTAINERS | 5 + app/test/Makefile | 1 + app/test/autotest_data.py | 6 + app/test/meson.build | 1 + app/test/test_ticketlock.c | 319 +++++++++++++++++++++ doc/api/doxy-api-index.md | 1 + lib/librte_eal/common/Makefile | 2 +- .../common/include/arch/arm/rte_ticketlock.h | 22 ++ .../common/include/arch/ppc_64/rte_ticketlock.h | 18 ++ .../common/include/arch/x86/rte_ticketlock.h | 18 ++ .../common/include/generic/rte_ticketlock.h | 215 ++++++++++++++ lib/librte_eal/common/meson.build | 1 + 12 files changed, 608 insertions(+), 1 deletion(-) create mode 100644 app/test/test_ticketlock.c create mode 100644 lib/librte_eal/common/include/arch/arm/rte_ticketlock.h create mode 100644 lib/librte_eal/common/include/arch/ppc_64/rte_ticketlock.h create mode 100644 lib/librte_eal/common/include/arch/x86/rte_ticketlock.h create mode 100644 lib/librte_eal/common/include/generic/rte_ticketlock.h -- 2.7.4