[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aLZT9PQQyREAZuCm@tardis-2.local>
Date: Mon, 1 Sep 2025 19:18:28 -0700
From: Boqun Feng <boqun.feng@...il.com>
To: Benno Lossin <lossin@...nel.org>
Cc: Gary Guo <gary@...yguo.net>, Gary Guo <gary@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Mark Rutland <mark.rutland@....com>,
Tamir Duberstein <tamird@...il.com>,
Francesco Zardi <frazar00@...il.com>,
Antonio Hickey <contact@...oniohickey.com>,
rust-for-linux@...r.kernel.org, David Gow <davidgow@...gle.com>,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 4/5] rust: block: convert `block::mq` to use `Refcount`
On Thu, Aug 28, 2025 at 09:18:40AM +0200, Benno Lossin wrote:
> On Wed Aug 27, 2025 at 9:51 PM CEST, Gary Guo wrote:
> > On Tue, 12 Aug 2025 10:17:44 +0200
> > "Benno Lossin" <lossin@...nel.org> wrote:
> >> On Thu Jul 24, 2025 at 1:32 AM CEST, Gary Guo wrote:
> >> > @@ -34,6 +36,18 @@ fn as_ptr(&self) -> *mut bindings::refcount_t {
> >> > self.0.get()
> >> > }
> >> >
> >> > + /// Get the underlying atomic counter that backs the refcount.
> >> > + ///
> >> > + /// NOTE: This will be changed to LKMM atomic in the future.
> >>
> >> Can we discourage using this function a bit more in the docs? At least
> >> point people to try other ways before reaching for this, since it allows
> >> overflowing & doesn't warn on saturate etc.
> >
> > Would this additional doc comment be good enough for you?
> >
> > /// NOTE: usage of this function is discouraged unless there is no way
> > /// to achieve the desired result using APIs in `refcount.h`. If an API
> > /// in `refcount.h` does not currently contain a binding, please
> > /// consider adding a binding for it instead.
>
> I'd like to stress that the atomic doesn't have the same protections as
> the refcount type, how about:
>
> /// NOTE: usage of this function is discouraged as it can circumvent the protections offered by
> /// `refcount.h`. If there is no way to achieve the result using APIs in `refcount.h`, then this
> /// function can be used. Otherwise consider adding a binding for the required API.
>
Looks good to me. I will apply this and some adjustment against my
atomic patchset, and queue this whole series for v6.18, thanks!
Regards,
Boqun
> ---
> Cheers,
> Benno
Powered by blists - more mailing lists