[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z9qpo0zp1jqnh9we@pollux>
Date: Wed, 19 Mar 2025 12:25:23 +0100
From: Danilo Krummrich <dakr@...nel.org>
To: Andreas Hindborg <a.hindborg@...nel.org>
Cc: bhelgaas@...gle.com, gregkh@...uxfoundation.org, rafael@...nel.org,
ojeda@...nel.org, alex.gaynor@...il.com, boqun.feng@...il.com,
gary@...yguo.net, bjorn3_gh@...tonmail.com, benno.lossin@...ton.me,
aliceryhl@...gle.com, tmgross@...ch.edu, linux-pci@...r.kernel.org,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] rust: pci: impl Send + Sync for pci::Device
On Wed, Mar 19, 2025 at 12:18:35PM +0100, Andreas Hindborg wrote:
> "Danilo Krummrich" <dakr@...nel.org> writes:
>
> > Commit 7b948a2af6b5 ("rust: pci: fix unrestricted &mut pci::Device")
> > changed the definition of pci::Device and discarded the implicitly
> > derived Send and Sync traits.
> >
> > This isn't required by upstream code yet, and hence did not cause any
> > issues. However, it is relied on by upcoming drivers, hence add it back
> > in.
> >
> > Signed-off-by: Danilo Krummrich <dakr@...nel.org>
> > ---
> > rust/kernel/pci.rs | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs
> > index 0ac6cef74f81..0d09ae34a64d 100644
> > --- a/rust/kernel/pci.rs
> > +++ b/rust/kernel/pci.rs
> > @@ -465,3 +465,10 @@ fn as_ref(&self) -> &device::Device {
> > unsafe { device::Device::as_ref(dev) }
> > }
> > }
> > +
> > +// SAFETY: A `Device` is always reference-counted and can be released from any thread.
> > +unsafe impl Send for Device {}
> > +
> > +// SAFETY: `Device` can be shared among threads because all methods of `Device`
> > +// (i.e. `Device<Normal>) are thread safe.
> > +unsafe impl Sync for Device {}
> >
> > base-commit: 4d320e30ee04c25c660eca2bb33e846ebb71a79a
>
> I can't find the base-commit and the patch does not apply clean on v6.14-rc7:
>
> patching file rust/kernel/pci.rs
> Hunk #1 succeeded at 432 with fuzz 1 (offset -33 lines).
>
> Otherwise looks good. You might want to rebase?
This is intentional, the base commit is from the driver-core tree, where also
commit 7b948a2af6b5 ("rust: pci: fix unrestricted &mut pci::Device") landed.
> Reviewed-by: Andreas Hindborg <a.hindborg@...nel.org>
>
>
> Best regards,
> Andreas Hindborg
>
>
Powered by blists - more mailing lists