[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] hw/virtio/vring/event_idx: fix the vring_ava
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH v2] hw/virtio/vring/event_idx: fix the vring_avail_event error |
Date: |
Fri, 31 Oct 2014 16:28:51 +0200 |
On Fri, Oct 31, 2014 at 10:57:55AM +0000, Stefan Hajnoczi wrote:
> On Fri, Oct 31, 2014 at 12:40:16AM +0000, Bin Wu wrote:
> > The event idx in virtio is an effective way to reduce the number of
> > interrupts and exits of the guest. When the guest puts an request
> > into the virtio ring, it doesn't exit immediately to inform the
> > backend. Instead, the guest checks the "avail" event idx to determine
> > the notification.
> >
> > In virtqueue_pop, when a request is poped, the current avail event
> > idx should be set to the number of vq->last_avail_idx.
> >
> > Signed-off-by: Bin Wu <address@hidden>
> > ---
> > V2 -> V1:
> > update the same code in hw/virtio/dataplane/vring.c (Stefan)
> > ---
> > hw/virtio/dataplane/vring.c | 8 ++++----
> > hw/virtio/virtio.c | 2 +-
> > 2 files changed, 5 insertions(+), 5 deletions(-)
>
> Reviewed-by: Stefan Hajnoczi <address@hidden>
>
> By the way, did you see that kernel drivers/vhost/vhost.c doesn't update
> the field for each pop? Instead it only updates when notify is
> re-enabled. I wonder if that approach is better than what QEMU does.
>
> Stefan
Yes you should not move event idx if you don't want events.