Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1708877
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. |
| Date | 2017-08-10 18:50 +0200 |
| Message-ID | <ucYOL-8aT-57@gated-at.bofh.it> (permalink) |
| References | <ucYOK-8aT-25@gated-at.bofh.it> <ucYOK-8aT-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 10/08/2017 18:40, Richard W.M. Jones wrote:
> If using indirect descriptors, you can make the total_sg as large as
> you want. If not, BUG is too serious because the function later
> returns -ENOSPC.
>
> Thanks Paolo Bonzini, Christoph Hellwig.
>
> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
> ---
> drivers/virtio/virtio_ring.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 5e1b548828e6..27cbc1eab868 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -296,7 +296,6 @@ static inline int virtqueue_add(struct virtqueue *_vq,
> }
> #endif
>
> - BUG_ON(total_sg > vq->vring.num);
> BUG_ON(total_sg == 0);
>
> head = vq->free_head;
> @@ -305,8 +304,10 @@ static inline int virtqueue_add(struct virtqueue *_vq,
> * buffers, then go indirect. FIXME: tune this threshold */
> if (vq->indirect && total_sg > 1 && vq->vq.num_free)
> desc = alloc_indirect(_vq, total_sg, gfp);
> - else
> + else {
> desc = NULL;
> + WARN_ON_ONCE(total_sg > vq->vring.num && !vq->indirect);
So we get here only if vq->vq.num_free is zero. In that case,
vq->indirect makes no difference for the appropriateness of the warning
(that is, it should never be issued for indirect descriptors).
> + }
>
> if (desc) {
> /* Use a single buffer which doesn't continue */
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. "Richard W.M. Jones" <rjones@redhat.com> - 2017-08-10 18:50 +0200
Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. Paolo Bonzini <pbonzini@redhat.com> - 2017-08-10 18:50 +0200
Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. "Michael S. Tsirkin" <mst@redhat.com> - 2017-08-10 23:30 +0200
Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. "Richard W.M. Jones" <rjones@redhat.com> - 2017-08-10 23:40 +0200
Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. "Michael S. Tsirkin" <mst@redhat.com> - 2017-08-10 23:50 +0200
Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. "Richard W.M. Jones" <rjones@redhat.com> - 2017-08-11 00:00 +0200
Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. Paolo Bonzini <pbonzini@redhat.com> - 2017-08-11 16:10 +0200
Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. "Michael S. Tsirkin" <mst@redhat.com> - 2017-08-11 19:30 +0200
Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. Paolo Bonzini <pbonzini@redhat.com> - 2017-08-11 20:40 +0200
Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. "Richard W.M. Jones" <rjones@redhat.com> - 2017-08-10 23:40 +0200
Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN. "Michael S. Tsirkin" <mst@redhat.com> - 2017-08-10 23:40 +0200
csiph-web