mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Philipp Stanner" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Philipp Stanner <phasta@kernel.org>,
	work@onurozkan.dev, Danilo Krummrich <dakr@kernel.org>,
	Gary Guo <gary@garyguo.net>, Boqun Feng <boqun@kernel.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: locking/core] rust: sync: Add abstraction for synchronize_rcu()
Date: Fri, 07 Aug 2026 16:05:45 -0000	[thread overview]
Message-ID: <178611874587.708.14611384079551071863.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260624150704.1504001-3-phasta@kernel.org>

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     1fb92e0625596985b3941925afe7906fef41214b
Gitweb:        https://git.kernel.org/tip/1fb92e0625596985b3941925afe7906fef41214b
Author:        Philipp Stanner <phasta@kernel.org>
AuthorDate:    Wed, 24 Jun 2026 17:07:02 +02:00
Committer:     Boqun Feng <boqun@kernel.org>
CommitterDate: Tue, 04 Aug 2026 05:52:53 -07:00

rust: sync: Add abstraction for synchronize_rcu()

synchronize_rcu() is a frequently used C function which is always safe
to be called.

Add a safe abstraction for synchronize_rcu().

Signed-off-by: Philipp Stanner <phasta@kernel.org>
Reviewed-by: Onur Özkan <work@onurozkan.dev>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
[boqun: Fix rustdoc reported by kernel test robot <lkp@intel.com>]
Signed-off-by: Boqun Feng <boqun@kernel.org>
Link: https://patch.msgid.link/20260624150704.1504001-3-phasta@kernel.org
---
 rust/kernel/sync/rcu.rs | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/rust/kernel/sync/rcu.rs b/rust/kernel/sync/rcu.rs
index a32bef6..d867240 100644
--- a/rust/kernel/sync/rcu.rs
+++ b/rust/kernel/sync/rcu.rs
@@ -50,3 +50,19 @@ impl Drop for Guard {
 pub fn read_lock() -> Guard {
     Guard::new()
 }
+
+/// Wait for one RCU grace period.
+///
+/// Waits for all RCU read-side critical sections (such as those established by
+/// a [`Guard`]) at the moment of the function call to finish.
+///
+/// Does not prevent new read-side critical sections from starting, which may
+/// begin and run while this call is blocking.
+///
+/// Note that this is one of the RCU primitives which must not be called in
+/// atomic context.
+#[inline]
+pub fn synchronize_rcu() {
+    // SAFETY: `synchronize_rcu()` is always safe to be called from process context.
+    unsafe { bindings::synchronize_rcu() };
+}

  reply	other threads:[~2026-08-07 16:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 15:07 [PATCH v3 0/3] Add and use " Philipp Stanner
2026-06-24 15:07 ` [PATCH v3 1/3] rust: sync: Add " Philipp Stanner
2026-08-07 16:05   ` tip-bot2 for Philipp Stanner [this message]
2026-06-24 15:07 ` [PATCH v3 2/3] rust: revocable: Use safe synchronize_rcu() abstraction Philipp Stanner
2026-08-07 16:05   ` [tip: locking/core] " tip-bot2 for Philipp Stanner
2026-06-24 15:07 ` [PATCH v3 3/3] rust: sync: Use safe synchronize_rcu() abstraction in poll Philipp Stanner
2026-08-07 16:05   ` [tip: locking/core] " tip-bot2 for Philipp Stanner
2026-06-24 15:30 ` [PATCH v3 0/3] Add and use abstraction for synchronize_rcu() Boqun Feng

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=178611874587.708.14611384079551071863.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=phasta@kernel.org \
    --cc=work@onurozkan.dev \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®