linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] seqlock: Introduce PREEMPT_RT support
@ 2020-09-04 15:32 Ahmed S. Darwish
  2020-09-04 15:32 ` [PATCH v2 1/5] seqlock: seqcount_LOCKNAME_t: Standardize naming convention Ahmed S. Darwish
                   ` (5 more replies)
  0 siblings, 6 replies; 23+ messages in thread
From: Ahmed S. Darwish @ 2020-09-04 15:32 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Will Deacon
  Cc: Thomas Gleixner, Sebastian A. Siewior, Paul E. McKenney,
	Steven Rostedt, LKML, Ahmed S. Darwish

Hi,

Changelog-v2
============

  - Standardize on seqcount_LOCKNAME_t as the canonical reference for
    sequence counters with associated locks, instead of v1
    seqcount_LOCKTYPE_t.

  - Use unique prefix "seqprop_*" for all seqcount_t/seqcount_LOCKNAME_t
    property accessors.

  - Touch-up the lock-unlock rationale for more clarity. Enforce writer
    non-preemitiblity using "__seq_enforce_writer_non_preemptibility()".

Cover letter (v1)
=================

https://lkml.kernel.org/r/20200828010710.5407-1-a.darwish@linutronix.de

Preemption must be disabled before entering a sequence counter write
side critical section.  Otherwise the read side section can preempt the
write side section and spin for the entire scheduler tick.  If that
reader belongs to a real-time scheduling class, it can spin forever and
the kernel will livelock.

Disabling preemption cannot be done for PREEMPT_RT though: it can lead
to higher latencies, and the write side sections will not be able to
acquire locks which become sleeping locks (e.g. spinlock_t).

To remain preemptible, while avoiding a possible livelock caused by the
reader preempting the writer, use a different technique: let the reader
detect if a seqcount_LOCKNAME_t writer is in progress. If that's the
case, acquire then release the associated LOCKNAME writer serialization
lock. This will allow any possibly-preempted writer to make progress
until the end of its writer serialization lock critical section.

Implement this lock-unlock technique for all seqcount_LOCKNAME_t with
an associated (PREEMPT_RT) sleeping lock, and for seqlock_t.

8<--------------

Ahmed S. Darwish (5):
  seqlock: seqcount_LOCKNAME_t: Standardize naming convention
  seqlock: Use unique prefix for seqcount_t property accessors
  seqlock: seqcount_t: Implement all read APIs as statement expressions
  seqlock: seqcount_LOCKNAME_t: Introduce PREEMPT_RT support
  seqlock: PREEMPT_RT: Do not starve seqlock_t writers

 include/linux/seqlock.h | 281 ++++++++++++++++++++++++----------------
 1 file changed, 167 insertions(+), 114 deletions(-)

base-commit: f75aef392f869018f78cfedf3c320a6b3fcfda6b
--
2.28.0

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-09-18  8:42 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04 15:32 [PATCH v2 0/5] seqlock: Introduce PREEMPT_RT support Ahmed S. Darwish
2020-09-04 15:32 ` [PATCH v2 1/5] seqlock: seqcount_LOCKNAME_t: Standardize naming convention Ahmed S. Darwish
2020-09-10 15:08   ` [tip: locking/core] " tip-bot2 for Ahmed S. Darwish
2020-09-04 15:32 ` [PATCH v2 2/5] seqlock: Use unique prefix for seqcount_t property accessors Ahmed S. Darwish
2020-09-08 11:41   ` peterz
2020-09-10 15:08   ` [tip: locking/core] " tip-bot2 for Ahmed S. Darwish
2020-09-04 15:32 ` [PATCH v2 3/5] seqlock: seqcount_t: Implement all read APIs as statement expressions Ahmed S. Darwish
2020-09-10 15:08   ` [tip: locking/core] " tip-bot2 for Ahmed S. Darwish
2020-09-04 15:32 ` [PATCH v2 4/5] seqlock: seqcount_LOCKNAME_t: Introduce PREEMPT_RT support Ahmed S. Darwish
2020-09-08 11:45   ` peterz
2020-09-08 12:48     ` Ahmed S. Darwish
2020-09-04 15:32 ` [PATCH v2 5/5] seqlock: PREEMPT_RT: Do not starve seqlock_t writers Ahmed S. Darwish
2020-09-10 15:08   ` [tip: locking/core] " tip-bot2 for Ahmed S. Darwish
2020-09-15  0:20 ` [PATCH v2 0/5] seqlock: Introduce PREEMPT_RT support Qian Cai
2020-09-15 12:48   ` Boqun Feng
2020-09-15 13:10     ` Boqun Feng
2020-09-15 14:30     ` peterz
2020-09-16 12:52       ` Qian Cai
2020-09-16 12:54         ` peterz
2020-09-16 13:00           ` Qian Cai
2020-09-16 13:02             ` peterz
2020-09-17  2:31               ` Stephen Rothwell
2020-09-18  8:42       ` [tip: locking/core] seqlock: Unbreak lockdep tip-bot2 for peterz@infradead.org

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).