Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Andreas Hindborg <a.hindborg@kernel.org>
To: "Danilo Krummrich" <dakr@kernel.org>
Cc: <bhelgaas@google.com>,  <gregkh@linuxfoundation.org>,
	<rafael@kernel.org>,  <ojeda@kernel.org>,
	 <alex.gaynor@gmail.com>, <boqun.feng@gmail.com>,
	 <gary@garyguo.net>,  <bjorn3_gh@protonmail.com>,
	<benno.lossin@proton.me>,  <aliceryhl@google.com>,
	 <tmgross@umich.edu>, <linux-pci@vger.kernel.org>,
	 <rust-for-linux@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] rust: pci: impl Send + Sync for pci::Device
Date: Wed, 19 Mar 2025 12:18:35 +0100	[thread overview]
Message-ID: <87o6xxgtf8.fsf@kernel.org> (raw)
In-Reply-To: <20250318212940.137577-1-dakr@kernel.org> (Danilo Krummrich's message of "Tue, 18 Mar 2025 22:29:21 +0100")

"Danilo Krummrich" <dakr@kernel.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@kernel.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?


Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>


Best regards,
Andreas Hindborg



  parent reply	other threads:[~2025-03-19 11:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ddLRqqXuFiaRVyCNUWk5k3cc0pJCteUQ5tBxGr5_7QXDeygE0d-YFc9nbJD0pNJ8RjZ3nCaWOCM56r0ZWmWdJw==@protonmail.internalid>
2025-03-18 21:29 ` [PATCH 1/2] rust: pci: impl Send + Sync for pci::Device Danilo Krummrich
2025-03-18 21:29   ` [PATCH 2/2] rust: platform: impl Send + Sync for platform::Device Danilo Krummrich
2025-03-19 11:20     ` Andreas Hindborg
2025-03-19 12:05     ` Alice Ryhl
2025-03-19 11:18   ` Andreas Hindborg [this message]
2025-03-19 11:25     ` [PATCH 1/2] rust: pci: impl Send + Sync for pci::Device Danilo Krummrich
2025-03-19 12:05   ` Alice Ryhl
2025-03-19 12:47     ` Danilo Krummrich
2025-03-19 13:16       ` Alice Ryhl
2025-03-19 13:30         ` Danilo Krummrich
2025-03-19 13:50           ` Danilo Krummrich
2025-03-19 14:08             ` Danilo Krummrich

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=87o6xxgtf8.fsf@kernel.org \
    --to=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.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=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=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