Thanks, Feng Li
Gerd Hoffmann kraxel@redhat.com 于2021年8月31日周二 下午8:59写道:
On Tue, Aug 31, 2021 at 08:23:39PM +0800, Li Feng wrote:
Currently, virtio-scsi doesn't support any control or event message, this patch adds the basic initialization.
Some backends need this feature, like dpdk/spdk vhost-user backend.
Reproduce:
- Start spdk vhost-user-scsi backend;
- Create a vm with a SCSI vhost-user-scsi disk and start the vm;
- Mount an iso to the vm without an OS;
- Stop the vhost-user-scsi backend;
- Vhost-user-scsi backend will crash before exiting when cleaning the resources.
IMHO this must be fixed in vhost-user-scsi no matter what. Host processes crashing in case the guest doesn't behave as expected is a security problem.
Yes, the backend should be fixed. However, we may as well initialize these two vqs, because other virtio frontend drivers have implemented these as I know. It's good for compatibility.
The reason is that the seabios virtio-scsi only initializes the req vq, then the spdk/dpdk treats it a not good session, it's hard to handle this tricky issue from dpdk architecture.
What is the exact problem here? vhost-user-scsi trying to send a hotplug event (when adding the iso, probably as virtual cdrom) and seabios not listening?
No, hotplug is another question I should handle. This crash is that some vring(controlq, eventq) aren't initialized done from vhost-user aspect. And spdk/dpdk handles incoming events from theses queues, but the vhost-user device isn't RUNNING status, becase some vqs are not ready, so the destruction is bad.
- if (vp_find_vq(vp, 1, &vq) < 0 ) {
dprintf(1, "fail to find event vq for virtio-scsi %pP\n", pci);
goto fail;
- }
That alone doesn't allow receiving events (no recv buffers added). Also note that seabios does not support hotplugging devices, so the only thing we could do with those events is to throw them away.
Yes, from the spec, I should put some recv buffers here, so events could be written here. Here just initialized it, then qemu vhost-user device will send the VHOST_USER_KICK to drive the vhost-user backend.
BTW, do you accept a future patch that implements the virtio SCSI hotplug?
Thanks.
take care, Gerd