From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C5537A09E4; Thu, 28 Jan 2021 02:16:33 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 46F0E141096; Thu, 28 Jan 2021 02:16:33 +0100 (CET) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id 7FE88141095 for ; Thu, 28 Jan 2021 02:16:32 +0100 (CET) Received: by mail-pl1-f179.google.com with SMTP id e9so2403351plh.3 for ; Wed, 27 Jan 2021 17:16:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IIEQWJUIqn+4f8HjFo0BX7L3iGHH91fefeyjTnWxAp4=; b=bXvlYtiuV9V6SIQnIp3co7bF6kS87nooW4uyXWbpd0pb2uwSzqMttV+t/zvFt4QP1g t4Xodh9x3B2Lk1TtLxcCBTlD+TAHfOxAF7RtJnYkeFk8yr1g1CKitOaWu9cOUNy3HEiP e8EmO+gS+Ip4BnXdOb2/NDliPaYh5sW7uU9z2OPEqfc+R+yro2Nka7ardzWGEsPZOAB3 jYo/zGDFWwasuDnvMW2v/0RjbK1Yd37tfVl2Phz9UV7FLzrhR38paWqiFixAkPw++A/0 ikMExlHBK/1kGiBpZOk6ex1wtLippCF/iKeYYOOBzmk5mz+rHZSOPnQsT+BCCAW2mBam ArPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IIEQWJUIqn+4f8HjFo0BX7L3iGHH91fefeyjTnWxAp4=; b=DqIykf1JR5CqaPM91nBIwTegqpqcNiGEXj+FQjJzTeGR9qWrW3BpE5E90OvTBfroCi TPUbOTtGYtAVvgEjkBcqqVVxqIvWOd3OeNTdr0FQSrGl3X6/mbgppEWA5g/8BErnqG5K jYTWCXT+VnzTNT01qhh5gCQBL93TF4shb7yZpY1ZejPeuRKkjTCY+2gFifqzdiBcZW76 cB+Y0b0SEHp50OLe7hxvdCh9oxw/46Iqv2NBeZ2s1IavLboj7kSwXBggOuniC3FArxXh HF7BGn/8g/IZRnNNkjCJCB1dq+xBSMvaYeMevLoDVZW/Zfa1eAZtHbDdg2yytWWFhcqk p+8Q== X-Gm-Message-State: AOAM531cl0Iy6Z5ph7WsbiQ29vyqEH/gg/XPEaCi+mfofzL+RFWNkGKv ZarNO2Wzom/0AaML33KhbZ1wO4JMHR/O0g== X-Google-Smtp-Source: ABdhPJzzUcpVB7cORmvXwNc23lDlQEUjCLu3w9gYg4XIeH+mh2CWHyvuhgnOcbBAKrTc5cac4z5mtg== X-Received: by 2002:a17:90a:fc97:: with SMTP id ci23mr8534443pjb.83.1611796590916; Wed, 27 Jan 2021 17:16:30 -0800 (PST) Received: from hermes.local (76-14-222-244.or.wavecable.com. [76.14.222.244]) by smtp.gmail.com with ESMTPSA id b17sm3756293pfp.167.2021.01.27.17.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jan 2021 17:16:29 -0800 (PST) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Stephen Hemminger Date: Wed, 27 Jan 2021 17:16:21 -0800 Message-Id: <20210128011621.365100-1-sthemmin@microsoft.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210114173454.56657-1-stephen@networkplumber.org> References: <20210114173454.56657-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] eal: add ticket based reader writer lock 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" This patch implements a reader/writer ticket lock because the current DPDK reader/writer lock will starve writers when presented with a stream of readers. This lock type acts like rte_rwlock() but uses a ticket algorithm and is therefore fair for multiple writers and readers. It acts like the existing DPDK ticket and MCS lock but supports reader/writer semantics. It is referred to as "Simple, non-scalable, fair reader-writer lock" in the MCS paper from PPoP '91. The tests are just a clone of existing rte_rwlock with test and function names changed. So the new ticket rwlocks should be drop in replacement for most users. Signed-off-by: Stephen Hemminger --- v2 - fix a minor checkpatch warning and docbook param error app/test/autotest_data.py | 6 ++++++ app/test/meson.build | 5 +++++ doc/api/doxy-api-index.md | 1 + lib/librte_eal/arm/include/meson.build | 1 + lib/librte_eal/include/meson.build | 1 + lib/librte_eal/ppc/include/meson.build | 1 + lib/librte_eal/x86/include/meson.build | 1 + 7 files changed, 16 insertions(+) diff --git a/app/test/autotest_data.py b/app/test/autotest_data.py index 097638941f19..62816c36d873 100644 --- a/app/test/autotest_data.py +++ b/app/test/autotest_data.py @@ -231,6 +231,12 @@ "Func": ticketlock_autotest, "Report": None, }, + { + "Name": "Ticket rwlock autotest", + "Command": "ticket_rwlock_autotest", + "Func": ticketrwlock_autotest, + "Report": None, + }, { "Name": "MCSlock autotest", "Command": "mcslock_autotest", diff --git a/app/test/meson.build b/app/test/meson.build index 0889ad4c2367..e6ace8e597e6 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -136,6 +136,7 @@ test_sources = files('commands.c', 'test_timer_racecond.c', 'test_timer_secondary.c', 'test_ticketlock.c', + 'test_ticket_rwlock.c', 'test_trace.c', 'test_trace_register.c', 'test_trace_perf.c', @@ -247,6 +248,10 @@ fast_tests = [ ['table_autotest', true], ['tailq_autotest', true], ['ticketlock_autotest', true], + ['ticketrwlock_test1_autotest', true], + ['ticketrwlock_rda_autotest', true], + ['ticketrwlock_rds_wrm_autotest', true], + ['ticketrwlock_rde_wro_autotest', true], ['timer_autotest', false], ['user_delay_us', true], ['version_autotest', true], diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index 748514e24316..d76a4c8ba1c4 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -76,6 +76,7 @@ The public API headers are grouped by topics: [rwlock] (@ref rte_rwlock.h), [spinlock] (@ref rte_spinlock.h), [ticketlock] (@ref rte_ticketlock.h), + [ticketrwlock] (@ref rte_ticket_rwlock.h), [RCU] (@ref rte_rcu_qsbr.h) - **CPU arch**: diff --git a/lib/librte_eal/arm/include/meson.build b/lib/librte_eal/arm/include/meson.build index 770766de1a34..951a527ffa64 100644 --- a/lib/librte_eal/arm/include/meson.build +++ b/lib/librte_eal/arm/include/meson.build @@ -28,6 +28,7 @@ arch_headers = files( 'rte_rwlock.h', 'rte_spinlock.h', 'rte_ticketlock.h', + 'rte_ticket_rwlock.h', 'rte_vect.h', ) install_headers(arch_headers, subdir: get_option('include_subdir_arch')) diff --git a/lib/librte_eal/include/meson.build b/lib/librte_eal/include/meson.build index 0dea342e1deb..fe5c19748926 100644 --- a/lib/librte_eal/include/meson.build +++ b/lib/librte_eal/include/meson.build @@ -65,6 +65,7 @@ generic_headers = files( 'generic/rte_rwlock.h', 'generic/rte_spinlock.h', 'generic/rte_ticketlock.h', + 'generic/rte_ticket_rwlock.h', 'generic/rte_vect.h', ) install_headers(generic_headers, subdir: 'generic') diff --git a/lib/librte_eal/ppc/include/meson.build b/lib/librte_eal/ppc/include/meson.build index dae40ede546e..0bc560327749 100644 --- a/lib/librte_eal/ppc/include/meson.build +++ b/lib/librte_eal/ppc/include/meson.build @@ -16,6 +16,7 @@ arch_headers = files( 'rte_rwlock.h', 'rte_spinlock.h', 'rte_ticketlock.h', + 'rte_ticket_rwlock.h', 'rte_vect.h', ) install_headers(arch_headers, subdir: get_option('include_subdir_arch')) diff --git a/lib/librte_eal/x86/include/meson.build b/lib/librte_eal/x86/include/meson.build index 549cc21a42ed..e9169f0d1da5 100644 --- a/lib/librte_eal/x86/include/meson.build +++ b/lib/librte_eal/x86/include/meson.build @@ -20,6 +20,7 @@ arch_headers = files( 'rte_rwlock.h', 'rte_spinlock.h', 'rte_ticketlock.h', + 'rte_ticket_rwlock.h', 'rte_vect.h', ) install_headers(arch_headers, subdir: get_option('include_subdir_arch')) -- 2.29.2