[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200827114044.11173-1-a.darwish@linutronix.de>
Date: Thu, 27 Aug 2020 13:40:36 +0200
From: "Ahmed S. Darwish" <a.darwish@...utronix.de>
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
"Sebastian A. Siewior" <bigeasy@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
"Ahmed S. Darwish" <a.darwish@...utronix.de>,
Borislav Petkov <bp@...en8.de>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>
Subject: [PATCH v1 0/8] seqlock: Introduce seqcount_latch_t
Latch sequence counters are a multiversion concurrency control mechanism
where the embedded seqcount_t counter even/odd value is used to switch
between two copies of protected data. This allows the sequence counter
read side to be invoked from NMIs and safely interrupt its own write
side critical section.
Initially, latch sequence counters were implemented as a single write
function above plain seqcount_t, raw_write_seqcount_latch(). The read
path was expected to use plain seqcount_t raw_read_seqcount().
A specialized latch read function, raw_read_seqcount_latch(), was later
added. It became the standardized way for latch read paths. Due to the
dependent load, it has one read memory barrier less than the more
generic raw_read_seqcount() API.
Only raw_write_seqcount_latch() and raw_read_seqcount_latch() should be
used with latch sequence counters. Having unique read and write path
APIs means that latch sequence counters are actually a data type of
their own -- just inappropriately overloading plain seqcount_t.
Introduce seqcount_latch_t. This adds type-safety and ensures that only
the correct latch-safe APIs are to be used.
Not to break bisection, let the latch APIs also accept plain seqcount_t
or seqcount_raw_spinlock_t. After converting all call sites to
seqcount_latch_t, (patches #4 => #7), only allow seqcount_latch_t.
Thanks,
8<--------------
Ahmed S. Darwish (8):
time/sched_clock: Use raw_read_seqcount_latch() during suspend
mm/swap: Do not abuse the seqcount_t latching API
seqlock: Introduce seqcount_latch_t
time/sched_clock: Use seqcount_latch_t
timekeeping: Use seqcount_latch_t
x86/tsc: Use seqcount_latch_t
rbtree_latch: Use seqcount_latch_t
seqlock: seqcount latch APIs: Only allow seqcount_latch_t
Documentation/locking/seqlock.rst | 18 ++++++
arch/x86/kernel/tsc.c | 12 ++--
include/linux/rbtree_latch.h | 6 +-
include/linux/seqlock.h | 96 +++++++++++++++++++++----------
kernel/time/sched_clock.c | 6 +-
kernel/time/timekeeping.c | 10 ++--
mm/swap.c | 65 +++++++++++++++++----
7 files changed, 156 insertions(+), 57 deletions(-)
base-commit: d012a7190fc1fd72ed48911e77ca97ba4521bccd
--
2.28.0
Powered by blists - more mailing lists