From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F2EB473C88; Fri, 7 Aug 2026 16:05:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786118751; cv=none; b=T3kd8clGQdHM4bNq1P83xDK3mO+OS2uN2k5OKMs78HIJvz2tSlcsiI/FfVOpvXQdnhfPhKqnxwZOdi6iumFxh+SjIbpnrEPXPkpvKcBuI0Sh2hIcJs0YIjapU7lipRWbgZH+/SbA1z/dLYm/HjWtODug/i8tSbHFqK4GxHlz1Og= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786118751; c=relaxed/simple; bh=zzIcvwkmL11YUOjhFdGIFZpEoFLegDXa49Cq4T1bc5Q=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=q3n9JSHWcB3LXq5lLvDXL1hUXEiOQBiiVY7Ikj0/LzNIHI6Pwmi5c6H6OKXph0F4ITDr1E8XP21pa+9g1Qcef0AmX86ldgB0unZijMPSkzf29OMQkxD3W+hOglVTj4eIEAWDu64+I1gWhBhm7kYMBa8+QdsMTSQoNJkD2FXqQh8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=XtdKCWUX; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=v7PX8fN3; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="XtdKCWUX"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="v7PX8fN3" Date: Fri, 07 Aug 2026 16:05:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786118747; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xbLItu2oLeFHaTxlyUWSMfPRV1Y3rc2BkOe1ZN4s31U=; b=XtdKCWUXCN3mU6mMyePYd2nxD5/43eckYR/mjpE+yYJunKaZk9gClX58LuRipV+9zieRuh TGdEdcUwrrdlxoSa4Wxe8G1r3RH6BSHZg/vJn87oK3mM+Emlj5J1azsrLSbSuiQ43DP84A cWfOYZ7ncODwjrsyKTRWfREwZwX9FKLMeck82DS/wIPqbORlGwvWQYP9DlYklMMSMto6kM r5aX8vz8oOmG/hLHck0MBLFJSH5nGo2wcnmrasEdne6L2xaZOD0uHKW9xBWYH5Z9a3xbKz cA0T6jem6dvB9deB3O6c/YvSI4M5bWcTIf8sxc95FWugqEp7Y1tvX3hNM9y96w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786118747; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xbLItu2oLeFHaTxlyUWSMfPRV1Y3rc2BkOe1ZN4s31U=; b=v7PX8fN3dnQWTX4czGDUls7g30PHQ4CoRCvTkP4l3GjF/HmVwyqX/7Om+08WSGEffLTXxo tsqeMuKO/ANrNoAA== From: "tip-bot2 for Philipp Stanner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] rust: sync: Add abstraction for synchronize_rcu() Cc: Philipp Stanner , work@onurozkan.dev, Danilo Krummrich , Gary Guo , Boqun Feng , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260624150704.1504001-3-phasta@kernel.org> References: <20260624150704.1504001-3-phasta@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178611874587.708.14611384079551071863.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the locking/core branch of tip: Commit-ID: 1fb92e0625596985b3941925afe7906fef41214b Gitweb: https://git.kernel.org/tip/1fb92e0625596985b3941925afe7906fef4= 1214b Author: Philipp Stanner AuthorDate: Wed, 24 Jun 2026 17:07:02 +02:00 Committer: Boqun Feng 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 Reviewed-by: Onur =C3=96zkan Reviewed-by: Danilo Krummrich Reviewed-by: Gary Guo [boqun: Fix rustdoc reported by kernel test robot ] Signed-off-by: Boqun Feng 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() }; +}