Displaying 4 results from an estimated 4 matches for "vhost_new_worker".
2023 Mar 28
1
[PATCH v6 11/11] vhost: allow userspace to create workers
...ed long i;
+
+ if (!dev->use_worker)
+ return;
+
+ for (i = 0; i < dev->nvqs; i++)
+ vhost_vq_detach_worker(dev->vqs[i]);
+ /*
+ * Drop the refcount taken during allocation, and handle the default
+ * worker and the cases where userspace might have crashed or was lazy
+ * and did a VHOST_NEW_WORKER but not a VHOST_FREE_WORKER.
+ */
+ xa_for_each(&dev->worker_xa, i, worker) {
+ xa_erase(&dev->worker_xa, worker->id);
+ vhost_worker_put(dev, worker);
+ }
+ xa_destroy(&dev->worker_xa);
+}
+
static struct vhost_worker *vhost_worker_create(struct vhost_dev *dev)
{
str...
2023 Apr 10
1
[PATCH v6 11/11] vhost: allow userspace to create workers
...T);
> >
> > So we use int for worker_id which conflicts with UINT_MAX here?
>
> I switched from idr in the last versions to xa last second and added this mistake.
> Will fix.
>
>
> >
> > struct vhost_worker_state {
> > /*
> > * For VHOST_NEW_WORKER the kernel will return the new vhost_worker id.
> > * For VHOST_FREE_WORKER this must be set to the id of the vhost_worker
> > * to free.
> > */
> > int worker_id;
> > };
> >
> > A side effect of using xa_index directly is...
2023 Apr 12
1
[PATCH v6 11/11] vhost: allow userspace to create workers
...>> I didn't understand the question.
> >
> > I mean if I understand the code correctly, the code tries to drop
> > refcnt and free the old worker during attach.
>
> I see. We actually don't free until VHOST_FREE_WORKER.
>
> When we create the worker from VHOST_NEW_WORKER we set the refcount
> to 1. Then each time a virtqueue and worker are attached to each other
> we increase the refcount.
>
> When you do vhost_vq_detach_worker then it drops the refcount from the
> attach. Then if you detached the worker from all the virtqueues you
> still have th...
2023 Mar 28
12
[PATCH v6 00/11] vhost: multiple worker support
The following patches were built over linux-next which contains various
vhost patches in mst's tree and the vhost_task patchset in Christian
Brauner's tree:
git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
kernel.user_worker branch:
https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/log/?h=kernel.user_worker
The latter patchset handles the review comment