From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCPwa-0003sg-Hv for qemu-devel@nongnu.org; Tue, 07 Jul 2015 06:17:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCPwV-0002LA-Bk for qemu-devel@nongnu.org; Tue, 07 Jul 2015 06:17:40 -0400 Received: from mail-wg0-x234.google.com ([2a00:1450:400c:c00::234]:35081) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCPwV-0002Kt-3k for qemu-devel@nongnu.org; Tue, 07 Jul 2015 06:17:35 -0400 Received: by wgjx7 with SMTP id x7so163394771wgj.2 for ; Tue, 07 Jul 2015 03:17:34 -0700 (PDT) Date: Tue, 7 Jul 2015 11:17:30 +0100 From: Stefan Hajnoczi Message-ID: <20150707101730.GB1648@stefanha-thinkpad.redhat.com> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BwCQnh7xodEAoBMC" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [virtio guest] vring_need_event() from virtqueue_kick_prepare() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Catalin Vasile Cc: qemu-devel@nongnu.org --BwCQnh7xodEAoBMC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jul 06, 2015 at 06:13:29PM +0300, Catalin Vasile wrote: > What is the logic behind vring_need_event() when used with > virtqueue_kick_prepare()? > What does the keyword >>just<< refer to from the following context: > /* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */ > /* Assuming a given event_idx value from the other size, if > * we have just incremented index from old to new_idx, > * should we trigger an event? */ > ? "just" means since the last time the host/guest-visible index field was changed. After avail or used rings have been processed, the index field for that ring is published to the host/guest. At that point a check is made whether the other side needs to be kicked. > I am sending 2 jobs, one after another, and the second one just does > not want to kick, although the first one finished completely and the > backend went back to interrupt mode, all because vring_need_event() > returns false. Maybe the vhost driver called vhost_disable_notify() and hasn't re-enabled notify yet? This could happen if the guest adds buffers to the virtqueue while the host is processing the virtqueue. Take a look at the vhost_net code for how to correctly disable and re-enable notify without race conditions on the host. The idea behind disabling notify is to eliminate unnecessary vmexits/notifications since the host is already processing the virtqueue and will see new buffers. It's like a polling vs interrupt mode. If the vhost driver on the host doesn't implement it correctly, then the device could stop responding to the avail ring. --BwCQnh7xodEAoBMC Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVm6c6AAoJEJykq7OBq3PItDMH/1xVju800HjO/M6S9fnpihSx E8EaZ0h57vfXZfBbJRsEd+nvICDQfRThVKvnVDtTm4wc8noXzon/aBbyywO/+D0q oG0ZVGDUbL7iXIFMSpqTlZIHbO1RzUHBYxKnf8FSyLP88Otm1PPwmNYm/1lvkPIS yU537QQyCKr4urugHCtEOJLSM7640Em4CWZLkQm4PMjTIxHeDVcJ5UuhFVDLPXpB 8lpnQPQ/7mKwaVwjG0DLI5cygZ0Qp1azKRjeWxCcw5gDPjON1/VmAnHzES45QHik NzAt2HZyyIGa3Gl5Gmn8xXwrCKdjSMm7zt3dUyI/iiJRCqz9daRofXeJRgvalSo= =qyTI -----END PGP SIGNATURE----- --BwCQnh7xodEAoBMC--