mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Tejun Heo" <tj@kernel.org>, "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Lai Jiangshan" <jiangshanlai@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@gmail.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Benno Lossin" <lossin@kernel.org>
Subject: Re: [PATCH v2] workqueue: rust: add delayed work items
Date: Fri, 27 Jun 2025 10:43:52 -0700	[thread overview]
Message-ID: <aF7YWE4bz98Gqh1y@tardis.local> (raw)
In-Reply-To: <20250627-workqueue-delay-v2-1-84b046fdb4fc@google.com>

On Fri, Jun 27, 2025 at 09:38:42AM +0000, Alice Ryhl wrote:
[...]
> +    /// Get a pointer to the inner `delayed_work`.
> +    ///
> +    /// # Safety
> +    ///
> +    /// The provided pointer must not be dangling and must be properly aligned. (But the memory
> +    /// need not be initialized.)
> +    #[inline]
> +    pub unsafe fn raw_as_work(ptr: *const Self) -> *mut Work<T, ID> {
> +        // SAFETY: The caller promises that the pointer is aligned and not dangling.
> +        let dw: *mut bindings::delayed_work =
> +            unsafe { Opaque::raw_get(core::ptr::addr_of!((*ptr).dwork)) };

This would conflict with your Opaque::cast_into() series ;-) So I
suggest that we rebase this one onto:

	https://lore.kernel.org/rust-for-linux/20250624-opaque-from-raw-v2-0-e4da40bdc59c@google.com/

and send them together. But it's up to you and maintainers, and even we
do that let's wait for some reviews on this patch to save extra
versions.

I'm going to review it, just figure this better be pointed out.

Btw, as a review comment, I believe we are in favor of `&raw mut` now,
so this should be:


    unsafe { Opaque::cast_from(&raw const (*ptr).dwork) };

> +        // SAFETY: The caller promises that the pointer is aligned and not dangling.
> +        let wrk: *mut bindings::work_struct = unsafe { core::ptr::addr_of_mut!((*dw).work) };

Ditto.

Regards,
Boqun

> +        // CAST: Work and work_struct have compatible layouts.
> +        wrk.cast()
> +    }
> +}
[...]

  parent reply	other threads:[~2025-06-27 17:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27  9:38 Alice Ryhl
2025-06-27 16:55 ` Tejun Heo
2025-06-27 17:43 ` Boqun Feng [this message]
2025-07-10 13:10   ` Alice Ryhl
2025-07-10 16:30     ` Boqun Feng
2025-06-27 18:39 ` Boqun Feng
2025-07-10 13:12   ` Alice Ryhl

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=aF7YWE4bz98Gqh1y@tardis.local \
    --to=boqun.feng@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@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

all inboxes | Powered by JetHome®