From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxAyh-0000TD-45 for qemu-devel@nongnu.org; Tue, 26 May 2015 05:16:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxAyb-00057o-Uc for qemu-devel@nongnu.org; Tue, 26 May 2015 05:16:50 -0400 Date: Tue, 26 May 2015 10:07:10 +0100 From: Stefan Hajnoczi Message-ID: <20150526090710.GB13262@stefanha-thinkpad.redhat.com> References: <1432032670-15124-1-git-send-email-famz@redhat.com> <1432032670-15124-4-git-send-email-famz@redhat.com> <20150519144830.GI9338@stefanha-thinkpad.redhat.com> <20150526065248.GB13749@ad.nay.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cvVnyQ+4j833TQvp" Content-Disposition: inline In-Reply-To: <20150526065248.GB13749@ad.nay.redhat.com> Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v3 03/13] l2tpv3: Drop l2tpv3_can_send List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-block@nongnu.org, Juan Quintela , Jason Wang , qemu-devel@nongnu.org, Vincenzo Maffione , "Vassili Karpov (malc)" , Gerd Hoffmann , Stefan Hajnoczi , Amit Shah , Paolo Bonzini , Giuseppe Lettieri , Luigi Rizzo --cvVnyQ+4j833TQvp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 26, 2015 at 02:52:48PM +0800, Fam Zheng wrote: > On Tue, 05/19 15:48, Stefan Hajnoczi wrote: > > On Tue, May 19, 2015 at 10:51:00AM +0000, Fam Zheng wrote: > > > This callback is called by main loop before polling s->fd, if it retu= rns > > > false, the fd will not be polled in this iteration. > > >=20 > > > This is redundant with checks inside read callback. After this patch, > > > the data will be copied from s->fd to s->msgvec when it arrives. If t= he > > > device can't receive, it will be queued to incoming_queue, and when t= he > > > device status changes, this queue will be flushed. > >=20 > > This doesn't work because s->msgvec can fill up when > > qemu_can_send_packet() returns false. At that point we burn 100% CPU > > because the file descriptor is still being monitored. >=20 > If qemu_can_send_packet returns false, we do stop monitoring the fd. In > net_l2tpv3_process_queue: >=20 > size =3D qemu_send_packet_async( > &s->nc, > vec->iov_base, > data_size, > l2tpv3_send_completed > ); > if (size =3D=3D 0) { > l2tpv3_read_poll(s, false); > } >=20 > The packet is queued and size is 0, so the read poll will be disabled unt= il > it's flushed. >=20 > What am I missing? I think you are right. I was looking at the while loop qemu_can_send_packet(): } while ( (s->queue_depth > 0) && qemu_can_send_packet(&s->nc) && ((size > 0) || bad_read) ); and missed the portion you quoted. Stefan --cvVnyQ+4j833TQvp Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVZDe+AAoJEJykq7OBq3PIz4cH/3DJvMNPRtsqwM6ieOQaNWFJ RBinwFHW78HWoWn0BV4DSqfLV17qUPA58megaOyCPGPUqsut4IR8lN8zWozbt6oN yMLxBdmQu2UK1XiNuLJ4H6tPvL/93XLWhixzVMBaZOB+CVUBWOVz91fQzkEcSOPw PpI8jXElgEQh6I0nHo08/UopCx9o9Hisc2Q3AD0oH5GU0naqIJblDNAxWz+dMWEh zkiGV4A8EL3cwvJl+U3+0AttfHvCpxEiOAjIwBSKriKOmDFGVITb7rdq1KVqlMJt GUyoJ7VmeqaepQDtuJr01l6fIl5MdqwxbnTmQmdJnLEfruGUPn1357hs/yWZSzo= =7Air -----END PGP SIGNATURE----- --cvVnyQ+4j833TQvp--