From: Lyude Paul <lyude@redhat.com>
To: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>, "Will Deacon" <will@kernel.org>,
"Waiman Long" <longman@redhat.com>
Subject: [PATCH v18 0/5] SpinLockIrq for rust
Date: Thu, 5 Feb 2026 15:44:26 -0500 [thread overview]
Message-ID: <20260205204709.528234-1-lyude@redhat.com> (raw)
This is the latest patch series for adding rust bindings for controlling
local processor interrupts, adding support for spinlocks in rust that
are acquired with local processor interrupts disabled, and implementing
local interrupt controls through refcounting in the kernel.
The previous version of this patch series can be found here:
https://lore.kernel.org/all/20260121223933.1568682-1-lyude@redhat.com/
This patch series applies on top of boqun's rust-sync branch:
https://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git/?h=rust-sync
Now that we've gotten the C-side of these changes in, this patch series
is now exclusively concerned with the rust side of these changes. For
more information on how we came to the design for the C side of the API,
see the explanation in the previous version of the patch series.
Boqun Feng (1):
rust: helper: Add spin_{un,}lock_irq_{enable,disable}() helpers
Lyude Paul (4):
rust: Introduce interrupt module
rust: sync: use super::* in spinlock.rs
rust: sync: Add SpinLockIrq
rust: sync: Introduce SpinLockIrq::lock_with() and friends
FULL CHANGELOG:
Series-wide:
V15:
* Added a patch for fixing build erors introduced on OpenRISC
V17:
* Squash:
- "rust: sync: Introduce lock::Backend::Context"
- "rust: sync: lock: Add `Backend::BackendInContext`"
With BackendWithContext being a separate trait, it no longer makes
sense for these patches to be separate.
V18:
* Add "rust: sync: use super::* in spinlock.rs"
Patch-specific:
* rust: Introduce interrupt module
V10:
* Fix documentation typos
V11:
* Get rid of unneeded `use bindings;`
* Move ASSUME_DISABLED into assume_disabled()
* Confirm using lockdep_assert_irqs_disabled() that local interrupts are
in fact disabled when LocalInterruptDisabled::assume_disabled() is called.
* rust: helper: Add spin_{un,}lock_irq_{enable,disable}() helpers
V18:
* Add missing __rust_helper annotations
* rust: sync: Add SpinLockIrq
V10:
* Also add support to GlobalLock
* Documentation fixes from Dirk
V11:
* Add unit test requested by Daniel Almeida
V14:
* Improve rustdoc for SpinLockIrqBackend
V18:
* Add missing __rust_helper annotations
* rust: sync: Introduce SpinLockIrq::lock_with() and friends
V10:
* Fix typos - Dirk
V17:
* Introduce `BackendWithContext`, move context-related bits into there and
out of `Backend`.
* Add missing #[must_use = …] for try_lock_with()
* Remove all unsafe code from lock_with() and try_lock_with():
Somehow I never noticed that literally none of the unsafe code in these
two functions is needed with as_lock_in_context()...
V18:
* Drop the traits, just implement this on SpinLockIrq
* rust: sync: Expose lock::Backend
V10:
* Fix typos - Dirk/Lyude
* Since we're adding support for context locks to GlobalLock as well, let's
also make sure to cover try_lock while we're at it and add try_lock_with
* Add a private function as_lock_in_context() for handling casting from a
Lock<T, B> to Lock<T, B::BackendInContext> so we don't have to duplicate
safety comments
V11:
* Fix clippy::ref_as_ptr error in Lock::as_lock_in_context()
V14:
* Add benchmark results, rewrite commit message
* rust: sync: lock/global: Rename B to G in trait bounds
* rust: sync: Add a lifetime parameter to lock::global::GlobalGuard
* rust: sync: lock/global: Add Backend parameter to GlobalGuard
V17:
* Add default parameter for generic `B` to `GlobalGuard`
* rust: sync: lock/global: Add ContextualBackend support to GlobalLock
* locking: Switch to _irq_{disable,enable}() variants in cleanup guards
V10:
* Add PREEMPT_RT build fix from Guangbo Cui
rust/helpers/helpers.c | 1 +
rust/helpers/interrupt.c | 18 ++
rust/helpers/spinlock.c | 15 ++
rust/helpers/sync.c | 5 +
rust/kernel/interrupt.rs | 86 ++++++++
rust/kernel/lib.rs | 1 +
rust/kernel/sync.rs | 4 +-
rust/kernel/sync/lock/global.rs | 3 +
rust/kernel/sync/lock/spinlock.rs | 313 +++++++++++++++++++++++++++++-
9 files changed, 440 insertions(+), 6 deletions(-)
create mode 100644 rust/helpers/interrupt.c
create mode 100644 rust/kernel/interrupt.rs
base-commit: de718b2ca866e10e2a26c259ab0493a5af411879
--
2.53.0
next reply other threads:[~2026-02-05 20:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-05 20:44 Lyude Paul [this message]
2026-02-05 20:44 ` [PATCH v18 1/5] rust: Introduce interrupt module Lyude Paul
2026-02-05 23:13 ` Gary Guo
2026-02-05 20:44 ` [PATCH v18 2/5] rust: helper: Add spin_{un,}lock_irq_{enable,disable}() helpers Lyude Paul
2026-02-05 23:13 ` Gary Guo
2026-02-05 20:44 ` [PATCH v18 3/5] rust: sync: use super::* in spinlock.rs Lyude Paul
2026-02-05 20:44 ` [PATCH v18 4/5] rust: sync: Add SpinLockIrq Lyude Paul
2026-02-05 23:19 ` Gary Guo
2026-02-05 20:44 ` [PATCH v18 5/5] rust: sync: Introduce SpinLockIrq::lock_with() and friends Lyude Paul
2026-02-05 23:23 ` Gary Guo
2026-03-02 22:47 ` lyude
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=20260205204709.528234-1-lyude@redhat.com \
--to=lyude@redhat.com \
--cc=a.hindborg@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=lossin@kernel.org \
--cc=mingo@redhat.com \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tmgross@umich.edu \
--cc=will@kernel.org \
/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