search for: vhost_vq_num_batch_desc

Displaying 20 results from an estimated 33 matches for "vhost_vq_num_batch_desc".

2020 Jun 17
4
[PATCH RFC v8 02/11] vhost: use batched get_vq_desc version
...q_free_iovecs(struct vhost_virtqueue *vq) > { > kfree(vq->descs); > @@ -394,6 +400,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) > for (i = 0; i < dev->nvqs; ++i) { > vq = dev->vqs[i]; > vq->max_descs = dev->iov_limit; > + if (vhost_vq_num_batch_descs(vq) < 0) { > + return -EINVAL; > + } This check breaks vdpa which set iov_limit to zero. Consider iov_limit is meaningless to vDPA, I wonder we can skip the test when device doesn't use worker. Thanks
2020 Jun 17
4
[PATCH RFC v8 02/11] vhost: use batched get_vq_desc version
...q_free_iovecs(struct vhost_virtqueue *vq) > { > kfree(vq->descs); > @@ -394,6 +400,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) > for (i = 0; i < dev->nvqs; ++i) { > vq = dev->vqs[i]; > vq->max_descs = dev->iov_limit; > + if (vhost_vq_num_batch_descs(vq) < 0) { > + return -EINVAL; > + } This check breaks vdpa which set iov_limit to zero. Consider iov_limit is meaningless to vDPA, I wonder we can skip the test when device doesn't use worker. Thanks
2020 Jun 03
2
[PATCH RFC 03/13] vhost: batching fetches
..._dev *dev, > { > vq->num = 1; > vq->ndescs = 0; > + vq->first_desc = 0; > vq->desc = NULL; > vq->avail = NULL; > vq->used = NULL; > @@ -367,6 +368,11 @@ static int vhost_worker(void *data) > return 0; > } > > +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) > +{ > + return vq->max_descs - UIO_MAXIOV; > +} 1 descriptor does not mean 1 iov, e.g userspace may pass several 1 byte length memory regions for us to translate. > + > static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq) > { >...
2020 Jun 03
2
[PATCH RFC 03/13] vhost: batching fetches
..._dev *dev, > { > vq->num = 1; > vq->ndescs = 0; > + vq->first_desc = 0; > vq->desc = NULL; > vq->avail = NULL; > vq->used = NULL; > @@ -367,6 +368,11 @@ static int vhost_worker(void *data) > return 0; > } > > +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) > +{ > + return vq->max_descs - UIO_MAXIOV; > +} 1 descriptor does not mean 1 iov, e.g userspace may pass several 1 byte length memory regions for us to translate. > + > static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq) > { >...
2020 Apr 07
0
[PATCH v7 19/19] vhost: batching fetches
...t/vhost.c @@ -299,6 +299,7 @@ static void vhost_vq_reset(struct vhost_dev *dev, { vq->num = 1; vq->ndescs = 0; + vq->first_desc = 0; vq->desc = NULL; vq->avail = NULL; vq->used = NULL; @@ -367,6 +368,11 @@ static int vhost_worker(void *data) return 0; } +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) +{ + return vq->max_descs - UIO_MAXIOV; +} + static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq) { kfree(vq->descs); @@ -389,6 +395,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) for (i = 0; i < dev->nvqs; ++i) { vq = dev-&g...
2020 Apr 07
0
[PATCH v8 19/19] vhost: batching fetches
...t/vhost.c @@ -299,6 +299,7 @@ static void vhost_vq_reset(struct vhost_dev *dev, { vq->num = 1; vq->ndescs = 0; + vq->first_desc = 0; vq->desc = NULL; vq->avail = NULL; vq->used = NULL; @@ -367,6 +368,11 @@ static int vhost_worker(void *data) return 0; } +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) +{ + return vq->max_descs - UIO_MAXIOV; +} + static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq) { kfree(vq->descs); @@ -389,6 +395,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) for (i = 0; i < dev->nvqs; ++i) { vq = dev-&g...
2020 Jun 02
0
[PATCH RFC 03/13] vhost: batching fetches
...t/vhost.c @@ -299,6 +299,7 @@ static void vhost_vq_reset(struct vhost_dev *dev, { vq->num = 1; vq->ndescs = 0; + vq->first_desc = 0; vq->desc = NULL; vq->avail = NULL; vq->used = NULL; @@ -367,6 +368,11 @@ static int vhost_worker(void *data) return 0; } +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) +{ + return vq->max_descs - UIO_MAXIOV; +} + static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq) { kfree(vq->descs); @@ -389,6 +395,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) for (i = 0; i < dev->nvqs; ++i) { vq = dev-&g...
2020 Jun 04
0
[PATCH RFC 03/13] vhost: batching fetches
...m = 1; > > vq->ndescs = 0; > > + vq->first_desc = 0; > > vq->desc = NULL; > > vq->avail = NULL; > > vq->used = NULL; > > @@ -367,6 +368,11 @@ static int vhost_worker(void *data) > > return 0; > > } > > +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) > > +{ > > + return vq->max_descs - UIO_MAXIOV; > > +} > > > 1 descriptor does not mean 1 iov, e.g userspace may pass several 1 byte > length memory regions for us to translate. > Yes but I don't see the relevance. This tells...
2020 Jun 02
0
[PATCH RFC 04/13] vhost: cleanup fetch_buf return code handling
...s(struct vhost_virtqueue *vq) { - int ret = 0; + int ret; if (unlikely(vq->first_desc >= vq->ndescs)) { vq->first_desc = 0; @@ -2266,10 +2270,14 @@ static int fetch_descs(struct vhost_virtqueue *vq) if (vq->ndescs) return 0; - while (!ret && vq->ndescs <= vhost_vq_num_batch_descs(vq)) - ret = fetch_buf(vq); + for (ret = 1; + ret > 0 && vq->ndescs <= vhost_vq_num_batch_descs(vq); + ret = fetch_buf(vq)) + ; - return vq->ndescs ? 0 : ret; + /* On success we expect some descs */ + BUG_ON(ret > 0 && !vq->ndescs); + return ret; }...
2020 Jun 10
0
[PATCH RFC v7 03/14] vhost: use batched get_vq_desc version
...; + vq->first_desc = 0; > > + vq->ndescs = 0; > > + } > > + > > + if (vq->ndescs) > > + return 1; > > + > > + for (ret = 1; > > + ret > 0 && vq->ndescs <= vhost_vq_num_batch_descs(vq); > > + ret = fetch_buf(vq)) > > + ; > > (Expanding comment in V6): > > We get an infinite loop this way: > * vq->ndescs == 0, so we call fetch_buf() here > * fetch_buf gets less than vhost_vq_num_batch_descs(vq); descriptors. ret = 1...
2020 Jun 05
2
[PATCH RFC 03/13] vhost: batching fetches
...escs = 0; >>> + vq->first_desc = 0; >>> vq->desc = NULL; >>> vq->avail = NULL; >>> vq->used = NULL; >>> @@ -367,6 +368,11 @@ static int vhost_worker(void *data) >>> return 0; >>> } >>> +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) >>> +{ >>> + return vq->max_descs - UIO_MAXIOV; >>> +} >> 1 descriptor does not mean 1 iov, e.g userspace may pass several 1 byte >> length memory regions for us to translate. >> > Yes but I don't see the relevance....
2020 Jun 05
2
[PATCH RFC 03/13] vhost: batching fetches
...escs = 0; >>> + vq->first_desc = 0; >>> vq->desc = NULL; >>> vq->avail = NULL; >>> vq->used = NULL; >>> @@ -367,6 +368,11 @@ static int vhost_worker(void *data) >>> return 0; >>> } >>> +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) >>> +{ >>> + return vq->max_descs - UIO_MAXIOV; >>> +} >> 1 descriptor does not mean 1 iov, e.g userspace may pass several 1 byte >> length memory regions for us to translate. >> > Yes but I don't see the relevance....
2020 Jun 11
0
[PATCH RFC v7 03/14] vhost: use batched get_vq_desc version
...>ndescs = 0; > > > > + } > > > > + > > > > + if (vq->ndescs) > > > > + return 1; > > > > + > > > > + for (ret = 1; > > > > + ret > 0 && vq->ndescs <= vhost_vq_num_batch_descs(vq); > > > > + ret = fetch_buf(vq)) > > > > + ; > > > > > > (Expanding comment in V6): > > > > > > We get an infinite loop this way: > > > * vq->ndescs == 0, so we call fetch_buf() here > > >...
2020 Jun 10
0
[PATCH RFC v7 03/14] vhost: use batched get_vq_desc version
...> > vq->ndescs = 0; > > + vq->first_desc = 0; > > vq->desc = NULL; > > vq->avail = NULL; > > vq->used = NULL; > > @@ -372,6 +373,11 @@ static int vhost_worker(void *data) > > return 0; > > } > > > > +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) > > +{ > > + return vq->max_descs - UIO_MAXIOV; > > +} > > + > > static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq) > > { > > kfree(vq->descs); > > @@ -394,6 +400,9 @@ static long vhost_dev_alloc_iovecs...
2020 Jun 10
2
[PATCH RFC v6 02/11] vhost: use batched get_vq_desc version
..._dev *dev, > { > vq->num = 1; > vq->ndescs = 0; > + vq->first_desc = 0; > vq->desc = NULL; > vq->avail = NULL; > vq->used = NULL; > @@ -372,6 +373,11 @@ static int vhost_worker(void *data) > return 0; > } > > +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) > +{ > + return vq->max_descs - UIO_MAXIOV; > +} > + > static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq) > { > kfree(vq->descs); > @@ -394,6 +400,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) > for (...
2020 Jun 10
2
[PATCH RFC v6 02/11] vhost: use batched get_vq_desc version
..._dev *dev, > { > vq->num = 1; > vq->ndescs = 0; > + vq->first_desc = 0; > vq->desc = NULL; > vq->avail = NULL; > vq->used = NULL; > @@ -372,6 +373,11 @@ static int vhost_worker(void *data) > return 0; > } > > +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) > +{ > + return vq->max_descs - UIO_MAXIOV; > +} > + > static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq) > { > kfree(vq->descs); > @@ -394,6 +400,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) > for (...
2020 Jun 16
0
[PATCH RFC v7 03/14] vhost: use batched get_vq_desc version
...t; > > > > > + if (vq->ndescs) > > > > > > > + return 1; > > > > > > > + > > > > > > > + for (ret = 1; > > > > > > > + ret > 0 && vq->ndescs <= vhost_vq_num_batch_descs(vq); > > > > > > > + ret = fetch_buf(vq)) > > > > > > > + ; > > > > > > > > > > > > (Expanding comment in V6): > > > > > > > > > > > > We get an infinite loop...
2020 Jun 08
1
[PATCH RFC 03/13] vhost: batching fetches
...gt;> vq->desc = NULL; >>>>> vq->avail = NULL; >>>>> vq->used = NULL; >>>>> @@ -367,6 +368,11 @@ static int vhost_worker(void *data) >>>>> return 0; >>>>> } >>>>> +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) >>>>> +{ >>>>> + return vq->max_descs - UIO_MAXIOV; >>>>> +} >>>> 1 descriptor does not mean 1 iov, e.g userspace may pass several 1 byte >>>> length memory regions for us to translate. >>>...
2020 Jun 11
0
[PATCH RFC v8 02/11] vhost: use batched get_vq_desc version
...t/vhost.c @@ -304,6 +304,7 @@ static void vhost_vq_reset(struct vhost_dev *dev, { vq->num = 1; vq->ndescs = 0; + vq->first_desc = 0; vq->desc = NULL; vq->avail = NULL; vq->used = NULL; @@ -372,6 +373,11 @@ static int vhost_worker(void *data) return 0; } +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) +{ + return vq->max_descs - UIO_MAXIOV; +} + static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq) { kfree(vq->descs); @@ -394,6 +400,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) for (i = 0; i < dev->nvqs; ++i) { vq = dev-&g...
2020 Jun 08
0
[PATCH RFC v6 02/11] vhost: use batched get_vq_desc version
...t/vhost.c @@ -304,6 +304,7 @@ static void vhost_vq_reset(struct vhost_dev *dev, { vq->num = 1; vq->ndescs = 0; + vq->first_desc = 0; vq->desc = NULL; vq->avail = NULL; vq->used = NULL; @@ -372,6 +373,11 @@ static int vhost_worker(void *data) return 0; } +static int vhost_vq_num_batch_descs(struct vhost_virtqueue *vq) +{ + return vq->max_descs - UIO_MAXIOV; +} + static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq) { kfree(vq->descs); @@ -394,6 +400,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) for (i = 0; i < dev->nvqs; ++i) { vq = dev-&g...