From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkDlp-0003Ej-7K for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:06:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xk9u4-00051y-7S for qemu-devel@nongnu.org; Fri, 31 Oct 2014 06:58:05 -0400 Received: from mail-lb0-x22e.google.com ([2a00:1450:4010:c04::22e]:44747) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xk9u3-00050u-VC for qemu-devel@nongnu.org; Fri, 31 Oct 2014 06:58:00 -0400 Received: by mail-lb0-f174.google.com with SMTP id z11so3855726lbi.19 for ; Fri, 31 Oct 2014 03:57:58 -0700 (PDT) Date: Fri, 31 Oct 2014 10:57:55 +0000 From: Stefan Hajnoczi Message-ID: <20141031105755.GA9532@stefanha-thinkpad.redhat.com> References: <1414716016-18004-1-git-send-email-wu.wubin@huawei.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline In-Reply-To: <1414716016-18004-1-git-send-email-wu.wubin@huawei.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: Bin Wu Cc: pbonzini@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mst@redhat.com --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > In virtqueue_pop, when a request is poped, the current avail event > idx should be set to the number of vq->last_avail_idx. >=20 > 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 --C7zPtVaVf+AK4Oqc Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUU2szAAoJEJykq7OBq3PI1PIH/0wJI62yFnoR691SwT5wKojg P73Tjh73HJwWSpfeEibyG85j3c9FfP5FV6GggPkFHLBZQwBFMRO1qtN5j9so28A8 AuRTiB9DWMOYZC0pMHF6h7TeBdWRWl1qLEx/VoCyj2uo0nuhj0XLMVxE5i/3fup/ /6uKqhhWPMcQV4VR8BCNVj3vszyH+oMCOGZ54dEGpBBu9RFn0REep5P/a3rqy9Sr pIev4bQjFLz1WSyDXyzmIwGVDK7Q56ftNlcs2+kniolKUpt947Lc/RJDk+ebbZU4 UQ97bG/c/4g4aRRVkapxKP7bioMAFGisNdO93/zRUrxXTnWa8jb5XSB4hQBND60= =eaCN -----END PGP SIGNATURE----- --C7zPtVaVf+AK4Oqc--