From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 CE882329F21; Thu, 11 Sep 2025 03:31:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757561500; cv=none; b=fYagKwVrgYY6u2dIEeythIq624mRZYF834EBvMTbuXMfHKa5gsH3oYIabeGfeG3IYKfqPLgrBKjtm1BqZIEwpV0teq5CJqXgv3iO8JY3NbqCwFoAZq5FQBWEMOu1RjfX08XE7EcJMmPicNFKRv1HtRyRI7ovO4mwm31CUtfr8Zg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757561500; c=relaxed/simple; bh=8rb2eHgz+sisqDC2HjdtfVMWa883OZctZ6qacBEEcu4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FeOH886HwDXfp92Sa/V6wZTLtWnW6SEEGtz3eZA/NEIDXll6vxe5e/zZaGakA7sgnMKkwt5efgOytrAQ2eX34oncQCCPKMxggTjyyLgFRImuTSh4KHzXii/yUYWxQpBMO0POPfQ+A4zyu2z9p3AHFNkRKN31NOvIDqDVx4FkdEE= 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=FrkPbhKK; arc=none smtp.client-ip=209.85.222.177 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="FrkPbhKK" Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-817f3d08465so22797285a.2; Wed, 10 Sep 2025 20:31:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1757561498; x=1758166298; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :feedback-id:from:to:cc:subject:date:message-id:reply-to; bh=1syGiOChJSsvX5X8w25jQPHC2Ezw8kmnSNlrI7kOygU=; b=FrkPbhKKA+MCebshsDzcR0LfL7um1TCnra2iYXDwM2U1dIP6RdX4LILHGfJbjagUYC PEBwdUXpMRlGHfC53wOmQPImcbxroKS1jzBFOnn7wWDwZE7RONI3sIeqgifZR59NpcZZ GYbu/hh4NiCTU/6yQ9gaCm1HCmWOG+BfUqLEK+NDK338GiRvuoq6j4GbNgV0YTD3jApz Ul7KzjgeEexap1ka3WShzTqbsOG8N1YKtoCxfJeWZp49JU1enph6AtBAP3mr2/Cjpmgv +4RVJ5cdrizOPvQdYak7b+5SZ26/+yyUGdMPmm+dSRcMuDvMsdNvk3r1mn+5GIq4QLRK Quuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757561498; x=1758166298; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :feedback-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1syGiOChJSsvX5X8w25jQPHC2Ezw8kmnSNlrI7kOygU=; b=fw6qJjDah0LDiWd8r7tL6CbV16aaKrpBuDP1RsJlMhpLf779aJVLlUBm6TlLz4fHG+ ujIQgZrc36vnRSSYd3y7OAyScnlRAhB1MOjt+NSyusmjawN8UrT5Di4VlF1UAhzFbTkF KrycZaRYRq+YPc9vBJToF828uWdUzONH3/88+nsXL8rwvtjYUroxnAPB3raWze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ySZ6Q== X-Received: by 2002:a05:620a:4690:b0:811:2b34:cf45 with SMTP id af79cd13be357-813c568d2ecmr1670054585a.79.1757561497551; Wed, 10 Sep 2025 20:31:37 -0700 (PDT) Received: from fauth-a1-smtp.messagingengine.com (fauth-a1-smtp.messagingengine.com. [103.168.172.200]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4b639daa5edsm3292951cf.32.2025.09.10.20.31.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Sep 2025 20:31:37 -0700 (PDT) Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfauth.phl.internal (Postfix) with ESMTP id 8595EF40066; Wed, 10 Sep 2025 23:31:36 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Wed, 10 Sep 2025 23:31:36 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvhedtlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfhfgggtugfgjgesthekredttddtjeenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpeevgffhueevkedutefgveduuedujeefledthffgheegkeekiefgudekhffggeel feenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsoh hquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdeigedq udejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmh gvrdhnrghmvgdpnhgspghrtghpthhtohepudejpdhmohguvgepshhmthhpohhuthdprhgt phhtthhopehlohhsshhinheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprghlihgtvg hrhihhlhesghhoohhglhgvrdgtohhmpdhrtghpthhtohepohhjvggurgeskhgvrhhnvghl rdhorhhgpdhrtghpthhtoheprghlvgigrdhgrgihnhhorhesghhmrghilhdrtghomhdprh gtphhtthhopehgrghrhiesghgrrhihghhuohdrnhgvthdprhgtphhtthhopegsjhhorhhn fegpghhhsehprhhothhonhhmrghilhdrtghomhdprhgtphhtthhopegrrdhhihhnuggsoh hrgheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepthhmghhrohhsshesuhhmihgthhdr vgguuhdprhgtphhtthhopegurghkrheskhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Sep 2025 23:31:35 -0400 (EDT) Date: Wed, 10 Sep 2025 20:31:34 -0700 From: Boqun Feng To: Benno Lossin Cc: Alice Ryhl , Miguel Ojeda , Alex Gaynor , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Tejun Heo , Tamir Duberstein , Dirk Behme , Alban Kurti , Fiona Behrens , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] rust: pin-init: add pin projections to `#[pin_data]` Message-ID: References: <20250905171209.944599-1-lossin@kernel.org> <20250905171209.944599-2-lossin@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Sep 10, 2025 at 02:18:12PM +0200, Benno Lossin wrote: > On Wed Sep 10, 2025 at 12:54 PM CEST, Alice Ryhl wrote: > > On Wed, Sep 10, 2025 at 12:38 PM Benno Lossin wrote: > >> > >> On Wed Sep 10, 2025 at 12:23 PM CEST, Alice Ryhl wrote: > >> > On Fri, Sep 5, 2025 at 7:12 PM Benno Lossin wrote: > >> >> + (make_pin_projections: > >> >> + @vis($vis:vis), > >> >> + @name($name:ident), > >> >> + @impl_generics($($impl_generics:tt)*), > >> >> + @ty_generics($($ty_generics:tt)*), > >> >> + @decl_generics($($decl_generics:tt)*), > >> >> + @where($($whr:tt)*), > >> >> + @pinned($($(#[$($p_attr:tt)*])* $pvis:vis $p_field:ident : $p_type:ty),* $(,)?), > >> >> + @not_pinned($($(#[$($attr:tt)*])* $fvis:vis $field:ident : $type:ty),* $(,)?), > >> >> + ) => { > >> >> + $crate::macros::paste! { > >> >> + #[doc(hidden)] > >> >> + $vis struct [< $name Projection >] <'__pin, $($decl_generics)*> { > >> > > >> > I'm not sure we want $vis here. That's the visibility of the original > >> > struct, but I don't think we want it to be pub just because the struct > >> > is. > >> > >> Why shouldn't it be pub if the original is pub? I don't really > >> understand the concern, since the fields themselves will still have the > >> correct visibility. Additionally, there is the `___pin_phantom_data` > >> field that's always private, so you cannot construct this outside of the > >> module. > > > > I mean, for instance, it's going to mean that every single struct that > > wraps Opaque in a private field will get a useless pub function called > > project that will appear in html docs. > > It's `#[doc(hidden)]` :) > > > Pin-project limits the visibility to pub(crate) when the struct is pub. > > I think I would have to look inside the `vis` to recreate that behavior, > so I'd rather do it as a future patch. Thoughts? > This reminds me: I think should make these functions `#[inline]` for now? (Until we make a decision about whether it's pub(crate) or $vis) Otherwise compiler will generate functions in kernel binaries for some of them. E.g. nm .kunit/vmlinux.o | rustfilt | grep project 00000000002449cc T ::project 000000000023ef40 T ::project 000000000023ef40 T ::project 0000000000244994 T ::project 0000000000260a68 T ::project 0000000000008b70 d __UNIQUE_ID___addressable__RNvMs0_NtCshc5sK6KjdJJ_6kernel4syncNtB5_12LockClassKey7project2007 0000000000008c98 d __UNIQUE_ID___addressable__RNvMs1_NtNtCshc5sK6KjdJJ_6kernel4sync10completionNtB5_10Completion7project2044 0000000000008ca0 d __UNIQUE_ID___addressable__RNvMs1_NtNtCshc5sK6KjdJJ_6kernel4sync4pollNtB5_11PollCondVar7project2045 0000000000008b60 d __UNIQUE_ID___addressable__RNvMs1_NtNtCshc5sK6KjdJJ_6kernel4sync7condvarNtB5_7CondVar7project2005 0000000000010d28 r __export_symbol_::project 0000000000010f78 r __export_symbol_::project 0000000000010f88 r __export_symbol_::project 0000000000010d08 r __export_symbol_::project Otherwise the patch looks good to me. Feel free to add: Reviewed-by: Boqun Feng Regards, Boqun > --- > Cheers, > Benno