[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC][PATCH 05/12] coroutine: Add coroutines
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [RFC][PATCH 05/12] coroutine: Add coroutines |
Date: |
Thu, 27 Jan 2011 09:40:21 +0000 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Wed, Jan 26, 2011 at 05:29:23PM +0200, Avi Kivity wrote:
> On 01/22/2011 11:29 AM, Stefan Hajnoczi wrote:
> >Add functions to create coroutines and transfer control into a coroutine
> >and back out again.
> >
> >
> >+
> >+struct Coroutine {
> >+ struct coroutine co;
> >+};
> >+
> >
> >+/**
> >+ * Coroutine entry point
> >+ *
> >+ * When the coroutine is entered for the first time, opaque is passed in as
> >an
> >+ * argument.
> >+ *
> >+ * When this function returns, the coroutine is destroyed automatically and
> >the
> >+ * return value is passed back to the caller who last entered the coroutine.
> >+ */
> >+typedef void * coroutine_fn CoroutineEntry(void *opaque);
>
> The more modern style is to use the Coroutine structure as argument,
> and let the coroutine function use container_of() to obtain access
> to its own data structures. Similarly it can store any return value
> there, avoiding casts to and from void pointers.
Yes, container_of() would be nice but we need to be careful to support
pooling Coroutine structs. Or maybe just pool the mmaped stacks.
Stefan
- [Qemu-devel] [RFC][PATCH 07/12] coroutine: Add coroutine_is_leader(), (continued)
- [Qemu-devel] [RFC][PATCH 07/12] coroutine: Add coroutine_is_leader(), Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 08/12] coroutine: Add qemu_in_coroutine(), Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 04/12] coroutine: Use thread-local leader and current variables, Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 09/12] block: Add bdrv_co_readv() and bdrv_co_writev(), Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 10/12] block: Add coroutine support to synchronous I/O functions, Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 06/12] coroutine: Add qemu_coroutine_self(), Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 12/12] qcow2: Serialize all requests, Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 05/12] coroutine: Add coroutines, Stefan Hajnoczi, 2011/01/22
- [Qemu-devel] [RFC][PATCH 11/12] qcow2: Convert qcow2 to use coroutines for async I/O, Stefan Hajnoczi, 2011/01/22
- Re: [Qemu-devel] [RFC][PATCH 11/12] qcow2: Convert qcow2 to use coroutines for async I/O, Anthony Liguori, 2011/01/23
- Re: [Qemu-devel] [RFC][PATCH 11/12] qcow2: Convert qcow2 to use coroutines for async I/O, Avi Kivity, 2011/01/26
- Re: [Qemu-devel] [RFC][PATCH 11/12] qcow2: Convert qcow2 to use coroutines for async I/O, Kevin Wolf, 2011/01/26
- Re: [Qemu-devel] [RFC][PATCH 11/12] qcow2: Convert qcow2 to use coroutines for async I/O, Anthony Liguori, 2011/01/26
- Re: [Qemu-devel] [RFC][PATCH 11/12] qcow2: Convert qcow2 to use coroutines for async I/O, Avi Kivity, 2011/01/26
- Re: [Qemu-devel] [RFC][PATCH 11/12] qcow2: Convert qcow2 to use coroutines for async I/O, Anthony Liguori, 2011/01/26
- Re: [Qemu-devel] [RFC][PATCH 11/12] qcow2: Convert qcow2 to use coroutines for async I/O, Avi Kivity, 2011/01/26
- Re: [Qemu-devel] [RFC][PATCH 11/12] qcow2: Convert qcow2 to use coroutines for async I/O, Anthony Liguori, 2011/01/26