All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Philipp Stanner" <phasta@kernel.org>
Cc: ojeda@kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 3/6] rust: sync: Add abstraction for synchronize_rcu()
Date: Tue, 16 Jun 2026 08:36:24 +0000	[thread overview]
Message-ID: <20260616083624.D323D1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260616082819.2943886-5-phasta@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Missing `#[inline]` annotation on the `synchronize_rcu()` abstraction.
- [Low] Existing uses of `bindings::synchronize_rcu()` were not updated to use the new safe abstraction.
--

commit 3f3ebd383ebd5385e032e8ee41ba8e2dc2c9f4e9
Author: Philipp Stanner <phasta@kernel.org>

rust: sync: Add abstraction for synchronize_rcu()

This commit adds a safe Rust abstraction for the synchronize_rcu() function
to wait for a grace period.

> diff --git a/rust/kernel/sync/rcu.rs b/rust/kernel/sync/rcu.rs
> index eef34bf862596..d86d615467b1e 100644
> --- a/rust/kernel/sync/rcu.rs
> +++ b/rust/kernel/sync/rcu.rs
[ ... ]
> @@ -56,3 +56,11 @@ pub fn rcu_barrier() {
>      // SAFETY: `rcu_barrier()` is always safe to be called. It just might wait for a grace period.
>      unsafe { bindings::rcu_barrier() };
>  }
> +
> +/// Wait for one RCU grace period.
> +///
> +/// You typically do this to wait for everyone holding a [`Guard`].
> +pub fn synchronize_rcu() {

[Severity: Low]
This isn't a bug, but should this function have an #[inline] annotation?

According to the Rust subsystem guidelines, functions in abstractions that
are small or simply forward to a binding call should be annotated with
#[inline].

Additionally, should the existing usages of the raw C binding be updated
to use this new safe abstraction?

For example, drop() in rust/kernel/sync/poll.rs currently does:

    unsafe { bindings::synchronize_rcu() };

And revoke_internal() in rust/kernel/revocable.rs:

    unsafe { bindings::synchronize_rcu() };

Updating these existing callers would help reduce unnecessary unsafe blocks
across the codebase now that a safe wrapper is available.

> +    // SAFETY: `synchronize_rcu()` is always safe to be called. It just waits for a grace period.
> +    unsafe { bindings::synchronize_rcu() };
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260616082819.2943886-2-phasta@kernel.org?part=3

  reply	other threads:[~2026-06-16  8:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16  8:28 [PATCH v2 0/6] rust / dma_buf: Add abstractions for dma_fence Philipp Stanner
2026-06-16  8:28 ` [PATCH v2 1/6] rust: types: implement ForeignOwnable for ARef<T> Philipp Stanner
2026-06-16  8:38   ` sashiko-bot
2026-06-16  8:28 ` [PATCH v2 2/6] rust: sync: Add abstraction for rcu_barrier() Philipp Stanner
2026-06-16  8:35   ` sashiko-bot
2026-06-16  8:28 ` [PATCH v2 3/6] rust: sync: Add abstraction for synchronize_rcu() Philipp Stanner
2026-06-16  8:36   ` sashiko-bot [this message]
2026-06-16  8:28 ` [PATCH v2 4/6] rust: error: Add ECANCELED error code Philipp Stanner
2026-06-16  8:28 ` [PATCH v2 5/6] rust: Add dma_fence abstractions Philipp Stanner
2026-06-16  8:44   ` sashiko-bot
2026-06-16 12:47   ` Onur Özkan
2026-06-16 14:38     ` Philipp Stanner
2026-06-16 14:51       ` Onur Özkan
2026-06-16  8:28 ` [PATCH v2 6/6] MAINTAINERS: Add entry for Rust dma-buf Philipp Stanner
2026-06-16 11:02 ` [PATCH v2 0/6] rust / dma_buf: Add abstractions for dma_fence Danilo Krummrich
2026-06-16 11:28   ` Philipp Stanner

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=20260616083624.D323D1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ojeda@kernel.org \
    --cc=phasta@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.