search for: may_reduce_num

Displaying 20 results from an estimated 60 matches for "may_reduce_num".

2019 Apr 08
2
[PATCH] virtio: Honour 'may_reduce_num' in vring_create_virtqueue
vring_create_virtqueue() allows the caller to specify via the may_reduce_num parameter whether the vring code is allowed to allocate a smaller ring than specified. However, the split ring allocation code tries to allocate a smaller ring on allocation failure regardless of what the caller specified. This may cause trouble for e.g. virtio-pci in legacy mode, which does not s...
2019 Apr 08
1
[RFC PATCH 01/12] virtio/s390: use vring_create_virtqueue
...if (info->queue == NULL) { > - dev_warn(&vcdev->cdev->dev, "no queue\n"); > - err = -ENOMEM; > - goto out_err; > - } > + vq = vring_create_virtqueue(i, info->num, KVM_VIRTIO_CCW_RING_ALIGN, > + vdev, true, true, ctx, This second true means 'may_reduce_num'. Looking at the vring code, it seems that this parameter is never checked; the code will try to allocate a smaller queue if it can't get the requested size in any case... this will probably be a problem for legacy virtio-pci, which explicitly sets may_reduce_num to false. (I can try to com...
2019 Apr 10
0
[PULL] virtio: fixes
...de5d2e7775667cf191cf2f94327a4889f8b9d: Linux 5.1-rc4 (2019-04-07 14:09:59 -1000) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus for you to fetch changes up to cf94db21905333e610e479688add629397a4b384: virtio: Honour 'may_reduce_num' in vring_create_virtqueue (2019-04-08 17:05:52 -0400) ---------------------------------------------------------------- virtio: fixes, reviewers Several fixes, add more reviewers to the list Signed-off-by: Michael S. Tsirkin <mst at redhat.com> ----------------------------------------...
2016 Feb 02
1
[PATCH v6 6/9] virtio: Add improved queue allocation API
...> return &vq->vq; > } > +EXPORT_SYMBOL_GPL(__vring_new_virtqueue); > + > +struct virtqueue *vring_create_virtqueue( > + unsigned int index, > + unsigned int num, > + unsigned int vring_align, > + struct virtio_device *vdev, > + bool weak_barriers, > + bool may_reduce_num, > + bool (*notify)(struct virtqueue *), > + void (*callback)(struct virtqueue *), > + const char *name) > +{ > + struct virtqueue *vq; > + void *queue; > + dma_addr_t dma_addr; > + size_t queue_size_in_bytes; > + struct vring vring; > + > + /* We assume num is a po...
2016 Feb 02
1
[PATCH v6 6/9] virtio: Add improved queue allocation API
...> return &vq->vq; > } > +EXPORT_SYMBOL_GPL(__vring_new_virtqueue); > + > +struct virtqueue *vring_create_virtqueue( > + unsigned int index, > + unsigned int num, > + unsigned int vring_align, > + struct virtio_device *vdev, > + bool weak_barriers, > + bool may_reduce_num, > + bool (*notify)(struct virtqueue *), > + void (*callback)(struct virtqueue *), > + const char *name) > +{ > + struct virtqueue *vq; > + void *queue; > + dma_addr_t dma_addr; > + size_t queue_size_in_bytes; > + struct vring vring; > + > + /* We assume num is a po...
2023 May 26
1
[PATCH] virtio_ring: validate used buffer length
...} + static int vring_alloc_queue_split(struct vring_virtqueue_split *vring_split, struct virtio_device *vdev, u32 num, @@ -1137,7 +1172,19 @@ static int vring_alloc_queue_split(struct vring_virtqueue_split *vring_split, vring_split->vring_align = vring_align; vring_split->may_reduce_num = may_reduce_num; + if (vring_needs_used_validation(vdev)) { + vring_split->buflen = + kmalloc_array(num, sizeof(*vring_split->buflen), + GFP_KERNEL); + if (!vring_split->buflen) + goto err_buflen; + } + return 0; + +err_buflen: + vring_free_split(vring_split, vdev, dma_...
2016 Feb 01
0
[PATCH v6 6/9] virtio: Add improved queue allocation API
...te, 0, vring.num * sizeof(struct vring_desc_state)); return &vq->vq; } +EXPORT_SYMBOL_GPL(__vring_new_virtqueue); + +struct virtqueue *vring_create_virtqueue( + unsigned int index, + unsigned int num, + unsigned int vring_align, + struct virtio_device *vdev, + bool weak_barriers, + bool may_reduce_num, + bool (*notify)(struct virtqueue *), + void (*callback)(struct virtqueue *), + const char *name) +{ + struct virtqueue *vq; + void *queue; + dma_addr_t dma_addr; + size_t queue_size_in_bytes; + struct vring vring; + + /* We assume num is a power of 2. */ + if (num & (num - 1)) { + dev_warn(&...
2023 Apr 02
2
[PATCH] virtio-vdpa: add VIRTIO_F_NOTIFICATION_DATA feature support
...n't already be set up. */ if (ops->get_vq_ready(vdpa, index)) return ERR_PTR(-ENOENT); @@ -183,8 +200,7 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index, dma_dev = vdpa_get_dma_dev(vdpa); vq = vring_create_virtqueue_dma(index, max_num, align, vdev, true, may_reduce_num, ctx, - virtio_vdpa_notify, callback, - name, dma_dev); + notify, callback, name, dma_dev); if (!vq) { err = -ENOMEM; goto error_new_virtqueue; diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index 43f59ef10cc..a83bb0501c5 100644 --- a/include/linux/vdpa.h +++ b/include...
2023 May 31
1
[PATCH] virtio_ring: validate used buffer length
...u32 num, > > > > > > > @@ -1137,7 +1172,19 @@ static int vring_alloc_queue_split(struct vring_virtqueue_split *vring_split, > > > > > > > vring_split->vring_align = vring_align; > > > > > > > vring_split->may_reduce_num = may_reduce_num; > > > > > > > > > > > > > > + if (vring_needs_used_validation(vdev)) { > > > > > > > + vring_split->buflen = > > > > > > > + kmalloc_array(num, sizeof(*vring_...
2023 May 31
1
[PATCH] virtio_ring: validate used buffer length
...32 num, > > > > > > > > @@ -1137,7 +1172,19 @@ static int vring_alloc_queue_split(struct vring_virtqueue_split *vring_split, > > > > > > > > vring_split->vring_align = vring_align; > > > > > > > > vring_split->may_reduce_num = may_reduce_num; > > > > > > > > > > > > > > > > + if (vring_needs_used_validation(vdev)) { > > > > > > > > + vring_split->buflen = > > > > > > > > + kmalloc_array...
2023 Jun 01
1
[PATCH] virtio_ring: validate used buffer length
...32 num, > > > > > > > > @@ -1137,7 +1172,19 @@ static int vring_alloc_queue_split(struct vring_virtqueue_split *vring_split, > > > > > > > > vring_split->vring_align = vring_align; > > > > > > > > vring_split->may_reduce_num = may_reduce_num; > > > > > > > > > > > > > > > > + if (vring_needs_used_validation(vdev)) { > > > > > > > > + vring_split->buflen = > > > > > > > > + kmalloc_array...
2023 Jun 01
1
[PATCH] virtio_ring: validate used buffer length
...t; > > > > > > > @@ -1137,7 +1172,19 @@ static int vring_alloc_queue_split(struct vring_virtqueue_split *vring_split, > > > > > > > > > vring_split->vring_align = vring_align; > > > > > > > > > vring_split->may_reduce_num = may_reduce_num; > > > > > > > > > > > > > > > > > > + if (vring_needs_used_validation(vdev)) { > > > > > > > > > + vring_split->buflen = > > > > > > > > > +...
2018 Sep 12
1
[PATCH net-next v2 2/5] virtio_ring: support creating packed ring
...> > > > > > +union vring_union { > > > + struct vring vring_split; > > > + struct vring_packed vring_packed; > > > +}; > > > + > > > /* > > > * Creates a virtqueue and allocates the descriptor ring. If > > > * may_reduce_num is set, then this may allocate a smaller ring than > > > @@ -79,7 +84,8 @@ struct virtqueue *vring_create_virtqueue(unsigned int index, > > > > > > /* Creates a virtqueue with a custom layout. */ > > > struct virtqueue *__vring_new_virtqueue(unsigned int inde...
2020 Apr 06
0
[PATCH v4 05/12] virtio: stop using legacy struct vring in kernel
...tatic inline void virtio_store_mb(bool weak_barriers, struct virtio_device; struct virtqueue; +struct vring { + unsigned int num; + + struct vring_desc *desc; + + struct vring_avail *avail; + + struct vring_used *used; +}; + /* * Creates a virtqueue and allocates the descriptor ring. If * may_reduce_num is set, then this may allocate a smaller ring than diff --git a/include/linux/vringh.h b/include/linux/vringh.h index 9e2763d7c159..d71b3710f58e 100644 --- a/include/linux/vringh.h +++ b/include/linux/vringh.h @@ -11,6 +11,7 @@ #ifndef _LINUX_VRINGH_H #define _LINUX_VRINGH_H #include <uapi/li...
2020 Apr 06
0
[PATCH v4 05/12] virtio: stop using legacy struct vring in kernel
...tatic inline void virtio_store_mb(bool weak_barriers, struct virtio_device; struct virtqueue; +struct vring { + unsigned int num; + + struct vring_desc *desc; + + struct vring_avail *avail; + + struct vring_used *used; +}; + /* * Creates a virtqueue and allocates the descriptor ring. If * may_reduce_num is set, then this may allocate a smaller ring than diff --git a/include/linux/vringh.h b/include/linux/vringh.h index 9e2763d7c159..d71b3710f58e 100644 --- a/include/linux/vringh.h +++ b/include/linux/vringh.h @@ -11,6 +11,7 @@ #ifndef _LINUX_VRINGH_H #define _LINUX_VRINGH_H #include <uapi/li...
2023 Apr 08
1
[PATCH] virtio-vdpa: add VIRTIO_F_NOTIFICATION_DATA feature support
...> if (ops->get_vq_ready(vdpa, index)) > return ERR_PTR(-ENOENT); > @@ -183,8 +200,7 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index, > dma_dev = vdpa_get_dma_dev(vdpa); > vq = vring_create_virtqueue_dma(index, max_num, align, vdev, > true, may_reduce_num, ctx, > - virtio_vdpa_notify, callback, > - name, dma_dev); > + notify, callback, name, dma_dev); > if (!vq) { > err = -ENOMEM; > goto error_new_virtqueue; > diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h > index 43f59ef10cc..a83bb0501c5 100644...
2023 Apr 04
1
[PATCH] virtio-vdpa: add VIRTIO_F_NOTIFICATION_DATA feature support
...return ERR_PTR(-ENOENT); > @@ -183,8 +200,7 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index, > dma_dev = vdpa_get_dma_dev(vdpa); > vq = vring_create_virtqueue_dma(index, max_num, align, vdev, > true, may_reduce_num, ctx, > - virtio_vdpa_notify, callback, > - name, dma_dev); > + notify, callback, name, dma_dev); > if (!vq) { > err = -ENOMEM; >...
2023 Apr 09
1
[PATCH v2] virtio-vdpa: add VIRTIO_F_NOTIFICATION_DATA feature support
...n't already be set up. */ if (ops->get_vq_ready(vdpa, index)) return ERR_PTR(-ENOENT); @@ -183,8 +203,7 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index, dma_dev = vdpa_get_dma_dev(vdpa); vq = vring_create_virtqueue_dma(index, max_num, align, vdev, true, may_reduce_num, ctx, - virtio_vdpa_notify, callback, - name, dma_dev); + notify, callback, name, dma_dev); if (!vq) { err = -ENOMEM; goto error_new_virtqueue; diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index 43f59ef10cc..04cdaad77dd 100644 --- a/include/linux/vdpa.h +++ b/include...
2020 Apr 06
0
[PATCH v5 05/12] virtio: stop using legacy struct vring in kernel
...tatic inline void virtio_store_mb(bool weak_barriers, struct virtio_device; struct virtqueue; +struct vring { + unsigned int num; + + struct vring_desc *desc; + + struct vring_avail *avail; + + struct vring_used *used; +}; + /* * Creates a virtqueue and allocates the descriptor ring. If * may_reduce_num is set, then this may allocate a smaller ring than diff --git a/include/linux/vringh.h b/include/linux/vringh.h index 9e2763d7c159..d71b3710f58e 100644 --- a/include/linux/vringh.h +++ b/include/linux/vringh.h @@ -11,6 +11,7 @@ #ifndef _LINUX_VRINGH_H #define _LINUX_VRINGH_H #include <uapi/li...
2020 Apr 06
0
[PATCH v6 05/12] virtio: stop using legacy struct vring in kernel
...tatic inline void virtio_store_mb(bool weak_barriers, struct virtio_device; struct virtqueue; +struct vring { + unsigned int num; + + struct vring_desc *desc; + + struct vring_avail *avail; + + struct vring_used *used; +}; + /* * Creates a virtqueue and allocates the descriptor ring. If * may_reduce_num is set, then this may allocate a smaller ring than diff --git a/include/linux/vringh.h b/include/linux/vringh.h index 9e2763d7c159..d71b3710f58e 100644 --- a/include/linux/vringh.h +++ b/include/linux/vringh.h @@ -11,6 +11,7 @@ #ifndef _LINUX_VRINGH_H #define _LINUX_VRINGH_H #include <uapi/li...