lkml.org 
[lkml]   [2011]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCHv2 11/14] virtio: don't delay avail index update
    Date
    On Fri, 20 May 2011 02:12:19 +0300, "Michael S. Tsirkin" <mst@redhat.com> wrote:
    > Update avail index immediately instead of upon kick:
    > for virtio-net RX this helps parallelism with the host.
    >
    > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    > ---
    > drivers/virtio/virtio_ring.c | 28 +++++++++++++++++++---------
    > 1 files changed, 19 insertions(+), 9 deletions(-)
    >
    > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
    > index eed5f29..8218fe6 100644
    > --- a/drivers/virtio/virtio_ring.c
    > +++ b/drivers/virtio/virtio_ring.c
    > @@ -89,7 +89,7 @@ struct vring_virtqueue
    > unsigned int num_free;
    > /* Head of free buffer list. */
    > unsigned int free_head;
    > - /* Number we've added since last sync. */
    > + /* Number we've added since last kick. */
    > unsigned int num_added;

    I always like to see obsolescent nomenclature cleaned up like this.
    Thanks.

    > /* Last used index we've seen. */
    > @@ -174,6 +174,13 @@ int virtqueue_add_buf_gfp(struct virtqueue *_vq,
    >
    > BUG_ON(data == NULL);
    >
    > + /* Prevent drivers from adding more than num bufs without a kick. */
    > + if (vq->num_added == vq->vring.num) {
    > + printk(KERN_ERR "gaaa!!!\n");
    > + END_USE(vq);
    > + return -ENOSPC;
    > + }
    > +

    I like "gaaa!" but it won't tell us which driver. How about the more
    conventional:

    if (WARN_ON(vq->num_added >= vq->vring.num)) {
    END_USE(vq);
    return -ENOSPC;
    }

    I'd really like to see the results of this patch. It's useless for
    outgoing net traffic (we deal with one packet at a time) but perhaps a
    flood of incoming packets would show something.

    Thanks,
    Rusty.


    \
     
     \ /
      Last update: 2011-05-21 04:37    [W:0.021 / U:125.876 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site