rust: sync: lock: allow fallible initializers in Lock::new
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | rust: sync: lock: allow fallible initializers in Lock::newrust/ | +4 | 2 replies | |
| 2/2 | rust: gpu: buddy: store the allocator inside the Mutexrust/ | +15 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] rust: sync: lock: allow fallible initializers in Lock::new
GpuBuddyInner keeps the C gpu_buddy structure next to a separate Mutex<()> and has a TODO to move the structure inside the mutex once Mutex::new() accepts a fallible initializer.
Patch 1 makes Lock::new() generic over the error type of the initializer for the protected data, so a fallible initializer such as Opaque::try_ffi_init() can be wrapped in a Mutex or SpinLock.
Patch 2 uses it to put the gpu_buddy allocator directly inside the Mutex in GPU buddy, so that the allocator can only be reached through the lock guard, and resolves the TODO.
Tested by building the rust/kernel crate (x86_64 defconfig with CONFIG_RUST=y and CONFIG_GPU_BUDDY=y, built with LLVM=1). Not tested at runtime.
Ivan Tverdokhleb (2):
rust: sync: lock: allow fallible initializers in Lock::new
rust: gpu: buddy: store the allocator inside the Mutex
rust/kernel/gpu/buddy.rs | 38 +++++++++++++++----------------------- rust/kernel/sync/lock.rs | 8 ++++---- 2 files changed, 19 insertions(+), 27 deletions(-)
Signature · 1 line
2.56.1