Re: [PATCH v5 3/3] rust: sync: Add SpinLockIrq

From: Benno Lossin
Date: Fri Sep 13 2024 - 10:15:57 EST


On 12.09.24 21:04, Lyude Paul wrote:
> A variant of SpinLock that is expected to be used in noirq contexts, and
> thus requires that the user provide an kernel::irq::IrqDisabled to prove
> they are in such a context upon lock acquisition. This is the rust
> equivalent of spin_lock_irqsave()/spin_lock_irqrestore().
>
> Signed-off-by: Lyude Paul <lyude@xxxxxxxxxx>
>
> ---
>
> V2:
> * s/IrqSpinLock/SpinLockIrq/
> * Implement `lock::Backend` now that we have `Context`
> * Add missing periods
> * Make sure rustdoc examples compile correctly
> * Add documentation suggestions
>
> Signed-off-by: Lyude Paul <lyude@xxxxxxxxxx>
> ---
> rust/kernel/sync.rs | 2 +-
> rust/kernel/sync/lock/spinlock.rs | 104 ++++++++++++++++++++++++++++++
> 2 files changed, 105 insertions(+), 1 deletion(-)

Reviewed-by: Benno Lossin <benno.lossin@xxxxxxxxx>

---
Cheers,
Benno