From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <sthemmin@microsoft.com>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH v2] eal: add ticket based reader writer lock
Date: Wed, 27 Jan 2021 17:16:21 -0800 [thread overview]
Message-ID: <20210128011621.365100-1-sthemmin@microsoft.com> (raw)
In-Reply-To: <20210114173454.56657-1-stephen@networkplumber.org>
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 <stephen@networkplumber.org>
---
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
next prev parent reply other threads:[~2021-01-28 1:16 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-12 6:05 [dpdk-dev] [RFC] eal: add fair " Stephen Hemminger
2021-01-14 17:34 ` [dpdk-dev] [PATCH v1] eal: add ticket based " Stephen Hemminger
2021-01-27 10:25 ` Ruifeng Wang
2021-01-28 1:32 ` Stephen Hemminger
2021-01-28 1:16 ` Stephen Hemminger [this message]
2021-02-12 1:38 ` [dpdk-dev] [RFC] pflock: add implementation of phase-fair locks Stephen Hemminger
2021-02-28 17:21 ` [dpdk-dev] [PATCH v1] pflock: implementation of phase-fair reader writer locks Stephen Hemminger
2021-03-03 18:30 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
2021-03-03 19:19 ` [dpdk-dev] [PATCH v3] " Stephen Hemminger
2021-03-26 17:17 ` Stephen Hemminger
2021-03-29 3:14 ` Honnappa Nagarahalli
2021-03-29 17:22 ` Stephen Hemminger
2021-03-29 18:09 ` Honnappa Nagarahalli
2021-03-29 19:58 ` Stephen Hemminger
2021-03-30 0:18 ` Honnappa Nagarahalli
2021-03-30 4:56 ` Stephen Hemminger
2021-03-30 5:00 ` [dpdk-dev] [PATCH v4] pflock: add " Stephen Hemminger
2021-03-30 5:14 ` Stephen Hemminger
2021-03-31 4:19 ` Honnappa Nagarahalli
2021-03-31 16:32 ` Stephen Hemminger
2021-04-02 1:37 ` Stephen Hemminger
2021-04-02 1:42 ` [dpdk-dev] [PATCH v5] pflock: implementation of " Stephen Hemminger
2021-04-06 21:56 ` Honnappa Nagarahalli
2021-04-06 22:33 ` Stephen Hemminger
2021-04-07 0:17 ` Honnappa Nagarahalli
2021-04-07 15:09 ` Ananyev, Konstantin
2021-04-14 15:36 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210128011621.365100-1-sthemmin@microsoft.com \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=sthemmin@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).