public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] rust: sync: Add Lock::is_locked()
@ 2024-11-20 22:30 Lyude Paul
  2024-11-20 22:30 ` [PATCH 1/3] " Lyude Paul
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Lyude Paul @ 2024-11-20 22:30 UTC (permalink / raw)
  To: rust-for-linux
  Cc: linux-kernel, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross

Now that we expose Guard::new() outside of the lock module, I figured it
would be a good idea for us to actually add some debug assertions to
ensure that callers outside of this module don't call Guard::new() for
locks they don't actually hold.

This series adds the ability to do so, while also making sure that we
don't needlessly run these debug assertions for the more common usecase
of acquiring a lock in safe rust code.

Lyude Paul (3):
  rust: sync: Add Lock::is_locked()
  rust: sync: Assert Lock::is_locked in Guard::new for debug builds
  rust: sync: Add Guard::new_unchecked()

 rust/helpers/spinlock.c           |  5 ++++
 rust/kernel/sync/lock.rs          | 42 +++++++++++++++++++++++++++++--
 rust/kernel/sync/lock/mutex.rs    |  5 ++++
 rust/kernel/sync/lock/spinlock.rs |  5 ++++
 4 files changed, 55 insertions(+), 2 deletions(-)


base-commit: b2603f8ac8217bc59f5c7f248ac248423b9b99cb
prerequisite-patch-id: 8c65a39abe47832d0c98c9c266b4b9348fb3526a
prerequisite-patch-id: 211faf8533feec77907b0a1b9b2f788e72c5ac58
-- 
2.47.0


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

end of thread, other threads:[~2024-11-25 21:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-20 22:30 [PATCH 0/3] rust: sync: Add Lock::is_locked() Lyude Paul
2024-11-20 22:30 ` [PATCH 1/3] " Lyude Paul
2024-11-20 23:53   ` Boqun Feng
2024-11-20 22:30 ` [PATCH 2/3] rust: sync: Assert Lock::is_locked in Guard::new for debug builds Lyude Paul
2024-11-20 23:59   ` Boqun Feng
2024-11-22 20:30     ` Lyude Paul
2024-11-25 21:30       ` Boqun Feng
2024-11-20 22:30 ` [PATCH 3/3] rust: sync: Add Guard::new_unchecked() Lyude Paul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox