From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2uSA-0002sr-Dx for qemu-devel@nongnu.org; Mon, 13 Jan 2014 22:14:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2uRz-0003eq-M5 for qemu-devel@nongnu.org; Mon, 13 Jan 2014 22:14:10 -0500 Received: from e23smtp04.au.ibm.com ([202.81.31.146]:40597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2uRy-0003cT-Uk for qemu-devel@nongnu.org; Mon, 13 Jan 2014 22:13:59 -0500 Received: from /spool/local by e23smtp04.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 14 Jan 2014 13:13:29 +1000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [9.190.235.21]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id CBA862BB002D for ; Tue, 14 Jan 2014 14:13:26 +1100 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s0E3DDmc9634264 for ; Tue, 14 Jan 2014 14:13:14 +1100 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s0E3DPjo007327 for ; Tue, 14 Jan 2014 14:13:25 +1100 Message-ID: <52D4AB53.7030903@linux.vnet.ibm.com> Date: Tue, 14 Jan 2014 11:13:23 +0800 From: Wenchao Xia MIME-Version: 1.0 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> <20140113112910.GE3117@dhcp-200-207.str.redhat.com> In-Reply-To: <20140113112910.GE3117@dhcp-200-207.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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: Kevin Wolf Cc: pbonzini@redhat.com, pl@kamp.de, qemu-devel@nongnu.org, stefanha@redhat.com 于 2014/1/13 19:29, Kevin Wolf 写道: > Am 27.12.2013 um 05:17 hat Wenchao Xia geschrieben: >> 于 2013/12/13 21:22, Kevin Wolf 写道: >>> We can only have a single wait_serialising_requests() call per request >>> because otherwise we can run into deadlocks where requests are waiting >>> for each other. >> do you mean: >> mark_request_serialising(req) >> ... >> wait_serialising_requests(req); >> ... >> wait_serialising_requests(req); >> >> 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. > It seems when two overlapping request exist in the qeueue, and both are waiting, problem happens. Thanks for explanation, I am fine with this patch. >> 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 >