[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <61f87861-db95-4524-99e9-b552c4cefd3e@proton.me>
Date: Fri, 13 Sep 2024 14:14:29 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Lyude Paul <lyude@...hat.com>, rust-for-linux@...r.kernel.org
Cc: Danilo Krummrich <dakr@...hat.com>, airlied@...hat.com, Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>, Waiman Long <longman@...hat.com>, Peter Zijlstra <peterz@...radead.org>, Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org, Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, Wedson Almeida Filho <wedsonaf@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>, Andreas Hindborg <a.hindborg@...sung.com>, Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Martin Rodriguez Reboredo <yakoyoku@...il.com>, Valentin Obst <kernel@...entinobst.de>
Subject: Re: [PATCH v5 2/3] rust: sync: Introduce lock::Backend::Context
On 12.09.24 21:04, Lyude Paul wrote:
> Now that we've introduced an `IrqDisabled` token for marking contexts in
> which IRQs are disabled, we need a way to be able to pass it to locks that
> require that IRQs are disabled. In order to continue using the
> `lock::Backend` type instead of inventing our own thing, we accomplish this
> by adding the associated Context type, along with a `lock_with()` function
> that can accept a Context when acquiring a lock. To allow current users of
> context-less locks to keep using the normal `lock()` method, we take an
> example from Wedson Almeida Filho's work and add a `where T<'a>: Default`
> bound to `lock()` so that it can only be called on lock types where the
> context is simply a placeholder value, then re-implement it through the new
> `lock_with()` function.
>
> Signed-off-by: Lyude Paul <lyude@...hat.com>
>
> ---
>
> V3:
> * Use explicit lifetimes in lock_with() to ensure self and _context have
> the same lifetime (Benno)
> * Use () for locks that don't need a Context instead of PhantomData (Benno)
> V4:
> * Fix typo (Dirk)
>
> Signed-off-by: Lyude Paul <lyude@...hat.com>
I don't think that you need your SOB twice.
> ---
> rust/kernel/sync/lock.rs | 17 +++++++++++++++--
> rust/kernel/sync/lock/mutex.rs | 1 +
> rust/kernel/sync/lock/spinlock.rs | 1 +
> 3 files changed, 17 insertions(+), 2 deletions(-)
This looks good:
Reviewed-by: Benno Lossin <benno.lossin@...ton.me>
---
Cheers,
Benno
Powered by blists - more mailing lists