From: Alice Ryhl <aliceryhl@google.com>
To: Tamir Duberstein <tamird@gmail.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Danilo Krummrich" <dakr@kernel.org>, "Tejun Heo" <tj@kernel.org>,
"Lai Jiangshan" <jiangshanlai@gmail.com>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 2/2] rust: workqueue: remove HasWork::OFFSET
Date: Fri, 11 Apr 2025 09:10:36 +0000 [thread overview]
Message-ID: <Z_jcjEtKZRpRi9Yn@google.com> (raw)
In-Reply-To: <CAJ-ks9kms_jFEAHX9MnW1pUOyTeuFuyWwXk-A+qhCPQQNfJdAw@mail.gmail.com>
On Thu, Apr 10, 2025 at 10:15:53AM -0400, Tamir Duberstein wrote:
> On Thu, Apr 10, 2025 at 5:16 AM Alice Ryhl <aliceryhl@google.com> wrote:
> >
> > On Wed, Apr 09, 2025 at 06:03:22AM -0400, Tamir Duberstein wrote:
> > > Implement `HasWork::work_container_of` in `impl_has_work!`, narrowing
> > > the interface of `HasWork` and replacing pointer arithmetic with
> > > `container_of!`. Remove the provided implementation of
> > > `HasWork::get_work_offset` without replacement; an implementation is
> > > already generated in `impl_has_work!`. Remove the `Self: Sized` bound on
> > > `HasWork::work_container_of` which was apparently necessary to access
> > > `OFFSET` as `OFFSET` no longer exists.
> > >
> > > A similar API change was discussed on the hrtimer series[1].
> > >
> > > Link: https://lore.kernel.org/all/20250224-hrtimer-v3-v6-12-rc2-v9-1-5bd3bf0ce6cc@kernel.org/ [1]
> > > Reviewed-by: Benno Lossin <benno.lossin@proton.me>
> > > Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> > > Tested-by: Alice Ryhl <aliceryhl@google.com>
> > > Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> > > ---
> > > rust/kernel/workqueue.rs | 45 ++++++++++++---------------------------------
> > > 1 file changed, 12 insertions(+), 33 deletions(-)
> > >
> > > diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs
> > > index f98bd02b838f..1d640dbdc6ad 100644
> > > --- a/rust/kernel/workqueue.rs
> > > +++ b/rust/kernel/workqueue.rs
> > > @@ -429,51 +429,23 @@ pub unsafe fn raw_get(ptr: *const Self) -> *mut bindings::work_struct {
> > > ///
> > > /// # Safety
> > > ///
> > > -/// The [`OFFSET`] constant must be the offset of a field in `Self` of type [`Work<T, ID>`]. The
> > > -/// methods on this trait must have exactly the behavior that the definitions given below have.
> > > +/// The methods on this trait must have exactly the behavior that the definitions given below have.
> >
> > This wording probably needs to be rephrased. You got rid of the
> > definitions that sentence refers to.
>
> I don't follow. What definitions was it referring to? I interpreted it
> as having referred to all the items: constants *and* methods.
I meant for it to refer to the default implementations of the methods.
> Could you propose an alternate phrasing?
I guess the requirements are something along the lines of raw_get_work
must return a value pointer, and it must roundtrip with
raw_container_of.
Alice
next prev parent reply other threads:[~2025-04-11 9:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-09 10:03 [PATCH v2 0/2] rust: workqueue: remove HasWork::OFFSET Tamir Duberstein
2025-04-09 10:03 ` [PATCH v2 1/2] rust: retain pointer mut-ness in `container_of!` Tamir Duberstein
2025-04-09 11:12 ` Andreas Hindborg
2025-04-09 10:03 ` [PATCH v2 2/2] rust: workqueue: remove HasWork::OFFSET Tamir Duberstein
2025-04-09 11:12 ` Andreas Hindborg
2025-04-10 9:16 ` Alice Ryhl
2025-04-10 14:15 ` Tamir Duberstein
2025-04-11 9:10 ` Alice Ryhl [this message]
2025-04-11 13:56 ` Tamir Duberstein
2025-04-11 14:03 ` Alice Ryhl
2025-04-09 14:55 ` [PATCH v2 0/2] " Tamir Duberstein
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=Z_jcjEtKZRpRi9Yn@google.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=benno.lossin@proton.me \
--cc=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@gmail.com \
--cc=tj@kernel.org \
--cc=tmgross@umich.edu \
/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