From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: gpu: nova-core: gsp: add sync and async command queue API to `Cmdq` Date: Fri, 27 Feb 2026 12:04:08 +1000 Message-ID: In-Reply-To: <20260226-cmdq-locking-v2-2-c7e16a6d5885@nvidia.com> References: <20260226-cmdq-locking-v2-0-c7e16a6d5885@nvidia.com> <20260226-cmdq-locking-v2-2-c7e16a6d5885@nvidia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Status: Looks good, minor observations** This patch adds the type infrastructure for distinguishing sync vs async co= mmands. The `NoReply` marker type is simple and effective: ```rust +pub(crate) struct NoReply; ``` Not implementing `MessageFromGsp` means `send_sync_command` cannot accident= ally be called with an async command =E2=80=94 this is enforced at compile = time via the `M::Reply: MessageFromGsp` bound. The `Reply` associated type on `CommandToGsp`: ```rust + /// Type of the reply expected from the GSP, or [`NoReply`] for async = commands. + type Reply; ``` This is cleaner than a boolean `IS_ASYNC` constant since it carries the rep= ly type information that `send_sync_command` needs. The `send_sync_command` implementation: ```rust + pub(crate) fn send_sync_command(&mut self, bar: &Bar0, command: M) = -> Result + where + M: CommandToGsp, + M::Reply: MessageFromGsp, + ... + { + self.send_command(bar, command)?; + loop { + match self.receive_msg::(Delta::from_secs(10)) { + Ok(reply) =3D> break Ok(reply), + Err(ERANGE) =3D> continue, + Err(e) =3D> break Err(e), + } + } + } ``` **Observation:** The `ERANGE` loop retries with a fresh 10-second timeout e= ach iteration. If the GSP keeps sending non-matching messages (e.g. asynchr= onous notifications), this could loop for a very long time. Currently this = is likely fine since the cover letter says "we expect GSP to be fast," but = a comment noting this assumption or an overall retry limit would be defensi= ve. This is a pre-existing pattern from `get_gsp_info()` which this patch c= onsolidates =E2=80=94 so it's not a regression. The `send_async_command` properly constrains `Reply =3D NoReply`: ```rust + pub(crate) fn send_async_command(&mut self, bar: &Bar0, command: M)= -> Result + where + M: CommandToGsp, ``` Making `send_command` private (`fn` instead of `pub(crate) fn`) is correct = =E2=80=94 callers should now go through the sync/async variants. The migration of `get_gsp_info` from a manual send+receive loop to a single= `send_sync_command` call is a nice cleanup: ```rust - cmdq.send_command(bar, GetGspStaticInfo)?; - loop { - match cmdq.receive_msg::(Delta::from_secs(5= )) { - ... - } - } + cmdq.send_sync_command(bar, GetGspStaticInfo) ``` **Note:** The old code used a 5-second timeout; the new `send_sync_command`= uses 10 seconds. This is a behavior change (doubled timeout) though likely= intentional. The `SplitCommand` correctly propagates the `Reply` type: ```rust + type Reply =3D C::Reply; ``` All command types are properly annotated. This patch is solid. --- --- Generated by Claude Code Patch Reviewer