From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHE3L-0008C6-4M for qemu-devel@nongnu.org; Mon, 20 Jul 2015 12:36:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHE3E-0006w0-W4 for qemu-devel@nongnu.org; Mon, 20 Jul 2015 12:36:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHE3E-0006vp-RC for qemu-devel@nongnu.org; Mon, 20 Jul 2015 12:36:24 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 498FB350111 for ; Mon, 20 Jul 2015 16:36:24 +0000 (UTC) Date: Mon, 20 Jul 2015 17:36:20 +0100 From: Stefan Hajnoczi Message-ID: <20150720163620.GN12675@stefanha-thinkpad.redhat.com> References: <1437370031-9070-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rFUhhEVnhEf/dYhU" Content-Disposition: inline In-Reply-To: <1437370031-9070-1-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2] AioContext: fix broken placement of event_notifier_test_and_clear List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, lersek@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, rjones@redhat.com --rFUhhEVnhEf/dYhU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 20, 2015 at 07:27:11AM +0200, Paolo Bonzini wrote: > event_notifier_test_and_clear must be called before processing events. > Otherwise, an aio_poll could "eat" the notification before the main > I/O thread invokes ppoll(). The main I/O thread then never wakes up. > This is an example of what could happen: >=20 > i/o thread vcpu thread worker thread > --------------------------------------------------------------------- > lock_iothread > notify_me =3D 1 > ... > unlock_iothread > lock_iothread > notify_me =3D 3 > ppoll > notify_me =3D 1 > bh->scheduled =3D 1 > event_notifier_set > event_notifier_test_and_clear > ppoll > *** hang *** I don't understand this diagram. Why is event_notifier_test_and_clear() called by the vcpu thread? event_notifier_set() was called *after* vcpu thread's ppoll() returned so I wouldn't expect the vcpu thread to see the notify. Was there a previous notify pending? --rFUhhEVnhEf/dYhU Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVrSOEAAoJEJykq7OBq3PIXG8IAKa1xcBVMnfwix4GbrKbK1hP dPy7YWn5qlhYFhTnMkPROagAhsMZ2aBysg6l/N3eTyNtGbHm2oQLUOGU1Eqbw+Bb l5at9UC0Wk++Pi++s8Gyb1YcG9y5iK68sqMu683XwNzfcx1cYCS/kfQkVcfiQBZO 3Soa4TqYwP+/QLaXzBPhxNtRpt5Ckwd2IKNik9Sifsk3ComL8XfEAQW6IxutXgOb IPW+xxGJDXqrqQn8csmFn/bn3kZDBpGiM36BkOOtQNHARoX0bAbVnTvX6JKoQR3Y 6ydwcMBWFh0dsxL1tAN3Bcr9Lf005EPV0tkn/sD1UVRkC78/2QFGGVoI5PQkDTk= =JSNH -----END PGP SIGNATURE----- --rFUhhEVnhEf/dYhU--