On Wed, Feb 1, 2023 at 2:56 PM Eugenio Perez Martin <epere...@redhat.com> wrote: > > On Wed, Feb 1, 2023 at 4:27 AM Jason Wang <jasow...@redhat.com> wrote: > > > > On Wed, Feb 1, 2023 at 3:10 AM Eugenio Perez Martin <epere...@redhat.com> > > wrote: > > > > > > Hi, > > > > > > The current approach of offering an emulated CVQ to the guest and map > > > the commands to vhost-user is not scaling well: > > > * Some devices already offer it, so the transformation is redundant. > > > * There is no support for commands with variable length (RSS?) > > > > > > We can solve both of them by offering it through vhost-user the same > > > way as vhost-vdpa do. With this approach qemu needs to track the > > > commands, for similar reasons as vhost-vdpa: qemu needs to track the > > > device status for live migration. vhost-user should use the same SVQ > > > code for this, so we avoid duplications. > > > > Note that it really depends on the model we used. SVQ works well for > > trap and emulation (without new API to be invented). But if save and > > load API is invented, SVQ is not a must. > > > > That's right, but the premise in the proposal is that control vq RSS > messages are already complex enough to avoid adding more vhost-user > messages. I cannot imagine expanding the vhost-user or virtio API to > add the save and restore functions soon :).
Probably, but we know we need that some day. > > > > > > > One of the challenges here is to know what virtqueue to shadow / > > > isolate. The vhost-user device may not have the same queues as the > > > device frontend: > > > * The first depends on the actual vhost-user device, and qemu fetches > > > it with VHOST_USER_GET_QUEUE_NUM at the moment. > > > * The qemu device frontend's is set by netdev queues= cmdline parameter > > > in qemu > > > > > > For the device, the CVQ is the last one it offers, but for the guest > > > it is the last one offered in config space. > > > > > > To create a new vhost-user command to decrease that maximum number of > > > queues may be an option. But we can do it without adding more > > > commands, remapping the CVQ index at virtqueue setup. I think it > > > should be doable using (struct vhost_dev).vq_index and maybe a few > > > adjustments here and there. > > > > It requires device specific knowledge, it might work for networking > > devices but not others (or need new codes). > > > > Yes, I didn't review all the other kinds of devices for the proposal, > but I'm assuming: > * There is no other device that has already implemented CVQ over > vhost-user (or this problems would have been solved) If I was not wrong, vhost-user protocol itself allows arbitrary types of virtqueue to be implemented on top. So it might just be an implementation issue. > * All vhost-user devices config space are already offered by qemu like > vhost-user net, and the cvq-alike index is well defined in the > standard like -net. > > So this proposal should fit all those devices, isn't it? If it could be done without extending vhost-user API, that would be fine. Thanks > > Thanks! >