From nobody Sun Feb 8 10:30:08 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 BA05E32D433; Tue, 21 Oct 2025 10:35:31 +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=1761042934; cv=none; b=U13Hvw+eeHqh3mvV2BCIw0sAHmExVdUFbvdvszyS0THG21bEpSvcI80u8k5EyYQQRANC5mkwoKRdYSxGH+cywMsU3rjN+ypOUH9N1LPlDiGz7AxLbtG3pn+BbsjgcJXEnL2kVsrxOsCL+w1FYxRabnMsXsIEcmUNuKxDZ0Tmt8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761042934; c=relaxed/simple; bh=t3ji9bh301gxX9EwwXuU415M2dcbSyaArmwo6aLVDYw=; h=Date:From:To:Subject:Cc:MIME-Version:Message-ID:Content-Type; b=gv0kItyp4M9xJ7D5ZRdMCsa2+hStufigU9XR8dSNX6vO749zeQI/eaYxPFnwLgWtRKvpRyy4dbQxDnvHTl2rn6fVlMvOpltZy+BuIayLA3/0sJsUp0sOqUXHIo672M6a/Pj19SQjKS2gACNYpTRJRVxtuEsjEpOAzIDRb8GemxE= 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=NhyqWo9M; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=xy4yTGw4; 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="NhyqWo9M"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xy4yTGw4" Date: Tue, 21 Oct 2025 10:35:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1761042930; 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; bh=bh5Rn9MftIO5XGZ6RI7XJJYzh2nZBUj78IqcMqHsiL8=; b=NhyqWo9MRXLt0zHuNmWHeSskpUcBFUxTMYyupcWh1T+gEVfJNgp9Lj+G/ogsa0Vw+vYFwz EYLgBpvnzdDcROrFLNvw9OcfZc9ak2jxRhVT2whFVELgpIzX/plPrbK6Sp4WoU3P9rrW4s nkHOLb6Q//dsQWDONG5lquNJoT8aIQvGqlVZYOHRnd+yR8pR4rRXgQMh3fYiN7NqsPsMga aMbB6MvBLGm20OAASos8D8orG01Uy7QcUdiAg99JMghm1CuBK+w1/VgQO6AlFDsCf+4e61 bqRuuVWedcbgO78T82ZdpNodltL4SIjVryz/07J+A/BowLXLebzlGfoRXLt45A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1761042930; 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; bh=bh5Rn9MftIO5XGZ6RI7XJJYzh2nZBUj78IqcMqHsiL8=; b=xy4yTGw4raALpWS1FSrGIxUgGxTHWm28bifebTgPEI1njVg4yxfqlT91UxfZhQKS0/GIMw 7C6G4fl4JrkTyrBg== From: "tip-bot2 for Daniel Almeida" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] rust: lock: Pin the inner data Cc: Benno Lossin , Boqun Feng , Daniel Almeida , "Peter Zijlstra (Intel)" , Alice Ryhl , x86@kernel.org, linux-kernel@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <176104292876.2601451.485431159015446694.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: 2497a7116ff9a051d0e78885a27a52213bc2841d Gitweb: https://git.kernel.org/tip/2497a7116ff9a051d0e78885a27a52213= bc2841d Author: Daniel Almeida AuthorDate: Fri, 19 Sep 2025 11:12:40 +02:00 Committer: Peter Zijlstra CommitterDate: Tue, 21 Oct 2025 12:31:55 +02:00 rust: lock: Pin the inner data In preparation to support Lock where T is pinned, the first thing that needs to be done is to structurally pin the 'data' member. This switches the 't' parameter in Lock::new() to take in an impl PinInit instead of a plain T. This in turn uses the blanket implementation "impl PinInit for T". Subsequent patches will touch on Guard. Suggested-by: Benno Lossin Suggested-by: Boqun Feng Signed-off-by: Daniel Almeida Signed-off-by: Boqun Feng Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Benno Lossin Reviewed-by: Alice Ryhl Link: https://github.com/Rust-for-Linux/linux/issues/1181 --- rust/kernel/sync/lock.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rust/kernel/sync/lock.rs b/rust/kernel/sync/lock.rs index b482f34..9242790 100644 --- a/rust/kernel/sync/lock.rs +++ b/rust/kernel/sync/lock.rs @@ -11,7 +11,7 @@ use crate::{ types::{NotThreadSafe, Opaque, ScopeGuard}, }; use core::{cell::UnsafeCell, marker::PhantomPinned, pin::Pin}; -use pin_init::{pin_data, pin_init, PinInit}; +use pin_init::{pin_data, pin_init, PinInit, Wrapper}; =20 pub mod mutex; pub mod spinlock; @@ -115,6 +115,7 @@ pub struct Lock { _pin: PhantomPinned, =20 /// The data protected by the lock. + #[pin] pub(crate) data: UnsafeCell, } =20 @@ -127,9 +128,13 @@ unsafe impl Sync for Loc= k {} =20 impl Lock { /// Constructs a new lock initialiser. - pub fn new(t: T, name: &'static CStr, key: Pin<&'static LockClassKey>)= -> impl PinInit { + pub fn new( + t: impl PinInit, + name: &'static CStr, + key: Pin<&'static LockClassKey>, + ) -> impl PinInit { pin_init!(Self { - data: UnsafeCell::new(t), + data <- UnsafeCell::pin_init(t), _pin: PhantomPinned, // SAFETY: `slot` is valid while the closure is called and bot= h `name` and `key` have // static lifetimes so they live indefinitely.