From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qmmaj-0000Ub-Um for qemu-devel@nongnu.org; Fri, 29 Jul 2011 08:55:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qmmai-0001x5-MU for qemu-devel@nongnu.org; Fri, 29 Jul 2011 08:55:01 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:56431) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qmmai-0001wz-K1 for qemu-devel@nongnu.org; Fri, 29 Jul 2011 08:55:00 -0400 Received: by gyg8 with SMTP id 8so2985318gyg.4 for ; Fri, 29 Jul 2011 05:55:00 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1311672077-4592-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1311672077-4592-1-git-send-email-stefanha@linux.vnet.ibm.com> Date: Fri, 29 Jul 2011 13:54:58 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v8 0/5] Coroutines for better asynchronous programming List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Kevin Wolf , Blue Swirl , Venkateswararao Jujjuri , qemu-devel@nongnu.org, Stefan Hajnoczi On Tue, Jul 26, 2011 at 10:21 AM, Stefan Hajnoczi wrote: > QEMU is event-driven and suffers when blocking operations are performed b= ecause > VM execution may be stopped until the operation completes. =A0Therefore m= any > operations that could block are performed asynchronously and a callback i= s > invoked when the operation has completed. =A0This allows QEMU to continue > executing while the operation is pending. > > The downside to callbacks is that they split up code into many smaller > functions, each of which is a single step in a state machine that quickly > becomes complex and hard to understand. =A0Callback functions also result= in lots > of noise as variables are packed and unpacked into temporary structs that= pass > state to the callback function. > > This patch series introduces coroutines as a solution for writing asynchr= onous > code while still having a nice sequential control flow. =A0The semantics = are > explained in the second patch. =A0The fourth patch adds automated tests. > > A nice feature of coroutines is that it is relatively easy to take synchr= onous > code and lift it into a coroutine to make it asynchronous. =A0Work has be= en done > to move qcow2 request processing into coroutines and thereby make it > asynchronous (today qcow2 will perform synchronous metadata accesses). = =A0This > qcow2 work is still ongoing and not quite ready for mainline yet. > > v8: > =A0* Bisectability: introduce gthread implementation before ucontext/fibe= rs Aneesh's code on top of this will go in separately. We're good to go. Stefan