On Tue Mar 3, 2026 at 12:07 PM JST, Eliot Courtney wrote: > On Mon Mar 2, 2026 at 11:18 PM JST, Gary Guo wrote: >> On Mon Mar 2, 2026 at 11:42 AM GMT, Eliot Courtney wrote: >>> Add a timeout to `allocate_command` which waits for space on the GSP >>> command queue. It uses a similar timeout to nouveau. >>> >>> This lets `send_command` wait for space to free up in the command queue. >>> This is required to support continuation records which can fill up the >>> queue. >> >> Any reason that this isn't implemented as a `poll_allocate_command` which >> just >> returns a `EAGAIN`, and then a wrapper function that just waits for space to >> be >> ready when it got one? This way the logic is cleaner. > > This kind of structure is what I originally did (see > https://lore.kernel.org/all/[email protected]/) > although it wasn't quite as nice since `allocate_command` takes > &mut self and isn't callable from `read_poll_timeout`. Alex suggested > merging these into one as it simplifies a few things. But maybe I am > missing some better way to do it.
The rationale for this is that we don't have a case for polling for command queue availability - the GSP is expected to consume all the data sent to it rapidly, so we have a soft guarantee that the queue will be ready soon. We also don't have a case for doing something else until the queue is ready, AFAICT. The current form is simpler code-wise, and if we ever need to break it into two poll and wait methods, we can do it trivially when the need arises.
