From nobody Thu Apr 9 09:03:52 2026 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 549B7426D22; Mon, 9 Mar 2026 19:48:36 +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=1773085719; cv=none; b=jl6M4iQvPctU1FejFXjWLFPvFtfP2jO8InCV/heGG0f2Hp24R7feYO/Fi/oTLZWgmr7VQfRepfD5rGHtlCFkDOlWUx0/MyHs24gZ1Vs5oYOTNqX4UIvr31ux/aBRNXgE7tDWmjvQ/cfM0yidIXkmZqoGF2jyhlFuSSC0TkIBKGs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773085719; c=relaxed/simple; bh=4b3oGF6TBkoLeLHLQtJlSUgfH2JniUjuDSilAIevxXg=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=dgobo+9vaLinqrsjVfU0dgDdLL2GKWbIqwMp1EKe/Svkf8RidYG6/7RNEYHf03UigyabE/cRXy5xKaFfHRRx0CCE+VHeJL1VXemspaWux6CoAA9wyXyvtRkFljGlT9f6gHUBqB6PhN+VhsPH6i+b2rDMc7FQkxF7WfUMy7O0YM4= 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=wGHvArEI; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=zEDS3NdN; 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="wGHvArEI"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="zEDS3NdN" Date: Mon, 09 Mar 2026 19:48:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773085715; 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=w+hs2C/L/jESLgUSO4vjVYSJWsLVrqEDbVSUOKpLxzg=; b=wGHvArEIg8zsyRoClI+xafRE7/pVo6WZNJV8Lzm34vderHaTE3Kaksbmuff6c6IvcjILgp OGF45gqhMVVNOPGCNLRYQSar9qxkuuFNDMYEiEj5sSyhG+EwZQhT/tmPvHM4Kf+7QQOOT4 U29a7ZwT6UoRYg5X3VD829Tv9jAUiaCqCWBLvdy2u+RbwQJ4t2sRZC/dwLSgostl3br9Wk K5fXEruqFe4AYHaj2dUaFqCE9y9YHgUhTH+qOs3PI8bVFld2L0a8P6Osmyp7owGCVATNhF 9dFxFXuDhCayIWhmx9ibWdYecxz7xK9BR7HcQHyYJPmvrNunFuDfUjlQgd1Z0w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773085715; 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=w+hs2C/L/jESLgUSO4vjVYSJWsLVrqEDbVSUOKpLxzg=; b=zEDS3NdNA4pChlDbvLHuyxJ7/XCIavPf8LqZF7mLuuYlNoQGLmB9dhK8jiLlTW85am0ee9 dHcSm8PahMdOZhBQ== From: "tip-bot2 for Boqun Feng" 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: atomic: Remove bound `T: Sync` for `Atomic::from_ptr()` Cc: Boqun Feng , "Peter Zijlstra (Intel)" , Alice Ryhl , Gary Guo , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260303201701.12204-2-boqun@kernel.org> References: <20260303201701.12204-2-boqun@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177308571378.1647592.5306968277923647093.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: 4a5dc632e0b603ec1cbbf87b78de86b4b6359cff Gitweb: https://git.kernel.org/tip/4a5dc632e0b603ec1cbbf87b78de86b4b= 6359cff Author: Boqun Feng AuthorDate: Tue, 03 Mar 2026 12:16:49 -08:00 Committer: Peter Zijlstra CommitterDate: Sun, 08 Mar 2026 11:06:47 +01:00 rust: sync: atomic: Remove bound `T: Sync` for `Atomic::from_ptr()` Originally, `Atomic::from_ptr()` requires `T` being a `Sync` because I thought having the ability to do `from_ptr()` meant multiplle `&Atomic`s shared by different threads, which was identical (or similar) to multiple `&T`s shared by different threads. Hence `T` was required to be `Sync`. However this is not true, since `&Atomic` is not the same at `&T`. Moreover, having this bound makes `Atomic::<*mut T>::from_ptr()` impossible, which is definitely not intended. Therefore remove the `T: Sync` bound. [boqun: Fix title typo spotted by Alice & Gary] Fixes: 29c32c405e53 ("rust: sync: atomic: Add generic atomics") Signed-off-by: Boqun Feng Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Alice Ryhl Reviewed-by: Gary Guo Link: https://patch.msgid.link/20260120115207.55318-2-boqun.feng@gmail.com Link: https://patch.msgid.link/20260303201701.12204-2-boqun@kernel.org --- rust/kernel/sync/atomic.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rust/kernel/sync/atomic.rs b/rust/kernel/sync/atomic.rs index 4aebeac..296b25e 100644 --- a/rust/kernel/sync/atomic.rs +++ b/rust/kernel/sync/atomic.rs @@ -204,10 +204,7 @@ impl Atomic { /// // no data race. /// unsafe { Atomic::from_ptr(foo_a_ptr) }.store(2, Release); /// ``` - pub unsafe fn from_ptr<'a>(ptr: *mut T) -> &'a Self - where - T: Sync, - { + pub unsafe fn from_ptr<'a>(ptr: *mut T) -> &'a Self { // CAST: `T` and `Atomic` have the same size, alignment and bit= validity. // SAFETY: Per function safety requirement, `ptr` is a valid point= er and the object will // live long enough. It's safe to return a `&Atomic` because fu= nction safety requirement