From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from CH1PR05CU001.outbound.protection.outlook.com (mail-northcentralusazon11010013.outbound.protection.outlook.com [52.101.193.13]) (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 C0AC7E573; Thu, 1 Jan 2026 02:43:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.193.13 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767235390; cv=fail; b=mL7oSFiyErbiVuArrkU50AvFSskSBK2Ks26npN5sqX7sRjmbhWLjV84oKCIrZWDWu1pelFAxCoXxFwjCoEj9ReZXbb7sWU2/QWjpQdN4btx2ImEYsfMELSgRx8i6OjxyCb32375hgsxjE/qI4m8I9S3peb1CCDMceU7HdEdNWbA= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767235390; c=relaxed/simple; bh=5aMg0yq+ItwFrcBIMrkPNlC+AykDKRC/a5mLyUBiyQI=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=mMz3Luc14xRSkcRZztiO0NXaSyDBDSlgEmrUxaDXHN+T4zVvjjffLEp9ZFz4LvdcTnQmD9OMK0L1qDYh9Ww7DSBkp/yXhd40j/RaFBrahMMac3ibcVvlZ89kzs9CPuKyCpIbp8SwsjANMJG1jtg6zT1OtnQRKzVWqkutXonas9Q= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=rPdynlb0; arc=fail smtp.client-ip=52.101.193.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="rPdynlb0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gZq47kHkwQr8bjsRBA7jkrArDlE0nVxVlUk89AERmsSnkIkfZknuD9wrGT2vvcgobtXSrbiaKXmQlebGduAuhKVO5/bF/1w4D7E7kLnNR1FLs5RDFDonX5iIGW6T1/DfRb2bz9X/+f2iuDpWMp1Lp09mFzsUUpX5QHlKPx5zzY98LX/+7URSGd2wQB0BPW5JdT6a0hAIaGHZT3EGw3aALXj40Xzf4SQWs9knEcG4+ymBkaHkN12FnXGq9DQmjBiEpj9hpsVvneQLMaP/wv6M101yc8OjV/h+BxXlunvAYT8MMI4XnQapcxPILrtK7NRLG0TX8Qhf057tpBqOyRMsWA== 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=2YahD3k2ftPqtssEZ66S130zX8+PKkXxNBtMjHNH0ak=; b=vdPHD/PASH6WlgSXHgXQQzl0zHgzO8BTfNaG5z5J0TVxClKLT1pNx15bGCTgGQ+MIItMBYAKSwOjXRgcULbW8QTLjshSu0QNwIpMXHcw9uaqSkfhx5qOLNgO4gZxqqyAkNnDObyxq7FbNl3pTTRbae+JjPlTnS1+Z56TpzSVcvNNZwsACdcpVqFlgix7smnPFc6ke5MmKIqzJ63YxlFlXwdvYdoHyYzWqF1nIJFfUCxOmn0iV8XLYMQgekC/vELZlfMSDU44EY2Zh/IQTZq0NoXZFrJdB2N4Wbqq602xEW3Co+RiHHPx/dMrEaWoO+EDqJEuUACs34FIK9WY1JvUCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2YahD3k2ftPqtssEZ66S130zX8+PKkXxNBtMjHNH0ak=; b=rPdynlb0aEjRwLxxuoqYUcD4+VL0KYd/QVMfTyfUBEIJa27kHSjcfpYo/Pbk5d7fdm4AOqAchUeIDe1btv4KnHn7RgvyVAjvfUOYU9MY1SiA6sCXAMIzSIQPj/azPyqzGwoiRjqnjcBQreDDpGNmriO+syuCIY6uolEot1AxMy4HzoVj6zRgj+89vPEy4Pq+LuxSDVjXTDfqF3WN6+/nHP5qFSqO6JImmNxLp63H3TN+aQTQflqJJ/nopoGJX92vSPA5t+veOS0nmDygZWPDZYFGk092UUkxL6+eaxZfFcUMT7GDylwac43A5NIYnrF96r5gD2BazsMX95+HA+f+Tg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from SN7PR12MB8059.namprd12.prod.outlook.com (2603:10b6:806:32b::7) by DM4PR12MB8570.namprd12.prod.outlook.com (2603:10b6:8:18b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9456.14; Thu, 1 Jan 2026 02:43:00 +0000 Received: from SN7PR12MB8059.namprd12.prod.outlook.com ([fe80::4ee2:654e:1fe8:4b91]) by SN7PR12MB8059.namprd12.prod.outlook.com ([fe80::4ee2:654e:1fe8:4b91%2]) with mapi id 15.20.9478.004; Thu, 1 Jan 2026 02:43:00 +0000 Message-ID: Date: Wed, 31 Dec 2025 21:42:56 -0500 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gpu: nova-core: bitfield: use &mut self setters instead of builder pattern To: John Hubbard Cc: Timur Tabi , "dakr@kernel.org" , Alexandre Courbot , "lossin@kernel.org" , "a.hindborg@kernel.org" , "boqun.feng@gmail.com" , "aliceryhl@google.com" , Zhi Wang , "simona@ffwll.ch" , "alex.gaynor@gmail.com" , "ojeda@kernel.org" , "tmgross@umich.edu" , "nouveau@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , "rust-for-linux@vger.kernel.org" , "bjorn3_gh@protonmail.com" , Edwin Peer , "airlied@gmail.com" , "bhelgaas@google.com" , "gary@garyguo.net" , Alistair Popple References: <20251231214727.448776-1-jhubbard@nvidia.com> <9db27bd6015ccebaa20e51450d8c42eb2864cb2e.camel@nvidia.com> Content-Language: en-US From: Joel Fernandes In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MN2PR18CA0009.namprd18.prod.outlook.com (2603:10b6:208:23c::14) To SN7PR12MB8059.namprd12.prod.outlook.com (2603:10b6:806:32b::7) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN7PR12MB8059:EE_|DM4PR12MB8570:EE_ X-MS-Office365-Filtering-Correlation-Id: 600bf491-895e-4055-d582-08de48df7a54 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?MWlYVVZHcnlHdCtxbVdJZXQ5SVNHMUdvaC91TGU3ajBsUjBHV0RkU1RoVE9O?= =?utf-8?B?b292WVNaVy9Sb0ZlcHpDSUFMNmxtaGdDeU05Wk1hRjNOR2JmQ3pNdUlQRGdG?= =?utf-8?B?RUVmZ0Q1bkxKUW1QRHQrdURVRUVqYTgxeEZKeURMYXdoU1Z3Q2JkQnVUL0x4?= =?utf-8?B?UGlYc29CSWR4TEZ0TzQzSFlKWVVSOVRKTGFuSlg3YmFqd1BiTWpvdHExM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TRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN7PR12MB8059.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016)(7416014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?azJRL0NXRmFOMWZ5SjZUM1pNbDRZNzhyQ2ZpK2MrMElYbDJJV04xaTVyTnJi?= =?utf-8?B?WkJYaGl2VjI1VGZ5azlBVDhtcC91bXdJYzFlM3JpT3BmNU9EVWJmNmpaREFJ?= =?utf-8?B?T20ySzVlWURnaUNHcUkvUmNaaHdtREZuU1grMkFRaGx5VkpSNk02bnNuTW5K?= =?utf-8?B?dGFVUDBlS1ZQcnpza0dJSFpjbjZQWk9Vd0JlOHdmQTEyVVpUY25DVmh5ZklS?= =?utf-8?B?azlTdy92NmZ6RDhWd2J3c3M2ODYvczVNVmhPMXhiZ2dRQVdBRlVzVVVja0Yz?= =?utf-8?B?dVA2dFJ5N1Rrd1JvQlF6WEhUNDBHRHVDbVRWclJBWDlVTVFzc0ZaT2IwZmVs?= =?utf-8?B?RVYrUGFCRC92dWlRMTZ5UklqWHBzMEhUUzBRaEVEY2cwZC95N2hvL3RJWnpn?= =?utf-8?B?QmFTVTl4MjJkdDFtNHJORXl5VG1kYUc5SE4vN2tmVUFwbFFuaGoyemZsK0Fl?= =?utf-8?B?VWM5OFh5NlBaUGRzeHVmYUUrUkpXb1hPS29LKy9pZjg1K3ZUbkNaM0huWXN5?= =?utf-8?B?SmEvMHJUNjJPajErUmlqVVpQdlpDOU12RnBOdU1QM2hlT3Z1VFJpUzRQVlFY?= =?utf-8?B?SzdydHBrL0FTUHZBS3dXM01wdFc2dzBWdzRrSGZKcG8zMy9ZKzZCN1dlVGFW?= =?utf-8?B?dE9xNktGaE1EdmZpWlQrZ0h5NVJxZmpFMitaWG95VndiNHdLTXZmZjZFeXZx?= =?utf-8?B?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09hR0hB?= =?utf-8?B?N3hpYU1YRGU1UmlGamdaSStjV1ZxalpmS21pY2hOc2FWTXJscjY1Rm5tbTVq?= =?utf-8?B?SDFxOUY0eitDalFlNFhGQXZOYmlvbERGdTZEaTdEZ1gzNUYxVERTU0diZVNR?= =?utf-8?B?WGJtUEJ4dVQzSWRSYllrbGkvODcxVGFkMkI5TUVwQmRlTWU0ZWJna2JsV1Vp?= =?utf-8?B?NmVHY09vYVd6Wi9ub0lMVldiS09BSlY5a0Rob0s4ZVVmeitubC9KdEtpUVNY?= =?utf-8?B?c3R1RHFmaUdoRVU2UFRjRENTT1pQSWgrci9RRmVmTVovUS9kelVPZFB4RTJJ?= =?utf-8?B?M3BUcGFOclVqeUo2RUhMVUtpOExKM0lLMU0rbzNQSFNtMEFBdndwa1ZHQnV6?= =?utf-8?B?UTMxMWd4SjIzYWhPSGovdFBqb2pQUTNpM3J3SjBBam5pYm9oRXV3MXNUMGRC?= =?utf-8?B?UlpvWW9zRXgxWGJ1Wjh6aHRQSU02MklTRHkzcjgvM0xNdTRScTZzUVZNckhQ?= =?utf-8?B?VlBDOW16TVVvanVQOUU2eVRScTk1NWRYb1pMaEtwMUZXckJmbGZ2Y2d2eHE1?= =?utf-8?B?VWpZbUlXdG5oWXM2enQ5VkxYZEJCN0w3MldUbDFsNFlxNVVadmFrSlhUZEJP?= =?utf-8?B?Z3NjdXdEcGltaUg1TFdHa3YzcWhCbW5XeitpZHFlSXdrNXN4UzdTYlptRWQv?= =?utf-8?B?MnIxcnVuNlpsdEt4VWt2ellLL1JtMEdCaGtuL3UxVmlrTURIRUJ6Zz09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 600bf491-895e-4055-d582-08de48df7a54 X-MS-Exchange-CrossTenant-AuthSource: SN7PR12MB8059.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jan 2026 02:43:00.1865 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kmULHTF350jqu58/iwUWiCugM/DLBrg+OfNDV0wTxi1gPEH+1E3bZIi3G9Xr/jMZbD5Qr0SlocXO4jwpqGNcFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8570 On 12/31/2025 7:46 PM, John Hubbard wrote: > On 12/31/25 4:15 PM, Joel Fernandes wrote: >>> On Dec 31, 2025, at 5:47 PM, John Hubbard wrote: >>> >>> On 12/31/25 2:33 PM, Timur Tabi wrote: >>>>> On Wed, 2025-12-31 at 13:47 -0800, John Hubbard wrote: >>>>> The builder-pattern setters (self -> Self) enabled method chaining like: >>>>> >>>>> reg.set_foo(x).set_sec(y).write(bar); >>>>> >>>>> This made separate operations appear as a single expression, obscuring >>>>> that each setter is a distinct mutation. >>>> >>>> So you're concerned about the fact that the compiler is not merging the set_foo(x) and the >>>> set_sec(y) into a single read-modify-write? >>> >>> No, I don't care about that aspect. >>> >>>> >>>>> These setters are infallible, >>>>> so the chaining provides no error-propagation benefit—it just obscures >>>>> what are simple, independent assignments. >>>>> >>>>> Change the bitfield!() macro to generate `&mut self` setters, so each >>>>> operation is a distinct statement: >>>>> >>>>> reg.set_foo(x); >>>>> reg.set_sec(y); >>>>> reg.write(bar); >>>> >>>> Are you sure about this? It just seems like you're throwing out a neat little feature of Rust and >>>> replacing it with something that's very C-like. This breaks compatible with all users of the regs >>>> macros. Seems really disruptive for what seems to me like a cosmetic change. >>>> >>> >>> It's only a neat feature if it *does* something. In this case, it *looks* >>> like a neat Rust feature, but under the covers it really is just handing >>> around copies unnecessarily, when really, it *is* doing the C-like thing >>> in the end. >>> >>> I object to the fake Rust-ness that's being done here. It's like putting >>> hubcabs on a car. >> >> But IMO there is only one operation here, the IO write. The setter is just mutations. Builder pattern chaining is idiomatic to Rust. >> >> I would not call it fake Rustness since it is Rustness in the Rust language. Afair, similar arguments were made before and conclusion was, well, this is Rust. > > There is nothing about doing sequential .set_foo() calls that goes against > Rust idioms. Huh, I just meant we should "Ok" with and inclined to be using Rust idioms even though they may seem unfamiliar at first. > > But this really is fake chaining, because there are no Results involved. > It's not buying us anything except a bit of indirection and cognitive > load for the reader. Chaining is not really only about error propagation. Builder pattern can be used for other cases too, like passing a setter chained expression to a function argument for better clarity, I was planning to do that for the sequencer for instance since there's a lot of parameters passed to it. But in this case, I am actually absolutely opposed against this, it makes the API hard to use because now how do you differentiate between an IO function call versus something that just mutates memory? Is set() an IO or write()? reg.set_foo(x); // no IO reg.set_sec(y); reg.write(bar); // IO. So no thank you, I quite dislike it. :) Instead with chaining, we can just rely on the last part of the chain concluding in a write() with the intermediaries just mutating memory. Further, your suggestion could also make it easier to introduce bugs? reg.set_foo(x); reg.write(bar); reg.set_sec(y); While this is also possible to mess up with the register macro, it is much harder to do with chaining since there is no opportunity to interleave a write() incorrectly. >> Regarding the copies, I am intrigued - have you verified that the code generation actually results in copies? I would be surprised if the compiler did not optimize. > > > No no, I just mean conceptually using Copy instead of a mutable Self. > Conceptually, but the compiler would not do any copies through the setter chain was my point though. Note that all setters are #[inline(always)], the compiler should optimize chained calls to simple register bit manipulation. If that is not happening, we should definitely look more into it. thanks, - Joel