From: Benno Lossin <benno.lossin@proton.me>
To: Lyude Paul <lyude@redhat.com>, rust-for-linux@vger.kernel.org
Cc: "Danilo Krummrich" <dakr@redhat.com>,
airlied@redhat.com, "Ingo Molnar" <mingo@redhat.com>,
"Will Deacon" <will@kernel.org>,
"Waiman Long" <longman@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
linux-kernel@vger.kernel.org, "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Wedson Almeida Filho" <wedsonaf@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Andreas Hindborg" <a.hindborg@samsung.com>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Martin Rodriguez Reboredo" <yakoyoku@gmail.com>,
"Valentin Obst" <kernel@valentinobst.de>
Subject: Re: [PATCH v5 2/3] rust: sync: Introduce lock::Backend::Context
Date: Fri, 13 Sep 2024 14:14:29 +0000 [thread overview]
Message-ID: <61f87861-db95-4524-99e9-b552c4cefd3e@proton.me> (raw)
In-Reply-To: <20240912190540.53221-3-lyude@redhat.com>
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@redhat.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@redhat.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@proton.me>
---
Cheers,
Benno
next prev parent reply other threads:[~2024-09-13 14:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 19:04 [PATCH v5 0/3] rust: Add irq abstraction, SpinLockIrq Lyude Paul
2024-09-12 19:04 ` [PATCH v5 1/3] rust: Introduce irq module Lyude Paul
2024-09-13 13:33 ` Benno Lossin
2024-09-13 15:48 ` Daniel Almeida
2024-09-14 16:13 ` Gary Guo
2024-09-12 19:04 ` [PATCH v5 2/3] rust: sync: Introduce lock::Backend::Context Lyude Paul
2024-09-13 14:14 ` Benno Lossin [this message]
2024-09-13 15:49 ` Daniel Almeida
2024-09-12 19:04 ` [PATCH v5 3/3] rust: sync: Add SpinLockIrq Lyude Paul
2024-09-13 14:15 ` Benno Lossin
2024-09-13 15:49 ` Daniel Almeida
2024-09-13 15:49 ` [PATCH v5 0/3] rust: Add irq abstraction, SpinLockIrq Daniel Almeida
2024-09-14 16:18 ` Gary Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=61f87861-db95-4524-99e9-b552c4cefd3e@proton.me \
--to=benno.lossin@proton.me \
--cc=a.hindborg@samsung.com \
--cc=airlied@redhat.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@redhat.com \
--cc=gary@garyguo.net \
--cc=kernel@valentinobst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=lyude@redhat.com \
--cc=mingo@redhat.com \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tmgross@umich.edu \
--cc=wedsonaf@gmail.com \
--cc=will@kernel.org \
--cc=yakoyoku@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).