From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkDgB-0001aO-RY for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:00:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XkDCT-0008E3-23 for qemu-devel@nongnu.org; Fri, 31 Oct 2014 10:29:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38245) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkDCS-0008Dv-QY for qemu-devel@nongnu.org; Fri, 31 Oct 2014 10:29:12 -0400 Date: Fri, 31 Oct 2014 16:28:51 +0200 From: "Michael S. Tsirkin" Message-ID: <20141031142851.GA11152@redhat.com> References: <1414716016-18004-1-git-send-email-wu.wubin@huawei.com> <20141031105755.GA9532@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141031105755.GA9532@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] [PATCH v2] hw/virtio/vring/event_idx: fix the vring_avail_event error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: pbonzini@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, Bin Wu 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 > > --- > > 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 > > 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.