On Wed Mar 4, 2026 at 11:46 AM JST, Eliot Courtney wrote: > Add locking to Cmdq. This is required e.g. for unloading the driver, > which needs to send the UnloadingGuestDriver via the command queue > on unbind which may be on a different thread. > > We have commands that need a reply and commands that don't. For > commands with a reply we want to make sure that they don't get > the reply of a different command back. The approach this patch series > takes is by making those commands block until they get a response. For > now this should be ok, and we expect GSP to be fast anyway. > > To do this, we need to know which commands expect a reply and which > don't. John's existing series[1] adds IS_ASYNC which solves part of the > problem, but we need to know a bit more. So instead, add an > associated type called Reply which tells us what the reply is. > > An alternative would be to define traits inheriting CommandToGsp, e.g. > CommandWithReply and CommandWithoutReply, instead of using the > associated type. I implemented the associated type version because it > feels more compositional rather than inherity so seemed a bit better > to me. But both of these approaches work and are fine, IMO.
The associated type seems to work just fine. I was wondering whether we could mess with it by using other types that do not implement `MessageFromGsp`, but in that case we cannot call any of the `send_command` methods so this approach looks good to me.
