From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from CWXP265CU010.outbound.protection.outlook.com (mail-ukwestazon11022133.outbound.protection.outlook.com [52.101.101.133]) (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 6C197361DA1; Mon, 2 Mar 2026 17:26:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.101.133 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772472416; cv=fail; b=qzDPGGlc5hI73QzPOPkK6Gm2r29RYhevY+oDAx9hkuDn+mousIYcbZ7oYAjEN68mrWq0QgEg5iKN9jiFl4t7AJJMLU/C4vr81sS6NGuZ/GQtbrBhOAh7FJG+9MNkmJZE+Os4iqTdUhmwJGV29OQTi/UV2v9Mzo5NiR1Eh7tFS/M= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772472416; c=relaxed/simple; bh=t2Ht2kEZjesgANkcGBorIGBgk+ObGGfTLwFD/ULUe1U=; h=Content-Type:Date:Message-Id:Cc:Subject:From:To:References: In-Reply-To:MIME-Version; b=sGd2dK8cCLt2gMj92cDq2V8Z0KvSaL3T1ms8M03E8b8pV90EUCsljh1tqIfGiFByKlGJLJX3Xk8pXOWBXDZJ1MjgXM8gdvUM46KrelJ9oHAGZSTGlloxpiYR+Y1eGCW9O5OTHx47eWcwl1RSdxMr7rRhiFyHoWdDOmARA8Xl94k= 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=v3xYXlCX; arc=fail smtp.client-ip=52.101.101.133 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="v3xYXlCX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YKDvhUkfj7JUUco8Xq9G/ekfKq05a17309A19MLinFBgG62Yrerze7VCdYIKUhc0WdBYZAmWnNonmRwv9o4v4GgNiGaLIjtUXtYok4S8+dH3l8zsqmkBRRkOqm8XVWD77rBcVi5M/qdXlf05SF7qdHL738YU0dtRADbQ7Zb2cRu9k14pv6CNxmygEGVTjykZFzn5iqh+stHnxlTWhEy8zeKlJZWOxA4WMg2Nso+7wXiug4sbEo1bYE3fgjE1IkO8b6yLoKRsS7ILuiqTGe0N/hYQ6u0oAWTtI6Hnp8gIMt5SNSLiNTO21dnMvO4QVZ4L9jXTj5fPa+O/9HCaF/yUdw== 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=SpPVpUTurjMEo0TDyiIE+esnVU8X4QqwcE2GSnLgDkw=; b=UJxdmO1QjNK6jNXRoG7vG7t1DLoyyCxlDPWmZTJcG4qmMEr6E/kFraHi9M9ZkvgeHtS/6hfv1HTJJzye2Mw5gr2NDfR1aFGeBZdMdYxw78MLaVc70CS5ZGkJE9MD4E/u4y1bPaQZa2x5sxyMICEIGgYP7aLbiRjlM51lV0e5phcaqd/Jd1Q3Ks4i6mNEABiEhC6+OIEUYv6h/cXlKx0jDVySOkZH/p+7ZHSuVuejAo6W9RphI3YXmgj7N2sMfPdzpSAdfS0TMM0KzBCEavq8HqAyUj/ym3VUUJSsmoUwNeR55xO7weuSKxNyjbE2YgIzd8yloULsS8/oskKj8k0A4Q== 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=SpPVpUTurjMEo0TDyiIE+esnVU8X4QqwcE2GSnLgDkw=; b=v3xYXlCXRbRnC8xLwTM6cqHpzBYxkFcrBlNQAOL2m0hLAK55ab08xZl2rP1W4sufIZ7/NbeFx4H6lvc4ivqthnGCSJNlzOUJxbGKeIGCZsZ9fEIhNL9j30a05p6UTFZ1JpMQGj4mF5VQG8KhQn+x/mbaebc9ITrvslMZd8skdnk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=garyguo.net; Received: from LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:488::16) by LOYP265MB1838.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f0::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9654.21; Mon, 2 Mar 2026 17:26:50 +0000 Received: from LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM ([fe80::1c3:ceba:21b4:9986]) by LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM ([fe80::1c3:ceba:21b4:9986%5]) with mapi id 15.20.9654.020; Mon, 2 Mar 2026 17:26:50 +0000 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 02 Mar 2026 17:26:49 +0000 Message-Id: Cc: "John Hubbard" , "Danilo Krummrich" , "Alice Ryhl" , "David Airlie" , "Simona Vetter" , "Benno Lossin" , "Gary Guo" , , , , , "dri-devel" Subject: Re: [PATCH v2 2/4] gpu: nova-core: gsp: add sync and async command queue API to `Cmdq` From: "Gary Guo" To: "Alexandre Courbot" , "Eliot Courtney" X-Mailer: aerc 0.21.0 References: <20260226-cmdq-locking-v2-0-c7e16a6d5885@nvidia.com> <20260226-cmdq-locking-v2-2-c7e16a6d5885@nvidia.com> In-Reply-To: X-ClientProxiedBy: LO4P302CA0032.GBRP302.PROD.OUTLOOK.COM (2603:10a6:600:317::13) To LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:488::16) 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: LOVP265MB8871:EE_|LOYP265MB1838:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f3d8c62-f29f-476a-41ca-08de7880e36b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|10070799003|366016|1800799024; X-Microsoft-Antispam-Message-Info: w6R+kEpyyyh1tRTwli5/KSzU/LYjyxoIAaaA0Km1hnPdLbcNtv7yUpbv/wToLIv9KgXDrCJRrKLfrQFslvSH1N1ivRj4py36Qe9AWdDKPgDlFUKQLySdEO9tyzi4+nFfy403p9/jZLIxv11P1zsK50jWslcbz7efhSer217zYKOEeG4qerlsJGelLPpdmJ14h533uQr109870G98R2Y+XA6VedxbsFcPcairLXa+QS9MnE4cqxxIKWGdqqLP3OOHnjkYBTwWl1R+s1rJLaz6uarsGRDFxpjzYHVCfZliK9972FCJFAMzKcSOfqcKRnVkGjDDGYXh8WHLhfc9PeKMNcewpyQ2TPhaHRhTfbN/YgyLDlfBw7z6DI93K5AMVAo4Sixqjn6/sN3kxrYRu5KqrHvwrwk3/df4P/P9euAOFb68ozh0HUKYYe254cBI4p9/MTyNBSFRohQpowK1aFxG/NHlkqKbCW0grvmyv/C9ng3gzd2o98arcHrHiCTLfgRPS038Rk6Pn2EH/QWgXbuCyCRN2/MdbrL9hVGXZWCHHSTgzuiSKzn8qaoyKev03oD7y8+8SkMOOdJrKqkWHY/GgeUHxMWoytagTV1aUrURVkaSm5g71R2IWUWgpOCOwxaAO8KAbBDRFri82ji0mx/N1acI4DhZh+l3SlaW/Peu50kwxWSoaX2jhUhoCIualD79woRc9UscxDnbs57lD5zIwvPuW6Xb40Tss8M1c5DirDU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(10070799003)(366016)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZFl3V0dWN3YyT2plOUpWbjRBUzY1czh0WEdxdnVYR2Fpem9zY01JQ2hxNklU?= =?utf-8?B?aFplb2pFVlV3ZFAxSVcyRlhYSXp6ZmhNYk1VT084cEVwOTRFV1lvcVNaNjZZ?= =?utf-8?B?UGNKY2hSdG9jcTB6dmJONzFLU2J1dDR5dzY3dEFrcURiMTcyZ2o1V1lyV0Vl?= =?utf-8?B?K3libllBU05kZ1NRM2orQ3NpSml5SDZqSnlTQVlaankweFl6RG5GUldBbTJ5?= =?utf-8?B?WUc4OXNtem9ROEJ4amdiY0w5TEZtanVqbDVyN1RReHlvS3JpbElCR3dmd3Fv?= =?utf-8?B?NmROc0c4VlFZdnhUUHB0eXFLTGJiUS9CUitiV29MRlpyKzYvSnZ2c1czRTIy?= =?utf-8?B?K3Z0YXNpREh5enNlemxFQW05T2xGdUU1aTlzSE5rUHViMVBFT3FPY2tJREo3?= =?utf-8?B?Z3NzL1FvWmJXTXVHTzh0Vm1ORWxIcFhrK082aXFKUjFMK3luUXpEZThja1Ev?= =?utf-8?B?WjQ5Yk96MldlMEh1cmNXb2JNRDI5K1RiYzJjb01jNWlLYnhlcm9jak8rNHlQ?= =?utf-8?B?UXcrWFNQUnh6UGswa2N0R3R4RTZtWW9WL0l6OVFjNzR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MS-Exchange-CrossTenant-Network-Message-Id: 3f3d8c62-f29f-476a-41ca-08de7880e36b X-MS-Exchange-CrossTenant-AuthSource: LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2026 17:26:50.1221 (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: HPrwMC0b5ixqiY/y7BdiEs/1MF0Wa85A/vKMAota+8dn8DCzkzi5Fys6q6CqBayTmTEyI6Sg4WglZ2D+y92hYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LOYP265MB1838 On Mon Mar 2, 2026 at 3:03 AM GMT, Alexandre Courbot wrote: > On Mon Mar 2, 2026 at 11:22 AM JST, Eliot Courtney wrote: >> On Sat Feb 28, 2026 at 3:11 PM JST, John Hubbard wrote: >>> On 2/26/26 7:50 AM, Eliot Courtney wrote: >>>> Add sync and async command queue API and the type infrastructure to kn= ow >>>> what reply is expected from each `CommandToGsp`. >>>>=20 >>>> Use a marker type `NoReply` which does not implement `MessageFromGsp` = to >>>> mark async commands which don't expect a response. >>>>=20 >>> ... >>>> + /// Type of the reply expected from the GSP, or [`NoReply`] for a= sync commands. >>> >>> Hi Eliot, >>> >>> The following does not need to hold up your patchset, but I want >>> to bring it up somewhere just to work through it. >>> >>> The sync/async naming that GSP RM uses is a little bit "off". I >>> spent some time discussing it with them, and the problem is that >>> sync/async is a concept that is somewhat independent of whether >>> a reply is expected. Usually, sync means a blocking wait for a >>> response, which is not necessarily required in all case with >>> GSP RM calls. >>> >>> The naming would be better here if it reflected simply that >>> a response is expected, or not. I don't have great names for >>> that, but "fire and forget" works well for what we have so >>> far called "async". So we could do create a convention in which >>> no annotation means that the API has a response that will come >>> back, and some abbreviated for of "fire and forget" or "one way" >>> added to the function name would mean that no response is >>> expected. >>> >>> Again, I don't think this has to happen here, because we can >>> go through and rename later, no problem there. But when I saw >>> the sync/asynch and remembered the very recent discussion, I >>> figured I'd better post something about it. >>> >>> And yes, I started us off in the wrong direction with the >>> IS_ASYNCH thing! haha >>> >>> thanks, >> >> Hi John, >> >> I totally agree and was hoping that someone would have a good suggestion >> for this. I discussed this exact thing with Alex before posting this >> too. So if you have any naming suggestions would love to hear them. >> >> As you say, sync and async are orthogonal to reply vs no reply. I think >> we have several ideas here actually: >> - blocking vs non-blocking >> - reply vs no-reply >> - wait for reply vs don't wait for reply (practically equivalent to >> blocking vs non-blocking here, but conceptually the send could also be >> blocking vs non-blocking) >> >> We should also be careful with conflating waiting for the reply vs not >> having a reply. So `send_without_waiting_for_reply` is definitely >> confusing to me, because there may be a reply that we just don't wait >> for. >> >> Some ideas: >> - send_command_with_reply + send_command_without_reply >> - Maybe non-obvious that this blocks for send_command_with_reply. >> - send_and_wait_for_reply + send_no_reply >> - More obvious that it blocks and gets the reply. >> - Should be obvious from context that you are sending a command >> anyway. >> >> Personally I think it's nice to keep a convention of keeping it >> mostly obvious which functions block/wait. (e.g. we already have >> wait_for_msg in cmdq.rs). >> >> For lack of a better idea i suggest send_and_wait_for_reply + >> send_no_reply for now. > > One important detail IMHO is that the API cannot be misused, i.e. you > cannot call the fire-and-forget send method on a command that expects a > reply. So the risk is mostly when adding support for a new command - but > if that step is done properly, users will be directed to the right > method by the compiler. > > This, I think, allows us to tolerate more ambiguity in the method names, > as long as their documentation makes up for it. We all agree that > `async` and `sync` are not a good fit, but `send`/`send_noreply` should > be tolerable (I'd like to keep the names short if possible) > > Or maybe we can use a variant of the trick mentioned by Gary in [1] and > have a single `send_command` method? I think for this particular use case there isn't even a need to use any tri= cks? You can simply just skip the receiving part when there's no reply expected. Something like if TypeId::of::() =3D=3D TypeId::of::() { // SAFETY: `M::Reply` is `NoReply` and it's `Copy`. return Ok(unsafe { core::mem::transmute_copy(&NoReply) }); } Best, Gary > > [1] https://lore.kernel.org/all/DGRJJA3068FV.3CE7J7SKLTN8O@garyguo.net/