From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZD9Ij-0007A9-0o for qemu-devel@nongnu.org; Thu, 09 Jul 2015 06:43:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZD9Ic-0005oE-GZ for qemu-devel@nongnu.org; Thu, 09 Jul 2015 06:43:32 -0400 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:38153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZD9Ic-0005oA-8I for qemu-devel@nongnu.org; Thu, 09 Jul 2015 06:43:26 -0400 Received: by wibdq8 with SMTP id dq8so238135338wib.1 for ; Thu, 09 Jul 2015 03:43:25 -0700 (PDT) Date: Thu, 9 Jul 2015 11:43:22 +0100 From: Stefan Hajnoczi Message-ID: <20150709104322.GD28530@stefanha-thinkpad.redhat.com> References: <20150707101730.GB1648@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UoPmpPX/dBe4BELn" 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 --UoPmpPX/dBe4BELn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 07, 2015 at 02:43:06PM +0300, Catalin Vasile wrote: > My vhost module respects the format vhost-net uses: >=20 > /* summary */ > mutex_lock(&vq->mutex); > vhost_disable_notify(); > for (;;) { > head =3D vhost_get_vq_desc(); > if (head =3D=3D vq->num) { > if (unlikely(vhost_enable_notify())) { > vhost_disable_notify(); > continue; > } > break; > } > vhost_add_used_and_signal(); > } > mutex_unlock(&vq->mutex); > /* */ >=20 > I have made a lot of printk() calls and the first job gets processed > completely, and gets through all those calls: > 1. it goes into a first loop and processes the first job (get > descriptor, work with the descriptor, add used and signal). > 2. On the second loop it hits head =3D=3D vq->num, and goes back to > listening to notifications (successfully, it does not get into the > fallback). >=20 > Now in the guest: > 1. sends first job and the paramers used to call vring_need_event() are: > vring_avail_event=3D0, new=3D1, old=3D0 (which makes the function evaluat= e to "0 < 1") > 2. the queue is kicked and vhost does its job. > 3. the guest driver reaches the end of the first job, and lets the > following job take its course, only this time vring_need_event() > receives the following parameters: > vring_avail_event=3D0, new=3D2, old=3D1 (which makes the function evaluat= e to "1 < 1") This means you need to look at the vhost code because vring_avail_event shouldn't be 0. Why wasn't vhost_update_avail_event() called? Maybe the feature bit negotiation for your device is broken and vhost thinks VIRTIO_RING_F_EVENT_IDX is not set. Or does the used ring have the VRING_USED_F_NO_NOTIFY flag? --UoPmpPX/dBe4BELn Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVnlBKAAoJEJykq7OBq3PIFs4H/RZjYmVWX+81vifxztVxCEuq 577ThcLQTC8m6F2gYbY1qGzKitRztpUUgQob8d7vuGn4Esdc1tHOpptJTcgIlQxL ZJSzfaraSGoFou3FnS5p5K5xQUcfZd1ZOcmASP8DPF5dVvh2Tf7jjsFbYH7pXhiq zyQh5+aCM6Ki8VoxomUkD2Nf/L8RJJxX7Lcy7iH9e9idcj5M2haSC3pd0Myn36gq DiiuOVDAcQgmpTOJxTiCMsk6ronqbWd5177dzJvmbL+MgXonfriEWrl9Wxc2eoaR mEj+FGF1G91kw65UXQPJpKGw/JbGzLPQHGxsJfYyeCU1eiKuwTJY4lQPDbQopKs= =oBU/ -----END PGP SIGNATURE----- --UoPmpPX/dBe4BELn--