Re: [PATCH v3 1/3] rust: workqueue: impl Send and Sync for OwnedQueue

Daniel Almeida <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,org.freedesktop.lists.dri-devel,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>

> On 8 Jul 2026, at 08:43, Onur Özkan <[email protected]> wrote:
> 
> Allows OwnedQueue to be used across thread boundaries which is needed
> from the tyr reset implementation.
> 
> Signed-off-by: Onur Özkan <[email protected]>
> ---
> rust/kernel/workqueue/mod.rs | 8 ++++++++
> 1 file changed, 8 insertions(+)
> 
> diff --git a/rust/kernel/workqueue/mod.rs b/rust/kernel/workqueue/mod.rs
> index 933032fc4a85..d766cd9b9175 100644
> --- a/rust/kernel/workqueue/mod.rs
> +++ b/rust/kernel/workqueue/mod.rs
> @@ -383,6 +383,14 @@ pub struct OwnedQueue {
>     queue: NonNull<Queue>,
> }
> 
> +// SAFETY: `OwnedQueue` has exclusive ownership of the workqueue and accesses to workqueues
> +// are thread safe as documented by the `Send` implementation for `Queue`.
> +unsafe impl Send for OwnedQueue {}
> +
> +// SAFETY: Shared access to an `OwnedQueue` only provides shared access to its `Queue` which
> +// is thread safe as documented by the `Sync` implementation for `Queue`.
> +unsafe impl Sync for OwnedQueue {}
> +
> impl Deref for OwnedQueue {
>     type Target = Queue;
>     fn deref(&self) -> &Queue {
> -- 
> 2.51.2
> 
> 

Reviewed-by: Daniel Almeida <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.