aboutsummaryrefslogtreecommitdiff
path: root/rust/kernel/sync.rs
diff options
context:
space:
mode:
authorLyude Paul <lyude@redhat.com>2026-08-07 00:02:14 -0700
committerPeter Zijlstra <peterz@infradead.org>2026-08-10 12:53:10 +0200
commit5967f4df55521de596cbe34e0c0c96e962ef3f2e (patch)
tree541001322f9cff57859345d784adc111bff1aab5 /rust/kernel/sync.rs
parentdf9165ab5254acb2035919c6e0511de799c1e8c1 (diff)
rust: sync: Add SpinLockIrq
A variant of `SpinLock` that ensures interrupts are disabled in the critical section. `lock()` will ensure that either interrupts are already disabled or disable them. `unlock()` will reverse the respective operation. [Boqun: Port to use spin_lock_irq_disable() and spin_unlock_irq_enable()] Signed-off-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Boqun Feng <boqun@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://patch.msgid.link/20260807070218.27144-18-boqun@kernel.org
Diffstat (limited to 'rust/kernel/sync.rs')
-rw-r--r--rust/kernel/sync.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/rust/kernel/sync.rs b/rust/kernel/sync.rs
index 993dbf2caa0e..df4f2604ff9b 100644
--- a/rust/kernel/sync.rs
+++ b/rust/kernel/sync.rs
@@ -27,7 +27,14 @@ pub use completion::Completion;
pub use condvar::{new_condvar, CondVar, CondVarTimeoutResult};
pub use lock::global::{global_lock, GlobalGuard, GlobalLock, GlobalLockBackend, GlobalLockedBy};
pub use lock::mutex::{new_mutex, Mutex, MutexGuard};
-pub use lock::spinlock::{new_spinlock, SpinLock, SpinLockGuard};
+pub use lock::spinlock::{
+ new_spinlock,
+ new_spinlock_irq,
+ SpinLock,
+ SpinLockGuard,
+ SpinLockIrq,
+ SpinLockIrqGuard, //
+};
pub use locked_by::LockedBy;
pub use refcount::Refcount;
pub use set_once::SetOnce;