Received: from eggs.gnu.org ([2001:4830:134:3::10]:38839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2fhw-0000qD-1g for qemu-devel@nongnu.org; Mon, 13 Jan 2014 06:29:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2fhn-0000Tq-RV for qemu-devel@nongnu.org; Mon, 13 Jan 2014 06:29:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2fhn-0000T4-KN for qemu-devel@nongnu.org; Mon, 13 Jan 2014 06:29:19 -0500 Date: Mon, 13 Jan 2014 12:29:10 +0100 From: Kevin Wolf Message-ID: <20140113112910.GE3117@dhcp-200-207.str.redhat.com> References: <1386940979-3824-1-git-send-email-kwolf@redhat.com> <1386940979-3824-20-git-send-email-kwolf@redhat.com> <52BCFF4C.5010303@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <52BCFF4C.5010303@linux.vnet.ibm.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 19/24] block: Allow wait_serialising_requests() at any point List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: pbonzini@redhat.com, pl@kamp.de, qemu-devel@nongnu.org, stefanha@redhat.com Am 27.12.2013 um 05:17 hat Wenchao Xia geschrieben: > =E4=BA=8E 2013/12/13 21:22, Kevin Wolf =E5=86=99=E9=81=93: > > We can only have a single wait_serialising_requests() call per reques= t > > because otherwise we can run into deadlocks where requests are waitin= g > > for each other. > do you mean: > mark_request_serialising(req) > ... > wait_serialising_requests(req); > ... > wait_serialising_requests(req); >=20 > will have deadlock? Yes, it can deadlock (it doesn't have to, it depends on whether another overlapping request is started concurrently). More precisely, the problematic pattern is: mark_request_serialising(req); ... qemu_coroutine_yield(); /* Other requests may be issued now */ ... wait_serialising_requests(req); What you mentioned above is a special case of this. > I thought it is already resolved by patch 15? > Maybe here is another deadlock reason? The problematic pattern in patch 15 was: mark_request_serialising(req); ... /* no yield here */ wait_serialising_requests(req); As opposed to the originally used: wait_serialising_requests(req); ... /* no yield here */ mark_request_serialising(req); Kevin