From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EE95338F45 for ; Sun, 11 Jan 2026 12:02:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768132951; cv=none; b=A8S0MvAqZLUJQI0Lwamt66WNT/g17b2lGEwuKpQmpik3IBDXRJpVuxjy9ebWv9B98DGKM/RRiYGvRCpIfgMgO2oMZX1POXyD3SLYuzVRyXn89VjUaKEz6NhuvXA/sjSI+czfg+edwKYDyDOqtvBJPy5Acda6lsHEmpLqhV8JzDc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768132951; c=relaxed/simple; bh=gX7Iy759WYxoMCv7ndNoCCuupIybm1v0rA7xgwJ/b9g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mS/ScrvCO2ju3Oun4en9cTEsgfFlvQjyPIo5UKu8OAV30OIY2laGWgoG/BSsMh8MrOeyV+FeNsSVM1eXfgNdGw2cZ13u9loRmklAgZV0rJig5jQiNXdSnqZE2zf7gMqr/qDSWL+JjL2Sov22vdpwGcyHIyPkEJ0oNP0GX6uamHQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NBugysQl; arc=none smtp.client-ip=209.85.222.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NBugysQl" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-8c07bc2ad13so389194085a.2 for ; Sun, 11 Jan 2026 04:02:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768132942; x=1768737742; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:feedback-id:from:to:cc:subject :date:message-id:reply-to; bh=BMIKXAXniZuvKRl633D19ynJhJpEhy1emvggU7dsEJs=; b=NBugysQlTklEOPlIsaBrcYysyfdVeEEMqPwbDPRmfvFO08+LZwzBNrER5PLxfwDKrk tkuDbT4fZw8i35mg2/tIfjlSJKwwDj7SvvkLpTmd06eR4XgWsqs+4DtOgSt7OCZJFEA8 426LR5V1k5MEfQMMJO7a5XDjZKSIralRAU6+iHLnUSLmzu8/VjAaZoaZF7VrtOAleDOa oHimFyFhxL3FL9I6I+JCJhYQlpZo19Hcs75+oh5CDEqJxVY/1gQ65yF8a+Vc/IeOPiaa OED8UpsJrTduemjp4TChsBsWCz2JXARlmuuEvY0xx9rsIJrVVcusfbrJYZ4d42H23LeK C66g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768132942; x=1768737742; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:feedback-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BMIKXAXniZuvKRl633D19ynJhJpEhy1emvggU7dsEJs=; b=j92EuppkIaQXl5mIp5E9j79TtJmoStPcxVx9ie2iPa4hAEz0UvddJMp3aesDyQt8e5 EfeWSHgVQz092qw9ANeGxUEB21Ua0eHMvDkFiuKMwTx5o+vg4HIkBE4+R6LETJ6r+fR+ vv1tL/Ru5dexGGDroz2JgV47LJQNfDA8RzZrQm+hanwNlYgcncgwo5nEvvyBnQTxgvpR X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TP id af79cd13be357-8c38936f0a2mr2164480885a.35.1768132941885; Sun, 11 Jan 2026 04:02:21 -0800 (PST) Received: from fauth-a2-smtp.messagingengine.com (fauth-a2-smtp.messagingengine.com. [103.168.172.201]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c37f530a1asm1234173085a.38.2026.01.11.04.02.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Jan 2026 04:02:21 -0800 (PST) Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfauth.phl.internal (Postfix) with ESMTP id E344AF40068; Sun, 11 Jan 2026 07:02:20 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Sun, 11 Jan 2026 07:02:20 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduudeghedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpedvveekvddtffelffelfedvudefffeuheejgeeivedufffgledvgeduveffueeh leenucffohhmrghinhepmhhsghhiugdrlhhinhhknecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfh gvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgvpdhnsggprhgtphhtthho peduiedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphgvthgvrhiisehinhhfrh gruggvrggurdhorhhgpdhrtghpthhtohepmhhinhhgoheskhgvrhhnvghlrdhorhhgpdhr tghpthhtoheprhhushhtqdhfohhrqdhlihhnuhigsehvghgvrhdrkhgvrhhnvghlrdhorh hgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdho rhhgpdhrtghpthhtohepfihilhhlsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehmrg hrkhdrrhhuthhlrghnugesrghrmhdrtghomhdprhgtphhtthhopehtghhlgieslhhinhhu thhrohhnihigrdguvgdprhgtphhtthhopehojhgvuggrsehkvghrnhgvlhdrohhrghdprh gtphhtthhopehgrghrhiesghgrrhihghhuohdrnhgvth X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 11 Jan 2026 07:02:20 -0500 (EST) From: Boqun Feng To: "Peter Zijlstra" , "Ingo Molnar" Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, "Will Deacon" , "Mark Rutland" , "Thomas Gleixner" , "Miguel Ojeda" , "Gary Guo" , "Alice Ryhl" , "Andreas Hindborg" , "Benno Lossin" , "Danilo Krummrich" , Daniel Almeida , Alexandre Courbot , Boqun Feng Subject: [PATCH 04/36] rust: sync: Implement Unpin for ARef Date: Sun, 11 Jan 2026 20:01:37 +0800 Message-ID: <20260111120209.6133-2-boqun.feng@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260111120209.6133-1-boqun.feng@gmail.com> References: <20260111115808.5702-1-boqun.feng@gmail.com> <20260111120209.6133-1-boqun.feng@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Alice Ryhl The default implementation of Unpin for ARef is conditional on T being Unpin due to its PhantomData field. However, this is overly strict as pointers to T are legal to move even if T itself cannot move. Since commit 66f1ea83d9f8 ("rust: lock: Add a Pin<&mut T> accessor") this causes build failures when combined with a Mutex that contains an field ARef, because almost any type that ARef is used with is !Unpin. Reviewed-by: Daniel Almeida Signed-off-by: Alice Ryhl Reviewed-by: Alexandre Courbot Reviewed-by: Benno Lossin Signed-off-by: Boqun Feng Link: https://patch.msgid.link/20251218-unpin-for-aref-v2-1-30d77129cbc6@google.com --- rust/kernel/sync/aref.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rust/kernel/sync/aref.rs b/rust/kernel/sync/aref.rs index 0d24a0432015..0616c0353c2b 100644 --- a/rust/kernel/sync/aref.rs +++ b/rust/kernel/sync/aref.rs @@ -83,6 +83,9 @@ unsafe impl Send for ARef {} // example, when the reference count reaches zero and `T` is dropped. unsafe impl Sync for ARef {} +// Even if `T` is pinned, pointers to `T` can still move. +impl Unpin for ARef {} + impl ARef { /// Creates a new instance of [`ARef`]. /// -- 2.51.0