From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm0gR-0005j7-5V for qemu-devel@nongnu.org; Wed, 27 Jul 2011 05:45:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qm0gP-0005Cl-Kb for qemu-devel@nongnu.org; Wed, 27 Jul 2011 05:45:43 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:59505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm0gP-0005AW-Cb for qemu-devel@nongnu.org; Wed, 27 Jul 2011 05:45:41 -0400 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by e32.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p6R8ZbXk028392 for ; Wed, 27 Jul 2011 02:35:37 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p6R9jWl1170582 for ; Wed, 27 Jul 2011 03:45:32 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p6R3j3OG013702 for ; Tue, 26 Jul 2011 21:45:04 -0600 From: "Aneesh Kumar K.V" 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: Wed, 27 Jul 2011 15:15:20 +0530 Message-ID: <8739hs5a6n.fsf@skywalker.in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Kevin Wolf , Blue Swirl , Anthony Liguori , Venkateswararao Jujjuri On Tue, 26 Jul 2011 10:21:12 +0100, Stefan Hajnoczi wrote: > QEMU is event-driven and suffers when blocking operations are performed because > VM execution may be stopped until the operation completes. Therefore many > operations that could block are performed asynchronously and a callback is > invoked when the operation has completed. This 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. Callback 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 asynchronous > code while still having a nice sequential control flow. The semantics are > explained in the second patch. The fourth patch adds automated tests. > > A nice feature of coroutines is that it is relatively easy to take synchronous > code and lift it into a coroutine to make it asynchronous. Work has been done > to move qcow2 request processing into coroutines and thereby make it > asynchronous (today qcow2 will perform synchronous metadata accesses). This > qcow2 work is still ongoing and not quite ready for mainline yet. > > v8: > * Bisectability: introduce gthread implementation before ucontext/fibers Can we also get CoMutex and CoQueue patches also merged. I use them in the VirtFS series. http://repo.or.cz/w/qemu/kevin.git/shortlog/refs/heads/coroutine-devel http://repo.or.cz/w/qemu/v9fs.git/commit/318ef0b9b01cd296f8c30d8288139b9bed859892 -aneesh