From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 756C32F3630; Sat, 13 Sep 2025 13:30:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757770244; cv=none; b=HTJQpiR4nAMgADUsF1WejT2ZjOVcaK6seKpLZ6CfWO95c9k9NBqa92nbgaHBtXU8UW8OS6xU3vtxIp67HZF1Cx2zkCNJUeQcgFscr7AkArpxnTwnamUgXZcqNSdDORjp1eL4F1DxYokUDGOk6HBA02CqFcp6z2ZOnzfchosXDlg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757770244; c=relaxed/simple; bh=uV6AIY3tX6ZFbEbK51nPPUHpEf3Vl5idHgfbQrj2RXs=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=q2tMG3o+PpHpLerdh3cZtop9Y1g8B1VBYaRs0nHzIL49pFX1UiJBhJjUeesfPpsAaYb7T46NLGBcaRdkCzuBRYERmkmldR5HHSwZ3A5745AN+ClIyVuGLMLrA4Lr9DNA32gM8afw9ac6JUsFvJbg0wjjqRTodg/cL9BSz7682+s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HEGru90Q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HEGru90Q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C946C4CEF4; Sat, 13 Sep 2025 13:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757770244; bh=uV6AIY3tX6ZFbEbK51nPPUHpEf3Vl5idHgfbQrj2RXs=; h=Date:Subject:Cc:To:From:References:In-Reply-To:From; b=HEGru90QW4kc+aEL2YYRxXYkaCbmNxKMtYkOHgKiH/LaRkWhOjikL2I21k3MEhhWE w6k97DXeAQZ20nIexQdiEnhyxWzyox46F0JEDtqeTThu347OfGa96ORNp7h3TCYYQW weR8QKgDRRahKjU+kRdVLw2DLI3efPoLoX29RTgETFLorDFx0TB4lvMt4+15mIxsQn NMTQyzDWGSBoeUOaXOCBly0alT3C20yHjA3Gag40OIPoiufLibtm9MeuHyd6Iqay9O dnrFoDPTTYMIPfJ38pD3yEO3/EV0YRWx1H/lgF1aM3tNjcy/porZoJ46J3jk44wEOZ QZpSGK4696qnw== Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Sat, 13 Sep 2025 15:30:31 +0200 Message-Id: Subject: Re: [PATCH v5 02/12] gpu: nova-core: move GSP boot code to a dedicated method Cc: "Alexandre Courbot" , "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Benno Lossin" , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "David Airlie" , "Simona Vetter" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "John Hubbard" , "Alistair Popple" , "Timur Tabi" , , , , To: "Joel Fernandes" From: "Danilo Krummrich" References: <20250911-nova_firmware-v5-0-5a8a33bddca1@nvidia.com> <20250911-nova_firmware-v5-2-5a8a33bddca1@nvidia.com> <20250913010226.GA1478480@joelbox2> In-Reply-To: <20250913010226.GA1478480@joelbox2> On Sat Sep 13, 2025 at 3:02 AM CEST, Joel Fernandes wrote: > Any chance we can initialize the locks later? We don't need locking until > after the boot process is completed, and if there's a way we can dynamica= lly > "pin", where we hypothetically pin after the boot process completed, that > might also work. Though I am not sure if that's something possible in > Rust/rust4linux or if it makes sense. We can't partially initialize structures and then rely on accessing initial= ized data only. This is one of the sources for memory bugs that Rust tries to so= lve. You can wrap fields into Option types and initialize them later, which woul= d defer pin-init calls for the price of having Option fields around. However, we should never do such things. If there's the necessity to do something like that, it indicates a design issue. In this case, there's no problem, we can use pin-init without any issues ri= ght away, and should do so. pin-init is going to be an essential part of *every* Rust driver given that= a lot of the C infrastruture that we abstract requires pinned initialization,= such as locks and other synchronization primitives.