From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7EEC8CD4F54 for ; Wed, 27 May 2026 17:54:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE97C89CC4; Wed, 27 May 2026 17:54:48 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=garyguo.net header.i=@garyguo.net header.b="BAgx6/IP"; dkim-atps=neutral Received: from LO3P265CU004.outbound.protection.outlook.com (mail-uksouthazon11020084.outbound.protection.outlook.com [52.101.196.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9700589CC4 for ; Wed, 27 May 2026 17:54:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pnL//f413MO1iXRWbXhyd1AB+lkeKQD5GGnvEi+vfPuq3zT4hTAEseYGpTEtQwstyUO7cD1nPhb2BaGvnRgw7Gb0pIHOrgVt50AidOIQsNqHT93yLEo5Ic+424wfGc219f2k5Bn5D7x3R4S1DlCC5fxkpQJkryziwqDbDhs0gebyOA5QEu/GDiPyM/Dot3IuosMfpjnDcCjTve34qX6lKKXEDMlESy2Dk60fwgwacVhhqbvac5fTUwf/H7u+qyZeXFifCHNHzs7ineTa2rt26H9C4hcWVauwOvQ8N6/S3AQiJ03Timw0JIzsowDldxWUiDzA3/YmbjrKhQEX5CD3NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/O7kBL6rBxHSOnr8Ci00ZkCGmAtyVrJ+yrtYSbOUVf4=; b=sVSA9ncneS+Jr+TV6QzoVvXoNK3QF2GIjfjzkp7UqAqfcXZY3yUBAOawCdsUTttUuO0o58zWi5hx8MbO4UPNSF+BYQD0TQlgJxgxHqC1qmD3F8+JJGLWu0/hCsQZ4J//zOELGOfo7EMKOKWQTthw1ZuxaxZaj2hmjnAw0WwwngiRRIvWz/q1ssQdNb1TkCZyg3LW2/HD5QiwZRyDYW/C+fN5aKPdGTJRmbFT9I6WLY5V+5QptRFzwXP/z0wPW9ObMisjZZ+XF7yJ7dKoEjOkiikqM1dEl5iJdSVI+5MG7JueFDP6cxs8HWYpHvauVOifua5y9iH2nJ7LgsD3qJW8hQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=garyguo.net; dmarc=pass action=none header.from=garyguo.net; dkim=pass header.d=garyguo.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garyguo.net; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/O7kBL6rBxHSOnr8Ci00ZkCGmAtyVrJ+yrtYSbOUVf4=; b=BAgx6/IPVcQgoDO1lH+NbrpPlKNy87z2246kdQH0Wopu7dknxmhYvxJFF+IGu8pThBKD6w4gS8vMF/8uTqt9Vj44uvrJqrG32o5r9DZMZBMfHzzTHiDjlSV6e/GOXmZifSqvBFcpbEqu1HmnzfVGJGwuhZ4yTa0nztWAlx3O5aA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=garyguo.net; Received: from CW1P265MB8877.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:27c::13) by LO8P265MB7671.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:3ca::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.71.12; Wed, 27 May 2026 17:54:44 +0000 Received: from CW1P265MB8877.GBRP265.PROD.OUTLOOK.COM ([fe80::6c9e:93c8:10db:e995]) by CW1P265MB8877.GBRP265.PROD.OUTLOOK.COM ([fe80::6c9e:93c8:10db:e995%6]) with mapi id 15.21.0071.011; Wed, 27 May 2026 17:54:43 +0000 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 27 May 2026 18:54:43 +0100 Message-Id: Cc: "John Hubbard" , "Alistair Popple" , "Timur Tabi" , "Zhi Wang" , "Eliot Courtney" , , , , , Subject: Re: [PATCH v2 3/7] rust: always inline some init methods From: "Gary Guo" To: "Alexandre Courbot" , "Miguel Ojeda" , "Nathan Chancellor" , "Nicolas Schier" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Benno Lossin" , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "Danilo Krummrich" , "David Airlie" , "Simona Vetter" X-Mailer: aerc 0.21.0 References: <20260527-nova-exports-v2-0-06de4c556d55@nvidia.com> <20260527-nova-exports-v2-3-06de4c556d55@nvidia.com> In-Reply-To: <20260527-nova-exports-v2-3-06de4c556d55@nvidia.com> X-ClientProxiedBy: LO4P123CA0569.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:276::9) To CW1P265MB8877.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:27c::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CW1P265MB8877:EE_|LO8P265MB7671:EE_ X-MS-Office365-Filtering-Correlation-Id: d4b4476e-caa2-4e9f-4761-08debc19089e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|10070799003|7416014|376014|1800799024|366016|4143699003|56012099006|6133799003|22082099003|18002099003|921020; X-Microsoft-Antispam-Message-Info: Rs4LkjpU5jLadaHY7JdF+0tGPO5895jdYXZXKWNxjNQJS/+npqNnvi20WrtQ+U8asYF9poLoZ85X0Hce1xVaIfU9hOIEPZvC56ZBIEXMnBIl3KmNX1Ru49FfxphoCSWce46BjvQHp17REM9JV9ZamKItDyUkhHB5MAfw8lKZ1clI+akaNCe24tm/Ms3MP9y5sP5QMYv7IOJHnq9B6r+l5XZ4xVg8ZvL3hMNkXUNRtTOV4mhiBsXkF8G3LMlt90b8FEAcvDEyM0TRGVzE/Be4tf/APty18HCdM/tOn+0MmKsqwsq+fGKQsVGmgWFy7Fi15K6lg5kPQn/y7uh3Ln8SqGECwGwn2Zu3IzHZ7+7XRuNvFUgluhwZKRbWOUTTOlYCDx7SePswa92FR4D36k+/wRD6RHMszR3rPZeAZE1wIXYwyWUcWGP5D87l9/QHIG0gxdhBtVmf00onMmaAHVSOJEIrSRnbMXctAWse4fcsXaNz+OZSUCyKEgzOySs4IvbX/++yxv9O2vS0Yuef5H3jUZ2q/mm4bPlXN8AH/6m+Sjsl+mflVsg/KreXoOsS1CB7MkWKxYCAnW4+dL8Zvrrg9YVR9VyQTQr+vVCGWASLCNWCLHBNn9HKON2nrVqnEs9yxk5nT6WhdQFviNdCZSIs29N6kBG2eKfUPOYr/aAtxmGx+itIlXV8cI7CAWGs07tle5uP0LGwtIDUbVTXeqb7TvXDJXn7lXLBNqzv3M9nAsM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CW1P265MB8877.GBRP265.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(10070799003)(7416014)(376014)(1800799024)(366016)(4143699003)(56012099006)(6133799003)(22082099003)(18002099003)(921020); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NStxdlZXNUtXbmlCNDVwaXI5eUZsWU5ZTVd5NkVRa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eFZycndRVTg2QUZzTlBkb2RuMXlWUHd1UGt4aEdOM3lmZUJPbEhLc2RDWFls?= =?utf-8?B?WUhUZXJoZkNRNDdub3Q1eTcxUFRFcEE1cEx2a1ZqMWR2Y3g5L1o5LzBJNVZB?= =?utf-8?B?NndncEdJVjY5N1VXL3laek9NYmRQOWlaZjNPMzZOTkdUaUVKVmFHazJ3U2c4?= =?utf-8?B?ekx0QzJseHBldG1qUVpnYXdydzg2ZWs0b1dRU0U4Z1dSa2NSVDVBWlJHWFpQ?= =?utf-8?B?RmFHRWZWcDJENjZUWXVRTnBoc2lnMlhLN01FSTRzOEdBd0dOVzlMc0M1RDc2?= =?utf-8?B?aGxYeFZDSmxSaWJHa09SSEpCMHRWbVliZ0sxL3hBaGxMakJOdU1GRmtYMlRv?= =?utf-8?B?cHZ1WXE1ZVBZN2NpR3NQeVlLbkU4TWd3SGFuS0pwOGo0QWJhbDdqajVCOGRG?= =?utf-8?B?TE43T0FoRFUva0xpNGhpUWxKZC9WaFp0bUtLdEtZV3dWeVpMV1BQdG5XN0V0?= =?utf-8?B?emF1Z3pXcEcvOE1vK3hjSFlBUFc5WEJzWHpjZXdWeVhZRWJVOGlIUT09?= X-OriginatorOrg: garyguo.net X-MS-Exchange-CrossTenant-Network-Message-Id: d4b4476e-caa2-4e9f-4761-08debc19089e X-MS-Exchange-CrossTenant-AuthSource: CW1P265MB8877.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 May 2026 17:54:43.8873 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bbc898ad-b10f-4e10-8552-d9377b823d45 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Wm1AQ3lYUfP5olVO6hWEawTfnIgjR8UuGYLyweapeUVmVKv3rYbC0CM0NPDeCCXv74rUFoOJay65jXpS28gSJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO8P265MB7671 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed May 27, 2026 at 12:52 PM BST, Alexandre Courbot wrote: > These methods should always be inlined for optimization reasons. Failure > to do so can also produce symbol names larger than what `modpost` > supports. > > Signed-off-by: Alexandre Courbot > --- > rust/kernel/alloc/kbox.rs | 2 ++ > rust/kernel/init.rs | 1 + > rust/kernel/sync/arc.rs | 2 ++ > rust/kernel/types.rs | 3 +++ > 4 files changed, 8 insertions(+) > > diff --git a/rust/kernel/alloc/kbox.rs b/rust/kernel/alloc/kbox.rs > index 2f8c16473c2c..592fffc72e52 100644 > --- a/rust/kernel/alloc/kbox.rs > +++ b/rust/kernel/alloc/kbox.rs > @@ -433,6 +433,7 @@ impl InPlaceWrite for Box, A> > { > type Initialized =3D Box; > =20 > + #[inline(always)] > fn write_init(mut self, init: impl Init) -> Result { > let slot =3D self.as_mut_ptr(); > // SAFETY: When init errors/panics, slot will get deallocated bu= t not dropped, > @@ -442,6 +443,7 @@ fn write_init(mut self, init: impl Init) -> = Result Ok(unsafe { Box::assume_init(self) }) > } > =20 > + #[inline(always)] > fn write_pin_init(mut self, init: impl PinInit) -> Result, E> { > let slot =3D self.as_mut_ptr(); > // SAFETY: When init errors/panics, slot will get deallocated bu= t not dropped, > diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs > index 7a0d4559d7b5..36d4bf1959fb 100644 > --- a/rust/kernel/init.rs > +++ b/rust/kernel/init.rs > @@ -151,6 +151,7 @@ fn try_pin_init(init: impl PinInit, flags: F= lags) -> Result /// type. > /// > /// If `T: !Unpin` it will not be able to move afterwards. > + #[inline(always)] > fn pin_init(init: impl PinInit, flags: Flags) -> error::Res= ult > where > Error: From, > diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs > index 18d6c0d62ce0..973f15165606 100644 > --- a/rust/kernel/sync/arc.rs > +++ b/rust/kernel/sync/arc.rs > @@ -712,6 +712,7 @@ fn try_init(init: impl Init, flags: Flags) -= > Result > impl InPlaceWrite for UniqueArc> { > type Initialized =3D UniqueArc; > =20 > + #[inline(always)] > fn write_init(mut self, init: impl Init) -> Result { > let slot =3D self.as_mut_ptr(); > // SAFETY: When init errors/panics, slot will get deallocated bu= t not dropped, > @@ -721,6 +722,7 @@ fn write_init(mut self, init: impl Init) -> = Result Ok(unsafe { self.assume_init() }) > } > =20 > + #[inline(always)] > fn write_pin_init(mut self, init: impl PinInit) -> Result, E> { > let slot =3D self.as_mut_ptr(); > // SAFETY: When init errors/panics, slot will get deallocated bu= t not dropped, > diff --git a/rust/kernel/types.rs b/rust/kernel/types.rs > index ac316fd7b538..381a06ee0d59 100644 > --- a/rust/kernel/types.rs > +++ b/rust/kernel/types.rs > @@ -367,6 +367,7 @@ pub const fn zeroed() -> Self { > /// This function is safe, because the `T` inside of an `Opaque` is = allowed to be > /// uninitialized. Additionally, access to the inner `T` requires `u= nsafe`, so the caller needs > /// to verify at that point that the inner value is valid. > + #[inline(always)] > pub fn ffi_init(init_func: impl FnOnce(*mut T)) -> impl PinInit { > // SAFETY: We contain a `MaybeUninit`, so it is OK for the `init= _func` to not fully > // initialize the `T`. Are you sure this (and other `impl PinInit`-returning functions) are actual= ly causing issue? They just return an initializer and the actual init code is = not marked as `#[inline]`. Best, Gary > @@ -386,6 +387,7 @@ pub fn ffi_init(init_func: impl FnOnce(*mut T)) -> im= pl PinInit { > /// This function is safe, because the `T` inside of an `Opaque` is = allowed to be > /// uninitialized. Additionally, access to the inner `T` requires `u= nsafe`, so the caller needs > /// to verify at that point that the inner value is valid. > + #[inline(always)] > pub fn try_ffi_init( > init_func: impl FnOnce(*mut T) -> Result<(), E>, > ) -> impl PinInit { > @@ -417,6 +419,7 @@ pub const fn cast_from(this: *const T) -> *const Self= { > =20 > impl Wrapper for Opaque { > /// Create an opaque pin-initializer from the given pin-initializer. > + #[inline(always)] > fn pin_init(slot: impl PinInit) -> impl PinInit { > Self::try_ffi_init(|ptr: *mut T| { > // SAFETY: