Re: [PATCH v6 3/3] rust: sync: Add SpinLockIrq
From: Trevor Gross
Date: Sun Sep 29 2024 - 16:50:34 EST
On Mon, Sep 16, 2024 at 5:31 PM Lyude Paul <lyude@xxxxxxxxxx> 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>
> Reviewed-by: Benno Lossin <benno.lossin@xxxxxxxxx>
> Reviewed-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
> Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
> +/// Creates a [`SpinLockIrq`] initialiser with the given name and a newly-created lock class.
> +///
> +/// It uses the name if one is given, otherwise it generates one based on the file name and line
> +/// number.
> +#[macro_export]
> +macro_rules! new_spinlock_irq {
It would be good to mention something like "See [`SpinLockIrq`] for
example usage." since there isn't an example here. Not a blocker of
course.
Reviewed-by: Trevor Gross <tmgross@xxxxxxxxx>