History

Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

Pull virtio updates from Michael Tsirkin: - resume support in vdpa/solidrun - structure size optimizations in virtio_pci - new pds_vdpa driver - immediate initialization mechanism for vdpa/ifcvf - interrupt bypass for vdpa/mlx5 - multiple worker support for vhost - viirtio net in Intel F2000X-PL support for vdpa/ifcvf - fixes, cleanups all over the place * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (48 commits) vhost: Make parameter name match of vhost_get_vq_desc() vduse: fix NULL pointer dereference vhost: Allow worker switching while work is queueing vhost_scsi: add support for worker ioctls vhost: allow userspace to create workers vhost: replace single worker pointer with xarray vhost: add helper to parse userspace vring state/file vhost: remove vhost_work_queue vhost_scsi: flush IO vqs then send TMF rsp vhost_scsi: convert to vhost_vq_work_queue vhost_scsi: make SCSI cmd completion per vq vhost_sock: convert to vhost_vq_work_queue vhost: convert poll work to be vq based vhost: take worker or vq for flushing vhost: take worker or vq instead of dev for queueing vhost, vhost_net: add helper to check if vq has work vhost: add vhost_worker pointer to vhost_virtqueue vhost: dynamically allocate vhost_worker vhost: create worker at end of vhost_dev_set_owner virtio_bt: call scheduler when we free unused buffs ...

Linus Torvalds committed 3 years ago

Commit a8d70602 parents e8069f5 9e396a242 files · +2767 −348Browse files

Showing the changes to include/uapi/linux (2 of 42 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/vhost.h +31 −0
  2. include/uapi/linux/vhost_types.h +16 −0
include/uapi/linux/vhost.h+31−0
@@ -45,6 +45,25 @@ · 44 unmodified lines
4545 #define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64)
4646 /* Specify an eventfd file descriptor to signal on log write. */
4747 #define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int)
48+/* By default, a device gets one vhost_worker that its virtqueues share. This
49+ * command allows the owner of the device to create an additional vhost_worker
50+ * for the device. It can later be bound to 1 or more of its virtqueues using
51+ * the VHOST_ATTACH_VRING_WORKER command.
52+ *
53+ * This must be called after VHOST_SET_OWNER and the caller must be the owner
54+ * of the device. The new thread will inherit caller's cgroups and namespaces,
55+ * and will share the caller's memory space. The new thread will also be
56+ * counted against the caller's RLIMIT_NPROC value.
57+ *
58+ * The worker's ID used in other commands will be returned in
59+ * vhost_worker_state.
60+ */
61+#define VHOST_NEW_WORKER _IOR(VHOST_VIRTIO, 0x8, struct vhost_worker_state)
62+/* Free a worker created with VHOST_NEW_WORKER if it's not attached to any
63+ * virtqueue. If userspace is not able to call this for workers its created,
64+ * the kernel will free all the device's workers when the device is closed.
65+ */
66+#define VHOST_FREE_WORKER _IOW(VHOST_VIRTIO, 0x9, struct vhost_worker_state)
4867
4968 /* Ring setup. */
5069 /* Set number of descriptors in ring. This parameter can not
@@ -70,6 +89,18 @@ · 19 unmodified lines
7089 #define VHOST_VRING_BIG_ENDIAN 1
7190 #define VHOST_SET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x13, struct vhost_vring_state)
7291 #define VHOST_GET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x14, struct vhost_vring_state)
92+/* Attach a vhost_worker created with VHOST_NEW_WORKER to one of the device's
93+ * virtqueues.
94+ *
95+ * This will replace the virtqueue's existing worker. If the replaced worker
96+ * is no longer attached to any virtqueues, it can be freed with
97+ * VHOST_FREE_WORKER.
98+ */
99+#define VHOST_ATTACH_VRING_WORKER _IOW(VHOST_VIRTIO, 0x15, \
100+ struct vhost_vring_worker)
101+/* Return the vring worker's ID */
102+#define VHOST_GET_VRING_WORKER _IOWR(VHOST_VIRTIO, 0x16, \
103+ struct vhost_vring_worker)
73104
74105 /* The following ioctls use eventfd file descriptors to signal and poll
75106 * for events. */
include/uapi/linux/vhost_types.h+16−0
@@ -47,6 +47,22 @@ struct vhost_vring_addr { · 46 unmodified lines
4747 __u64 log_guest_addr;
4848 };
4949
50+struct vhost_worker_state {
51+ /*
52+ * For VHOST_NEW_WORKER the kernel will return the new vhost_worker id.
53+ * For VHOST_FREE_WORKER this must be set to the id of the vhost_worker
54+ * to free.
55+ */
56+ unsigned int worker_id;
57+};
58+
59+struct vhost_vring_worker {
60+ /* vring index */
61+ unsigned int index;
62+ /* The id of the vhost_worker returned from VHOST_NEW_WORKER */
63+ unsigned int worker_id;
64+};
65+
5066 /* no alignment requirement */
5167 struct vhost_iotlb_msg {
5268 __u64 iova;