From: Danilo Krummrich <dakr@kernel.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Greg KH <greg@kroah.com>, Stephen Rothwell <sfr@canb.auug.org.au>,
Miguel Ojeda <ojeda@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Next Mailing List <linux-next@vger.kernel.org>
Subject: Re: linux-next: build failure after merge of the rust tree
Date: Mon, 24 Mar 2025 16:27:28 +0100 [thread overview]
Message-ID: <Z-F54IQXiY9IHjeM@cassiopeiae> (raw)
In-Reply-To: <CANiq72n3Xe8JcnEjirDhCwQgvWoE65dddWecXnfdnbrmuah-RQ@mail.gmail.com>
On Mon, Mar 24, 2025 at 04:18:40PM +0100, Miguel Ojeda wrote:
> On Mon, Mar 24, 2025 at 2:43 PM Danilo Krummrich <dakr@kernel.org> wrote:
> >
> > It's the DMA commit that has a bug, that was revealed by the fix in the
> > driver-core tree. So, the patch to drop is in the rust tree (not sure if Miguel
> > changes history at this point though).
>
> Just to double-check, the diff you show below is the combined one,
> right? i.e. it is the one that Stephen already had the previous week +
> the fix you posted above (`Send` `impl`), right?
Correct, it is the full conflict resolution of the current rust and driver-core
tree.
>
> If so, I think it is OK, and we could put the new `Send` impl on top
> of `rust-next` -- given the trees on their own are OK until they
> arrive to Linus, I am not sure if it counts as a fix.
>
> i.e. something like the attached patch (crediting Danilo and Stephen).
Thanks, the attached patch looks perfectly fine to me to add on top.
One small nit: The "Link:" tag should rather be "Closes:".
>
> Cheers,
> Miguel
> From 6a152af23cb49a3bcbb8c4457a612ffa27d54693 Mon Sep 17 00:00:00 2001
> From: Danilo Krummrich <dakr@kernel.org>
> Date: Mon, 24 Mar 2025 16:01:00 +0100
> Subject: [PATCH] rust: dma: add `Send` implementation for `CoherentAllocation`
>
> Stephen found a future build failure in linux-next [1]:
>
> error[E0277]: `*mut MyStruct` cannot be sent between threads safely
> --> samples/rust/rust_dma.rs:47:22
> |
> 47 | impl pci::Driver for DmaSampleDriver {
> | ^^^^^^^^^^^^^^^ `*mut MyStruct` cannot be sent between threads safely
>
> It is caused by the interaction between commit 935e1d90bf6f ("rust: pci:
> require Send for Driver trait implementers") from the driver-core tree,
> which fixes a missing concurrency requirement, and commit 9901addae63b
> ("samples: rust: add Rust dma test sample driver") which adds a sample
> that does not satisfy that requirement.
>
> Add a `Send` implementation to `CoherentAllocation`, which allows the
> sample (and other future users) to satisfy it.
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Link: https://lore.kernel.org/linux-next/20250324215702.1515ba92@canb.auug.org.au/
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
> rust/kernel/dma.rs | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/rust/kernel/dma.rs b/rust/kernel/dma.rs
> index 9d00f9c49f47..18de693c4924 100644
> --- a/rust/kernel/dma.rs
> +++ b/rust/kernel/dma.rs
> @@ -301,6 +301,10 @@ fn drop(&mut self) {
> }
> }
>
> +// SAFETY: It is safe to send a `CoherentAllocation` to another thread if `T`
> +// can be send to another thread.
> +unsafe impl<T: AsBytes + FromBytes + Send> Send for CoherentAllocation<T> {}
> +
> /// Reads a field of an item from an allocated region of structs.
> ///
> /// # Examples
> --
> 2.49.0
>
next prev parent reply other threads:[~2025-03-24 15:27 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 10:57 linux-next: build failure after merge of the rust tree Stephen Rothwell
2025-03-24 11:06 ` Stephen Rothwell
2025-03-24 11:59 ` Danilo Krummrich
2025-03-24 13:29 ` Greg KH
2025-03-24 13:43 ` Danilo Krummrich
2025-03-24 13:52 ` Greg KH
2025-03-24 15:18 ` Miguel Ojeda
2025-03-24 15:27 ` Danilo Krummrich [this message]
2025-03-24 15:40 ` Miguel Ojeda
-- strict thread matches above, loose matches on Subject: below --
2025-11-17 8:04 Stephen Rothwell
2025-11-17 11:19 ` Alexandre Courbot
2025-11-17 14:51 ` Alice Ryhl
2025-11-17 15:37 ` Tamir Duberstein
2025-11-17 16:11 ` Alice Ryhl
2025-06-24 7:31 Stephen Rothwell
2025-06-24 10:31 ` Miguel Ojeda
2025-06-24 11:12 ` Danilo Krummrich
2025-06-24 12:29 ` Miguel Ojeda
2025-06-24 12:00 ` Danilo Krummrich
2025-06-24 12:14 ` Alexandre Courbot
2025-06-24 12:16 ` Tamir Duberstein
2025-06-24 12:24 ` Alexandre Courbot
2025-06-24 12:29 ` Tamir Duberstein
2025-06-24 12:25 ` Miguel Ojeda
2025-05-27 9:42 Stephen Rothwell
2025-05-27 10:03 ` Miguel Ojeda
2025-05-12 9:40 Stephen Rothwell
2025-05-12 11:52 ` Miguel Ojeda
2025-03-17 10:57 Stephen Rothwell
2025-03-17 22:35 ` Miguel Ojeda
2025-03-17 23:35 ` Stephen Rothwell
2025-03-18 11:37 ` Stephen Rothwell
2025-03-18 23:47 ` Miguel Ojeda
2025-03-19 9:06 ` Stephen Rothwell
2025-03-19 9:18 ` Miguel Ojeda
2025-01-10 5:28 Stephen Rothwell
2025-01-10 9:28 ` Alice Ryhl
2025-01-10 9:34 ` Greg Kroah-Hartman
2025-01-10 9:41 ` Alice Ryhl
2025-01-10 10:07 ` Alice Ryhl
2025-01-10 10:08 ` Miguel Ojeda
2025-01-10 10:16 ` Miguel Ojeda
2025-01-10 10:38 ` Miguel Ojeda
2024-12-16 5:25 Stephen Rothwell
2024-12-16 10:31 ` Miguel Ojeda
2024-12-16 10:59 ` Jocelyn Falempe
2024-12-16 16:24 ` Miguel Ojeda
2024-12-16 19:46 ` Jocelyn Falempe
2024-11-11 6:58 Stephen Rothwell
2024-11-11 8:16 ` Miguel Ojeda
2024-11-11 8:28 ` Miguel Ojeda
2024-11-11 14:15 ` Gary Guo
2024-11-11 23:08 ` Miguel Ojeda
2024-11-11 23:58 ` Miguel Ojeda
2024-11-12 1:29 ` Stephen Rothwell
2024-11-12 6:30 ` Stephen Rothwell
2024-11-12 8:50 ` Miguel Ojeda
2021-09-28 4:09 Stephen Rothwell
2021-09-28 4:18 ` Gary Guo
2021-09-28 5:52 ` Stephen Rothwell
2021-09-28 23:37 ` Stephen Rothwell
2021-09-29 17:13 ` Masahiro Yamada
2021-09-29 17:25 ` Miguel Ojeda
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-F54IQXiY9IHjeM@cassiopeiae \
--to=dakr@kernel.org \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ojeda@kernel.org \
--cc=sfr@canb.auug.org.au \
/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