Received: from eggs.gnu.org ([2001:4830:134:3::10]:34546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVKIt-0006Li-1p for qemu-devel@nongnu.org; Tue, 10 Mar 2015 09:34:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVKIn-0004EV-Ta for qemu-devel@nongnu.org; Tue, 10 Mar 2015 09:34:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVKIn-0004EP-Ie for qemu-devel@nongnu.org; Tue, 10 Mar 2015 09:34:29 -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 (8.14.4/8.14.4) with ESMTP id t2ADYSGl021856 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 10 Mar 2015 09:34:29 -0400 Date: Tue, 10 Mar 2015 13:34:26 +0000 From: Stefan Hajnoczi Message-ID: <20150310133426.GC19057@stefanha-thinkpad.redhat.com> References: <1423718462-25566-1-git-send-email-famz@redhat.com> <1423718462-25566-2-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/e2eDi0V/xtL+Mc8" Content-Disposition: inline In-Reply-To: <1423718462-25566-2-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/3] block: Forbid bdrv_set_aio_context outside BQL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: kwolf@redhat.com, Paolo Bonzini , qemu-devel@nongnu.org --/e2eDi0V/xtL+Mc8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 12, 2015 at 01:21:00PM +0800, Fam Zheng wrote: > Even if the caller has the old #AioContext, there can be a deadlock, due > to the leading bdrv_drain_all: >=20 > Suppose there are three io threads (a, b, c) with each owning a BDS > (bds_a, bds_b, bds_c), and a and b want to move their own BDS to c at > the same time: >=20 > iothread a iothread b > -------------------------------------------------------------------------- > bdrv_set_aio_context(bds_a, c) bdrv_set_aio_context(bds_b, c) > -> bdrv_drain_all() -> bdrv_drain_all() > -> acquire a (OK, already has) -> acquire a (blocked) > -> acquire b (blocked) -> acquire b > -> acquire c -> acquire c >=20 > Current caller of bdrv_set_aio_context outside BQL is > virtio-scsi-dataplane, which will be fixed in the next patches. >=20 > Signed-off-by: Fam Zheng > --- > include/block/block.h | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) Reviewed-by: Stefan Hajnoczi --/e2eDi0V/xtL+Mc8 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJU/vLiAAoJEJykq7OBq3PInHAIALTTbreAu/r0uUwYIX7AY6SD ySik3bM0PW8nwh3ybG/aIY1IeV6P8w4oa5AdTrLJH14DP0qCX61y40tNEbubsRa+ 1HVzqubyJkwFJ2HORvmaOw1RFAswPQn5OFq+M59d/D5xoKskPnCAFOnl722Ealf9 8KlADgCGl/XoBGStEyokfVGChjLdqZZuTs7q5g1WQwy092o+/vO0kldNb3jaY7ZB GUfJClhN+mF/J8Ifa5weLzlU38F7ZxRzDcSPa/F8RW+f1jvr5xWewr7iY6ympXOS gT8yLkcpbHyyujUJ3SA1XjorZ4jlW8mvRerA7xZJnYnJSdtaZwkqN+OzxHAMkRc= =APQD -----END PGP SIGNATURE----- --/e2eDi0V/xtL+Mc8--