Thread (1 message) 1 message, 1 author, 2020-12-04

Re: [RFC PATCH 5/8] vhost: allow userspace to bind vqs to CPUs

flat view

From: Jason Wang <hidden>
Date: 2020-12-04 08:11:15
Also in: linux-scsi, target-devel

On 2020/12/4 下午3:56, Mike Christie wrote:
quoted hunk
+static long vhost_vring_set_cpu(struct vhost_dev *d, struct vhost_virtqueue *vq,
+				void __user *argp)
+{
+	struct vhost_vring_state s;
+	int ret = 0;
+
+	if (vq->private_data)
+		return -EBUSY;
+
+	if (copy_from_user(&s, argp, sizeof s))
+		return -EFAULT;
+
+	if (s.num == -1) {
+		vq->cpu = s.num;
+		return 0;
+	}
+
+	if (s.num >= nr_cpu_ids)
+		return -EINVAL;
+
+	if (!d->ops || !d->ops->get_workqueue)
+		return -EINVAL;
+
+	if (!d->wq)
+		d->wq = d->ops->get_workqueue();
+	if (!d->wq)
+		return -EINVAL;
+
+	vq->cpu = s.num;
+	return ret;
+}

So one question here. Who is in charge of doing this set_cpu? Note that sched_setaffinity(2) requires CAP_SYS_NICE to work, so I wonder whether or not it's legal for unprivileged Qemu to do this.

Thanks


_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help