vhost: multiple worker support

Stefan Hajnoczi
Thu, 03 Jun 2021 14:37:37 -0000

On Tue, May 25, 2021 at 01:05:51PM -0500, Mike Christie
wrote:
> The following patches apply over linus's tree or mst's vhost branch
> and my cleanup patchset:
>
>
https://lists.linuxfoundation.org/pipermail/virtualization/2021-May/054354.html
>
> These patches allow us to support multiple vhost workers per device. I
> ended up just doing Stefan's original idea where userspace has the
> kernel create a worker and we pass back the pid. This has the benefit
> over the workqueue and userspace thread approach where we only have
> one'ish code path in the kernel during setup to detect old tools. The
> main IO paths and device/vq setup/teardown paths all use common code.
>
> The kernel patches here allow us to then do N workers device and also
> share workers across devices.
>
> I've also included a patch for qemu so you can get an idea of how it
> works. If we are ok with the kernel code then I'll break that up into
> a patchset and send to qemu-devel.

It seems risky to allow userspace process A to "share" a vhost worker
thread with userspace process B based on a matching pid alone. Should
they have ptrace_may_access() or similar?

For example, two competing users could sabotague each other by running
lots of work items on their competitor's vhost worker thread.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20210603/00927312/attachment.sig>