search for: vhost_get_avail_size

Displaying 20 results from an estimated 36 matches for "vhost_get_avail_size".

2019 Mar 06
1
[RFC PATCH V2 4/5] vhost: introduce helpers to get the size of metadata area
...vhost/vhost.c b/drivers/vhost/vhost.c > index 2025543..1015464 100644 > --- a/drivers/vhost/vhost.c > +++ b/drivers/vhost/vhost.c > @@ -413,6 +413,27 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev) > vhost_vq_free_iovecs(dev->vqs[i]); > } > > +static size_t vhost_get_avail_size(struct vhost_virtqueue *vq, int num) Nit: Any reason not to make `num` unsigned or size_t? > +{ > + size_t event = vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX) ? 2 : 0; > + > + return sizeof(*vq->avail) + > + sizeof(*vq->avail->ring) * num + event; > +} > +...
2019 Mar 06
1
[RFC PATCH V2 4/5] vhost: introduce helpers to get the size of metadata area
...vhost/vhost.c b/drivers/vhost/vhost.c > index 2025543..1015464 100644 > --- a/drivers/vhost/vhost.c > +++ b/drivers/vhost/vhost.c > @@ -413,6 +413,27 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev) > vhost_vq_free_iovecs(dev->vqs[i]); > } > > +static size_t vhost_get_avail_size(struct vhost_virtqueue *vq, int num) Nit: Any reason not to make `num` unsigned or size_t? > +{ > + size_t event = vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX) ? 2 : 0; > + > + return sizeof(*vq->avail) + > + sizeof(*vq->avail->ring) * num + event; > +} > +...
2019 Mar 06
0
[RFC PATCH V2 4/5] vhost: introduce helpers to get the size of metadata area
...8 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 2025543..1015464 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -413,6 +413,27 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev) vhost_vq_free_iovecs(dev->vqs[i]); } +static size_t vhost_get_avail_size(struct vhost_virtqueue *vq, int num) +{ + size_t event = vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX) ? 2 : 0; + + return sizeof(*vq->avail) + + sizeof(*vq->avail->ring) * num + event; +} + +static size_t vhost_get_used_size(struct vhost_virtqueue *vq, int num) +{ + size_t event =...
2019 Mar 07
0
[RFC PATCH V2 4/5] vhost: introduce helpers to get the size of metadata area
...ndex 2025543..1015464 100644 >> --- a/drivers/vhost/vhost.c >> +++ b/drivers/vhost/vhost.c >> @@ -413,6 +413,27 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev) >> vhost_vq_free_iovecs(dev->vqs[i]); >> } >> >> +static size_t vhost_get_avail_size(struct vhost_virtqueue *vq, int num) >> +{ >> + size_t event = vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX) ? 2 : 0; >> + >> + return sizeof(*vq->avail) + >> + sizeof(*vq->avail->ring) * num + event; >> +} >> + >> +...
2019 Sep 17
0
[RFC v4 3/3] vhost: introduce mdev based hardware backend
..._get_desc_size(vq, vq->num), + &addr)) + return -EINVAL; + + virtio_mdev_writel(mdev, VIRTIO_MDEV_QUEUE_DESC_LOW, addr); + virtio_mdev_writel(mdev, VIRTIO_MDEV_QUEUE_DESC_HIGH, + (addr >> 32)); + + if (!vhost_translate_ring_addr(vq, (u64)vq->avail, + vhost_get_avail_size(vq, vq->num), + &addr)) + return -EINVAL; + + virtio_mdev_writel(mdev, VIRTIO_MDEV_QUEUE_AVAIL_LOW, addr); + virtio_mdev_writel(mdev, VIRTIO_MDEV_QUEUE_AVAIL_HIGH, + (addr >> 32)); + + if (!vhost_translate_ring_addr(vq, (u64)vq->used, + vhost_get_use...
2019 Sep 17
1
[RFC v4 3/3] vhost: introduce mdev based hardware backend
...eady an IOVA that has been map by VFIO. > + > + virtio_mdev_writel(mdev, VIRTIO_MDEV_QUEUE_DESC_LOW, addr); > + virtio_mdev_writel(mdev, VIRTIO_MDEV_QUEUE_DESC_HIGH, > + (addr >> 32)); > + > + if (!vhost_translate_ring_addr(vq, (u64)vq->avail, > + vhost_get_avail_size(vq, vq->num), > + &addr)) > + return -EINVAL; > + > + virtio_mdev_writel(mdev, VIRTIO_MDEV_QUEUE_AVAIL_LOW, addr); > + virtio_mdev_writel(mdev, VIRTIO_MDEV_QUEUE_AVAIL_HIGH, > + (addr >> 32)); > + > + if (!vhost_translate_ring_addr(vq, (u64...
2019 Sep 17
7
[RFC v4 0/3] vhost: introduce mdev based hardware backend
This RFC is to demonstrate below ideas, a) Build vhost-mdev on top of the same abstraction defined in the virtio-mdev series [1]; b) Introduce /dev/vhost-mdev to do vhost ioctls and support setting mdev device as backend; Now the userspace API looks like this: - Userspace generates a compatible mdev device; - Userspace opens this mdev device with VFIO API (including doing IOMMU
2019 Sep 17
7
[RFC v4 0/3] vhost: introduce mdev based hardware backend
This RFC is to demonstrate below ideas, a) Build vhost-mdev on top of the same abstraction defined in the virtio-mdev series [1]; b) Introduce /dev/vhost-mdev to do vhost ioctls and support setting mdev device as backend; Now the userspace API looks like this: - Userspace generates a compatible mdev device; - Userspace opens this mdev device with VFIO API (including doing IOMMU
2019 Mar 06
12
[RFC PATCH V2 0/5] vhost: accelerate metadata access through vmap()
This series tries to access virtqueue metadata through kernel virtual address instead of copy_user() friends since they had too much overheads like checks, spec barriers or even hardware feature toggling. This is done through setup kernel address through vmap() and resigter MMU notifier for invalidation. Test shows about 24% improvement on TX PPS. TCP_STREAM doesn't see obvious improvement.
2019 Mar 06
12
[RFC PATCH V2 0/5] vhost: accelerate metadata access through vmap()
This series tries to access virtqueue metadata through kernel virtual address instead of copy_user() friends since they had too much overheads like checks, spec barriers or even hardware feature toggling. This is done through setup kernel address through vmap() and resigter MMU notifier for invalidation. Test shows about 24% improvement on TX PPS. TCP_STREAM doesn't see obvious improvement.
2018 Dec 29
12
[RFC PATCH V3 0/5] Hi:
This series tries to access virtqueue metadata through kernel virtual address instead of copy_user() friends since they had too much overheads like checks, spec barriers or even hardware feature toggling. Test shows about 24% improvement on TX PPS. It should benefit other cases as well. Changes from V2: - fix buggy range overlapping check - tear down MMU notifier during vhost ioctl to make sure
2018 Dec 29
12
[RFC PATCH V3 0/5] Hi:
This series tries to access virtqueue metadata through kernel virtual address instead of copy_user() friends since they had too much overheads like checks, spec barriers or even hardware feature toggling. Test shows about 24% improvement on TX PPS. It should benefit other cases as well. Changes from V2: - fix buggy range overlapping check - tear down MMU notifier during vhost ioctl to make sure
2019 Jan 04
1
[RFC PATCH V3 5/5] vhost: access vq metadata through kernel virtual address
...f(mn, struct vhost_dev, > + mmu_notifier); > + int i; > + > + for (i = 0; i < dev->nvqs; i++) { > + struct vhost_virtqueue *vq = dev->vqs[i]; > + > + if (vhost_invalidate_vmap(vq, &vq->avail_ring, > + (unsigned long)vq->avail, > + vhost_get_avail_size(vq, vq->num), > + start, end, blockable)) > + return -EAGAIN; > + if (vhost_invalidate_vmap(vq, &vq->desc_ring, > + (unsigned long)vq->desc, > + vhost_get_desc_size(vq, vq->num), > + start, end, blockable)) > + return -EAGAIN; > +...
2019 Mar 07
0
[RFC PATCH V2 4/5] vhost: introduce helpers to get the size of metadata area
...host.c >> index 2025543..1015464 100644 >> --- a/drivers/vhost/vhost.c >> +++ b/drivers/vhost/vhost.c >> @@ -413,6 +413,27 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev) >> vhost_vq_free_iovecs(dev->vqs[i]); >> } >> >> +static size_t vhost_get_avail_size(struct vhost_virtqueue *vq, int num) > Nit: Any reason not to make `num` unsigned or size_t? > Let me use unsigned int to match the definition of vq->num. Thanks
2018 Dec 29
0
[RFC PATCH V3 5/5] vhost: access vq metadata through kernel virtual address
...ble) +{ + struct vhost_dev *dev = container_of(mn, struct vhost_dev, + mmu_notifier); + int i; + + for (i = 0; i < dev->nvqs; i++) { + struct vhost_virtqueue *vq = dev->vqs[i]; + + if (vhost_invalidate_vmap(vq, &vq->avail_ring, + (unsigned long)vq->avail, + vhost_get_avail_size(vq, vq->num), + start, end, blockable)) + return -EAGAIN; + if (vhost_invalidate_vmap(vq, &vq->desc_ring, + (unsigned long)vq->desc, + vhost_get_desc_size(vq, vq->num), + start, end, blockable)) + return -EAGAIN; + if (vhost_invalidate_vmap(vq, &vq-...
2019 Mar 06
0
[RFC PATCH V2 5/5] vhost: access vq metadata through kernel virtual address
...vhost_invalidate(struct vhost_dev *dev, + unsigned long start, unsigned long end) +{ + int i; + + for (i = 0; i < dev->nvqs; i++) { + struct vhost_virtqueue *vq = dev->vqs[i]; + + vhost_invalidate_vmap(vq, &vq->avail_ring, + (unsigned long)vq->avail, + vhost_get_avail_size(vq, vq->num), + start, end); + vhost_invalidate_vmap(vq, &vq->desc_ring, + (unsigned long)vq->desc, + vhost_get_desc_size(vq, vq->num), + start, end); + vhost_invalidate_vmap(vq, &vq->used_ring, + (unsigned long)vq->used, +...
2019 Apr 23
7
[RFC PATCH V3 0/6] vhost: accelerate metadata access
This series tries to access virtqueue metadata through kernel virtual address instead of copy_user() friends since they had too much overheads like checks, spec barriers or even hardware feature toggling. This is done through setup kernel address through direct mapping and co-opreate VM management with MMU notifiers. Test shows about 23% improvement on TX PPS. TCP_STREAM doesn't see obvious
2019 Mar 06
2
[RFC PATCH V2 5/5] vhost: access vq metadata through kernel virtual address
...unsigned long start, unsigned long end) > +{ > + int i; > + > + for (i = 0; i < dev->nvqs; i++) { > + struct vhost_virtqueue *vq = dev->vqs[i]; > + > + vhost_invalidate_vmap(vq, &vq->avail_ring, > + (unsigned long)vq->avail, > + vhost_get_avail_size(vq, vq->num), > + start, end); > + vhost_invalidate_vmap(vq, &vq->desc_ring, > + (unsigned long)vq->desc, > + vhost_get_desc_size(vq, vq->num), > + start, end); > + vhost_invalidate_vmap(vq, &vq->used_ring, > +...
2019 Mar 06
2
[RFC PATCH V2 5/5] vhost: access vq metadata through kernel virtual address
...unsigned long start, unsigned long end) > +{ > + int i; > + > + for (i = 0; i < dev->nvqs; i++) { > + struct vhost_virtqueue *vq = dev->vqs[i]; > + > + vhost_invalidate_vmap(vq, &vq->avail_ring, > + (unsigned long)vq->avail, > + vhost_get_avail_size(vq, vq->num), > + start, end); > + vhost_invalidate_vmap(vq, &vq->desc_ring, > + (unsigned long)vq->desc, > + vhost_get_desc_size(vq, vq->num), > + start, end); > + vhost_invalidate_vmap(vq, &vq->used_ring, > +...
2019 May 24
10
[PATCH net-next 0/6] vhost: accelerate metadata access
Hi: This series tries to access virtqueue metadata through kernel virtual address instead of copy_user() friends since they had too much overheads like checks, spec barriers or even hardware feature toggling like SMAP. This is done through setup kernel address through direct mapping and co-opreate VM management with MMU notifiers. Test shows about 23% improvement on TX PPS. TCP_STREAM