Re: [PATCH V3 11/11] vhost: allow userspace to create workers
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: 2021-10-27 09:03:53
Also in:
linux-scsi, target-devel
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: 2021-10-27 09:03:53
Also in:
linux-scsi, target-devel
On Tue, Oct 26, 2021 at 11:49:37AM -0500, michael.christie@oracle.com wrote:
On 10/26/21 12:37 AM, Jason Wang wrote:quoted
Do we need VHOST_VRING_FREE_WORKER? And I wonder if using dedicated ioctls are better: VHOST_VRING_NEW/FREE_WORKER VHOST_VRING_ATTACH_WORKERWe didn't need a free worker, because the kernel handles it for userspace. I tried to make it easy for userspace because in some cases it may not be able to do syscalls like close on the device. For example if qemu crashes or for vhost-scsi we don't do an explicit close during VM shutdown. So we start off with the default worker thread that's used by all vqs like we do today. Userspace can then override it by creating a new worker. That also unbinds/ detaches the existing worker and does a put on the workers refcount. We also do a put on the worker when we stop using it during device shutdown/closure/release. When the worker's refcount goes to zero the kernel deletes it.
Please document the worker (p)id lifetime for the ioctl. Otherwise userspace doesn't know whether a previously created worker is still alive. SSTefan