Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] gpu: nova-core: non-yielding 15s udelay busy-wait polling
  GspInit completion
--

commit d8fe3c10d1e002df6f79291965859f48b65d0fb0
Author: John Hubbard <[email protected]>

gpu: nova-core: gsp: add the GSP_INIT command and its reply

This commit adds the GMC GSP_INIT command, which encodes system
information and registry keys into an NVKV payload for GSP-RM, and
decodes the NVKV reply into GspStaticInfo.

> diff --git a/drivers/gpu/nova-core/gsp/commands/gmc.rs 
> b/drivers/gpu/nova-core/gsp/commands/gmc.rs
> new file mode 100644
> index 0000000000000..f74ada78f7ace
> --- /dev/null
> +++ b/drivers/gpu/nova-core/gsp/commands/gmc.rs
> @@ -0,0 +1,133 @@

[ ... ]

> +impl CommandToGsp for GspInit {
> +    const COMMAND: GmcCommandId = GmcCommandId::GspInit;
> +    /// Largest reply that the driver accepts, in bytes.
> +    const MAX_REPLY_SIZE: u32 = 48 * 1024;
> +    /// `GspInit` can take longer than 5 seconds to complete on some SKUs.
> +    const COMPLETION_TIMEOUT: Delta = Delta::from_secs(15);

[Severity: Medium]
Can waiting up to 15 seconds for GspInit spin a CPU in a non-yielding
udelay() loop?

CmdqInner::await_gmc_reply() passes COMPLETION_TIMEOUT down to
CmdqInner::wait_for_msg(), which polls via read_poll_timeout() with
Delta::from_micros(1).  fsleep() turns delays <= 10 us into udelay(),
and read_poll_timeout() does not call cond_resched() inside the loop.

On slower SKUs where GspInit takes more than 5 seconds (or if GSP-RM
stalls until timeout), a CONFIG_PREEMPT_NONE or CONFIG_PREEMPT_VOLUNTARY
kernel will monopolize a CPU for the entire wait, starving runnable tasks
and delaying RCU quiescent states.

Using a sleep delta above 10 us in CmdqInner::wait_for_msg(), or letting
long-running commands like GspInit select a sleeping poll interval, would
avoid spinning the CPU during this wait.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to