From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from LO0P265CU003.outbound.protection.outlook.com (mail-uksouthazon11022116.outbound.protection.outlook.com [52.101.96.116]) (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 06ED8421244 for ; Mon, 17 Aug 2026 13:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.96.116 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786971768; cv=fail; b=ooiDgLg+xywqAzkH3vDpKQl8bNocPMjovBMiLoedr5q2j92lty2mQCKMb9zGve1FtkeH+GsEeodL+lZLEO+WUnxJS6hQANJi7/ctPGiTxxPR0ifu/E92dOQtclEl54yjK6in1BKUCefqWqwebWvrQmyJDFu8RY0OPrvMizxAeZU= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786971768; c=relaxed/simple; bh=3IQqxB9QoU8Y/jNglQuDRaMLLWrzVC/sfqaSpXX70MA=; h=Content-Type:Date:Message-Id:Cc:Subject:From:To:References: In-Reply-To:MIME-Version; b=g9781a+1V9U6NjMIfv3TYdcIWgwb9TXOSS/ZqIn/gxRCfVaVF07szQ6gPBKzxmqS12UAC56h3KMvsxlLLKhxAGPvM/x/Icf4+lxhh8WG0g9lMZ1sD92aBXD61C6sVWo2oK5ns7xQsRKLqpoDL0LVRJ4zDv7FLr23m0BrjdM0has= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=garyguo.net; spf=pass smtp.mailfrom=garyguo.net; dkim=pass (1024-bit key) header.d=garyguo.net header.i=@garyguo.net header.b=p3qbMrvU; arc=fail smtp.client-ip=52.101.96.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=garyguo.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=garyguo.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=garyguo.net header.i=@garyguo.net header.b="p3qbMrvU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=C4zBIshyNEYXIcIlKjq8pMGNvnKogpj/yreGI0ie2wObu6+RLFH8wu07k0Ro2rS14Bpk7RXLIh27uCUB0C0IFQtR15nCcJ2MSWx3VnCTCnPs6jxWwFmsXLVepkd8+YPsLCqlkyu4L3KnM9WAlM/m7bMnbH8lPND83q8BgKmArk7cazzPzNrm4jyf7tuEVu2dlRHvOTAhSj4oRX9iHpcsFu0pvuJjjfDxULaRK93qgIv1OCEqIZk7Lm7Mp8n8zSP/FdyKWPDSaOW/pytbf47Cm63t3v9wQ+2iojzORII8DouM/B4Zyy+pDwQ+EOg6lPxyqsR4Gws+dPDUDXgT8D5T0A== 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=TjdwkS6XpLb1fGd28nH3/yuua9S8Osv48ncMTOhPMMw=; b=uBChOE6hVGwFaszKpwKH+6cH3ogdxzO9c/yPImQKDCmepp7e+lB8HOW/IOurFFLxKN9VeZgL6vKmA/IlFeJptwjuDmzSsvLNHmS2pbfZ7fSkeaNDDdgkvr33dWCLp4i+tny6dH2BGQZUzGM8JNOKCKDb1WNZMAc7S5tgqz9ghEwOuWdFjoTWggHKzcOuaHOXeit6c2Y09v9ah2U0CFEY7gCkpvs+Wz18ZfMqd94miBaDTYWs2sbP4zXIFi4tdOWT1Z5zxIdraL+aCAPr7EKlnHkhlH3ive+AvkjBiMIE9WHVHIlcGUDQ4agt93xVFCaRPW7o/fI7UfmRdMkt/cpxGg== 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=TjdwkS6XpLb1fGd28nH3/yuua9S8Osv48ncMTOhPMMw=; b=p3qbMrvUgOGVzIcXCtaK4lBFZH3khiLnr7bT4h0MfMHkuVZq+u5EoF6QdhErdYRx5oHUzEjRlJhofanYEuuzpkN+q1SkyxnPPAGm33BprQbHs6L4tQKWTrKMerSYHHVFYsFw/XdmheK0cSHSNzXeDFGBbELl48G529NBFiO9dWQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=garyguo.net; Received: from LOAP265MB8560.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:4ab::19) by CWLP265MB6753.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:1e9::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.315.17; Mon, 17 Aug 2026 13:02:39 +0000 Received: from LOAP265MB8560.GBRP265.PROD.OUTLOOK.COM ([fe80::f60b:1537:68d7:4fc1]) by LOAP265MB8560.GBRP265.PROD.OUTLOOK.COM ([fe80::f60b:1537:68d7:4fc1%4]) with mapi id 15.21.0315.016; Mon, 17 Aug 2026 13:02:39 +0000 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 17 Aug 2026 14:02:38 +0100 Message-Id: Cc: "Gary Guo" , "Yury Norov" , "Alice Ryhl" , "Burak Emir" , "Yury Norov" , "Miguel Ojeda" , "Boqun Feng" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Benno Lossin" , "Andreas Hindborg" , "Trevor Gross" , "Daniel Almeida" , "Tamir Duberstein" , "Alexandre Courbot" , =?utf-8?q?Onur_=C3=96zkan?= , "David Airlie" , "Simona Vetter" , "Greg Kroah-Hartman" , "John Hubbard" , "Alistair Popple" , "Timur Tabi" , "Zhi Wang" , , , , , "dri-devel" Subject: Re: [PATCH v5 5/5] gpu: nova-core: add ChannelIdPool From: "Gary Guo" To: "Danilo Krummrich" , "Eliot Courtney" X-Mailer: aerc 0.22.0 References: <20260812-chid-v5-0-6c767770b3f4@nvidia.com> <20260812-chid-v5-5-6c767770b3f4@nvidia.com> In-Reply-To: X-ClientProxiedBy: LO4P265CA0076.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2bd::11) To LOAP265MB8560.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:4ab::19) Precedence: bulk X-Mailing-List: nova-gpu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LOAP265MB8560:EE_|CWLP265MB6753:EE_ X-MS-Office365-Filtering-Correlation-Id: bbab2404-5035-4d24-ab38-08defc5fd0e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|10070799003|366016|23010399003|6133799003|3023799007|10067099003|56012099006|4143699003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: 0PHoYO1i0GITt7Yswh9LK6Nz8nti7HT4L5q6a3RpHgLqNnZPzPqvZ4VSbT+LDsEKHndwRdxpeR0iXZ8cQOPa53LHFPmytgZnoa4FJEqXdbUnZTqlqqRnN34Jgyrh4gNJ2PiNBihHhfThtGzTUjirYdXekUKCBupbeB/gTveMCpcbR2YpAK4MIJv9UG4q48bQeFnRwyIYnXZq4IKfdiJa4hLGxqPmeSyNvnvaOM9Ft8Qy5e+H2z7OoGASkZmf9RbgkWQP+waoGvwcQHkA4I8HRw3GB4tox8CSx5BP00oMPeXNrt2BigJgdO0EeX8xC7wt+pkY2q4HAIyxkNhSzPgQsyjMlb1qDhAwara0wEZl14uaYNjaVMmCBq6RnaJKJ+ts4B7zHHUThZltumldHFNAEQdkE4vZXKhZ7VrTa1beG0+gIk2NWil5d1/hc3Od8kpX6rcz2D73zzHJrQ3V/0siLm8jbX+s2pG4bXjgURK6IjicXRhiBQJT+MQjj7fd9c3kd+TCHpb91s1Tn/iB6X7hePJUxc2+z/amoRaoLEHRe+dkBxshbkFa2hBzRudWo1VDL/gS50CKTx0VkxKmKfeuKFQhX60vR/YwkGo5KkD/j0iivMC8m9FwSRvolRxljBi6hwNffakc+mgcFUXZCnG1RpAcU7Z5Z0vIDgSmDpA+8k4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LOAP265MB8560.GBRP265.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(10070799003)(366016)(23010399003)(6133799003)(3023799007)(10067099003)(56012099006)(4143699003)(18002099003)(22082099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eG9LdG0yMTdONSttMElLTlJNb2dURzc1SEhpYnk3UURHV1hmSFNjMm8xUmwr?= =?utf-8?B?R0QwM1JaOWlzQ1o5TGxxMmRrb0RaYy9mRmJGbjdweHhoaDBmYW94NUZkTXZa?= =?utf-8?B?ZU5VU2FMeUo3citZdVJ3NjBnd1pPZ2p5UTgrWlBGdHRNM0g2UFJiK3J5ZU5x?= =?utf-8?B?MXIzQStFV3prekJBS0oveXJJZVZBajYrL1JQZVhXMzFMTldGS2J3dFJVSjAv?= =?utf-8?B?ZEx4cWRiZW9HUXhKV2dyc1BGYXB0aXJYQVZiZ3J1NzZmRm5vQ2RkdzA5QWp4?= =?utf-8?B?NWt0VkRtVVAvQllHejRXUHIzTVR2ZGx2ZGVRMGEvZkdsd3M3S1V4Q3BwL2Nk?= =?utf-8?B?Ny9JZXBkYU9TV0FLWkFnMkVDU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8?B?K3ZqWExaWnkwYTl3OTdMUWpTWEtyQmM2ZGR1MTljQi90MEF1N0RsY0kxdi8z?= =?utf-8?B?eUQwSWVXZWtPWFE3NnNGWEVTZ0ZxQmFnN3dPeVRTUWxibUwreE1RTitSRlhK?= =?utf-8?B?eVRDN0wxQlNWVnErc1lCeEsxaDNXaDFuNnp6dWowelFQbWVsV3FvZz09?= X-OriginatorOrg: garyguo.net X-MS-Exchange-CrossTenant-Network-Message-Id: bbab2404-5035-4d24-ab38-08defc5fd0e2 X-MS-Exchange-CrossTenant-AuthSource: LOAP265MB8560.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2026 13:02:39.0692 (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: SExQVwTFoC05EY2QJk8AdPNE3vXqBD4Hg7fCByzUTd1xph91XiI1oDGDEfO1bQ9PAcDpVKxLoLr0QvzNvCu9xA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWLP265MB6753 On Mon Aug 17, 2026 at 1:16 PM BST, Danilo Krummrich wrote: > On Mon Aug 17, 2026 at 1:49 PM CEST, Eliot Courtney wrote: >> On Mon Aug 17, 2026 at 8:18 PM JST, Danilo Krummrich wrote: >>> On Mon Aug 17, 2026 at 12:54 PM CEST, Gary Guo wrote: >>>> IMO we can just support zero-sized allocation by always succeeding, si= milar to >>>> how ZST allocation is handled in memory allocation. >>> >>> Probably, but in contrast to ZST allocations it wouldn't be very useful= , so we'd >>> silently succeed on something that never was a reasonable argument in t= he first >>> palce. >> >> Yeah I agree that supporting a generalised zero sized alloc is in some >> ways conceptually nicer, but I also can't see any good reason why you >> would want to do it, it sounds like a bug. That's also why in the latest >> version I made IdPool also not allow a zero capacity [1] (incidentally >> required to not have to change the grow code to avoid trying to double a >> zero capacity thing every time). > > (I assume this is more a reply to Gary?) > >> Tbh, I feel that NonZero (and Alignment) is hard to use currently >> because of these ergonomics issues. But I reckon they're useful, so I >> like the idea of trying to making them easier to use. Maybe you can make >> an argument to not use NonZero here, but what about all the other times >> we will want to use it? > > Personally, I don't see the argument for not using NonZero (or Alignment)= ; the > invariants required by the API are expressed very well by those types. > > I also don't see a reason to step back from using those types for this AP= I. If > we'd do so it would question all the other new types we have over primiti= ves > carrying certain invariants to a certain extend as well. I think there is an distinction between semantic differences vs just range restrictions. Consider the other cases where we use new types: * flags: very natural as you don't even need to mention raw literals. * units: for things that semantically carry a unit, writing things like `Delta::new_jiffies(...)` is quite natural, just like writing "2 seconds" * addresses: things like dma addresses naturally fit in new types because y= ou don't need to write literals for them. Now, with `NonZero` or `Bounded`, we are doing none of that. The only thing= here is that there is a range restriction. Other than the value restriction themselves, they carry no other semantic meanings. How you interpret these = types still fully depend on the API that accepts them. Therefore, it is very comm= on that you'd be using these with literals, and it becomes an ergnomic pain. If Rust pattern types become available in the future and you can write fn alloc_area(&self, count: usize is 1..) then I'd fully support adding that annotation to functions. Personally I va= lue ergnomics higher than possibility of misuse if latter can be easily mitigat= ed otherwise (in this case, by WARN_ON or just support zero-sized alloc). Best, Gary > > I understand the ergonomics concern, and I also see that for compile time > evaluation turbofish syntax is not that popular, but this can be improved= . > > The fundamental value remains that it nicely separates the invariants cal= lers > need to uphold about certain arguments from the API itself. It makes the = code > more maintainable (e.g. we don't need 10 different variants of a function > depending on whether the value is a compile time, build time or run time = value) > and it makes the code more readable and robust (e.g. the semantic meaning= of > arguments is very obvious and confusing arguments becomes almost impossib= le).