rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v9 0/9] Refcounted interrupts, SpinLockIrq for rust
@ 2025-02-27 22:10 Lyude Paul
  2025-02-27 22:10 ` [PATCH v9 1/9] preempt: Introduce HARDIRQ_DISABLE_BITS Lyude Paul
                   ` (8 more replies)
  0 siblings, 9 replies; 31+ messages in thread
From: Lyude Paul @ 2025-02-27 22:10 UTC (permalink / raw)
  To: rust-for-linux, Thomas Gleixner
  Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross

Before going into this series, take note that there are still
unresolved performance issues with the ref-counted *spin_lock_irq_*
functions that are unresolved - we could definitely use some assistance
with this. Details here:

https://lore.kernel.org/rust-for-linux/ZxrCrlg1XvaTtJ1I@boqun-archlinux/

It's been a while! This is the latest version of the SpinLockIrq patch
series we've been working on - now with some new refcounted interrupt
disable functions that Boqun came up with. The main changes:

* Add a SpinLockIrqGuard type alias
* Get rid of the closure interface that we were using, SpinLockIrqGuards
  are now refcounted
* Renames
* Rewrite documentation/examples to match
* Addition of local_interrupts_disable() on the rust side

On the C side of things, this patch series introduces the refcounted
spin_lock_irq_disable() and spin_unlock_irq_enable() functions - along
with the rest of the related refcounted variants for this.

The previous version of this patch series is available at:

https://lkml.org/lkml/2024/10/18/1692

The local_interrupts_disable() was suggested by Boqun, though given
tglx's comments I have mixed feelings on having this in our bindings at
all - so I'm not totally opposed to us dropping this if it's decided we
don't want it. I also was careful to make sure that the documentation
generally discourages its use, and also link back to some of the LWN
documentation regarding interrupts that was linked in the discussion
threads previously. At the moment it's at least useful for verifying the
examples we have at least :)

Boqun Feng (6):
  preempt: Introduce HARDIRQ_DISABLE_BITS
  preempt: Introduce __preempt_count_{sub, add}_return()
  irq & spin_lock: Add counted interrupt disabling/enabling
  rust: helper: Add spin_{un,}lock_irq_{enable,disable}() helpers
  rust: sync: lock: Add `Backend::BackendInContext`
  locking: Switch to _irq_{disable,enable}() variants in cleanup guards

Lyude Paul (3):
  rust: Introduce interrupt module
  rust: sync: Add SpinLockIrq
  rust: sync: Introduce lock::Backend::Context

 arch/arm64/include/asm/preempt.h  |  18 +++
 arch/s390/include/asm/preempt.h   |  19 +++
 arch/x86/include/asm/preempt.h    |  10 ++
 include/asm-generic/preempt.h     |  14 +++
 include/linux/irqflags.h          |   1 -
 include/linux/irqflags_types.h    |   6 +
 include/linux/preempt.h           |  20 +++-
 include/linux/spinlock.h          |  88 +++++++++++---
 include/linux/spinlock_api_smp.h  |  27 +++++
 include/linux/spinlock_api_up.h   |   8 ++
 include/linux/spinlock_rt.h       |  10 ++
 kernel/locking/spinlock.c         |  16 +++
 kernel/softirq.c                  |   3 +
 rust/helpers/helpers.c            |   1 +
 rust/helpers/interrupt.c          |  18 +++
 rust/helpers/spinlock.c           |  15 +++
 rust/kernel/interrupt.rs          |  83 ++++++++++++++
 rust/kernel/lib.rs                |   1 +
 rust/kernel/sync.rs               |   4 +-
 rust/kernel/sync/lock.rs          |  34 +++++-
 rust/kernel/sync/lock/mutex.rs    |   2 +
 rust/kernel/sync/lock/spinlock.rs | 185 ++++++++++++++++++++++++++++++
 22 files changed, 561 insertions(+), 22 deletions(-)
 create mode 100644 rust/helpers/interrupt.c
 create mode 100644 rust/kernel/interrupt.rs


base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
-- 
2.48.1


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

end of thread, other threads:[~2025-05-05  9:57 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-27 22:10 [PATCH v9 0/9] Refcounted interrupts, SpinLockIrq for rust Lyude Paul
2025-02-27 22:10 ` [PATCH v9 1/9] preempt: Introduce HARDIRQ_DISABLE_BITS Lyude Paul
2025-02-27 23:09   ` Steven Rostedt
2025-02-28  1:33     ` Boqun Feng
2025-03-03 21:55       ` Lyude Paul
2025-02-28  7:57   ` Peter Zijlstra
2025-02-27 22:10 ` [PATCH v9 2/9] preempt: Introduce __preempt_count_{sub, add}_return() Lyude Paul
2025-02-28  1:49   ` Boqun Feng
2025-02-28  9:15   ` Heiko Carstens
2025-02-28  9:24     ` Peter Zijlstra
2025-04-30 21:38     ` Lyude Paul
2025-05-05  9:56       ` Heiko Carstens
2025-03-01 18:49   ` kernel test robot
2025-03-01 19:00   ` kernel test robot
2025-02-27 22:10 ` [PATCH v9 3/9] irq & spin_lock: Add counted interrupt disabling/enabling Lyude Paul
2025-03-01 20:19   ` kernel test robot
2025-02-27 22:10 ` [PATCH v9 4/9] rust: Introduce interrupt module Lyude Paul
2025-03-02 16:56   ` Dirk Behme
2025-02-27 22:10 ` [PATCH v9 5/9] rust: helper: Add spin_{un,}lock_irq_{enable,disable}() helpers Lyude Paul
2025-02-27 22:10 ` [PATCH v9 6/9] rust: sync: Add SpinLockIrq Lyude Paul
2025-03-02 11:51   ` Guangbo Cui
2025-03-03 22:15     ` Lyude Paul
2025-03-02 17:07   ` Dirk Behme
2025-04-04 21:56     ` Lyude Paul
2025-02-27 22:10 ` [PATCH v9 7/9] rust: sync: Introduce lock::Backend::Context Lyude Paul
2025-03-03 14:22   ` Dirk Behme
2025-02-27 22:10 ` [PATCH v9 8/9] rust: sync: lock: Add `Backend::BackendInContext` Lyude Paul
2025-03-03 14:23   ` Dirk Behme
2025-02-27 22:10 ` [PATCH v9 9/9] locking: Switch to _irq_{disable,enable}() variants in cleanup guards Lyude Paul
2025-04-05  8:25   ` Guangbo Cui
2025-04-05  8:55     ` Guangbo Cui

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