dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Philipp Stanner" <phasta@kernel.org>
Cc: dri-devel@lists.freedesktop.org, media-ci@linuxtv.org,
	ojeda@kernel.org, gary@garyguo.net
Subject: Re: [PATCH v3 1/9] rust: rcu: Add RcuState
Date: Wed, 02 Dec 2026 11:47:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-245634@kernel.org> (raw)
In-Reply-To: <20261202113914.1660411-3-phasta@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] rust: rcu: missing #[inline] on RcuState::new() and
  cond_synchronize()
--

commit 9b80e8ce3d2823d6c857be2691481f7b6e1c7968
Author: Philipp Stanner <phasta@kernel.org>

rust: rcu: Add RcuState

This commit adds RcuState to record an RCU grace period cookie via
get_state_synchronize_rcu() and conditionally wait for that grace period
via cond_synchronize_rcu().

> diff --git a/rust/kernel/sync/rcu.rs b/rust/kernel/sync/rcu.rs
> index 0daa1ac87d818..7cb5a7d31e57d 100644
> --- a/rust/kernel/sync/rcu.rs
> +++ b/rust/kernel/sync/rcu.rs
> @@ -86,3 +86,38 @@ pub fn synchronize_rcu() {
>      // SAFETY: `synchronize_rcu()` is always safe to be called from process context.
>      unsafe { bindings::synchronize_rcu() };
>  }
> +
> +/// An RCU grace period snapshot.
> +///
> +/// Useful for waiting for said grace period if necessary. If you just drop this
> +/// object, nothing happens.
> +#[derive(Copy, Clone)]
> +pub struct RcuState(usize);
> +
> +impl RcuState {
> +    /// Create a new RcuState. It stores an identifier of the current grace
> +    /// period so that you can later water on it.
> +    pub fn new() -> Self {
> +        // SAFETY: `get_state_synchronize_rcu()` is always safe to be called.
> +        let cookie: usize = unsafe { bindings::get_state_synchronize_rcu() };
> +
> +        Self(cookie)
> +    }
> +
> +    /// Make sure that a full RCU grace period has passed since this RcuState
> +    /// was created.
> +    ///
> +    /// Executes a [`synchronize_rcu()`] if that's not the case. Thus, you must
> +    /// not call this in atomic context.
> +    pub fn cond_synchronize(self) {
> +        // SAFETY: This is the right cookie. The function runs in process context.
> +        unsafe { bindings::cond_synchronize_rcu(self.0) };
> +    }
> +}

[Severity: Low]
Should RcuState::new() and RcuState::cond_synchronize() be marked
#[inline] like the other C binding wrappers in this module so callers in
other crates can inline them?

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

  reply	other threads:[~2026-12-02 11:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 11:39 [PATCH v3 0/9] rust: Add drm::JobQueue Philipp Stanner
2026-12-02 11:39 ` [PATCH v3 1/9] rust: rcu: Add RcuState Philipp Stanner
2026-12-02 11:47   ` sashiko-bot [this message]
2026-12-02 11:39 ` [PATCH v3 2/9] rust: DmaFence: Implement Deref for FenceContext Philipp Stanner
2026-12-02 11:39 ` [PATCH v3 3/9] rust: DmaFence: Add ID accessor " Philipp Stanner
2026-12-02 11:39 ` [PATCH v3 4/9] rust: DmaFence: Don't drop on signal Philipp Stanner
2026-12-02 11:39 ` [PATCH v3 5/9] rust: DmaFence: Replace call_rcu() with RcuState Philipp Stanner
2026-12-02 11:49   ` sashiko-bot
2026-12-02 11:39 ` [PATCH v3 6/9] rust: DmaFence: Replace is_signaled() with status() Philipp Stanner
2026-12-02 11:54   ` sashiko-bot
2026-12-02 11:39 ` [PATCH v3 7/9] rust: DmaFence: Pass result in callbacks Philipp Stanner
2026-12-02 11:39 ` [PATCH v3 8/9] rust: drm: Add JobQueue Philipp Stanner
2026-12-02 12:04   ` sashiko-bot
2026-12-02 11:39 ` [PATCH v3 9/9] MAINTAINERS: Add drm::JobQueue to drm_sched's entry 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=sashiko-outbox-245634@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=media-ci@linuxtv.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox