From: Avi Kivity <avi@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC][PATCH 11/12] qcow2: Convert qcow2 to use coroutines for async I/O
Date: Thu, 27 Jan 2011 11:49:12 +0200 [thread overview]
Message-ID: <4D413F98.4010205@redhat.com> (raw)
In-Reply-To: <4D413A88.2060204@redhat.com>
On 01/27/2011 11:27 AM, Kevin Wolf wrote:
> Well, but in the case of qcow2, you don't want to have a big mutex
> around everything. We perfectly know which parts are asynchronous and
> which are synchronous, so we'd want to do it finer grained from the
> beginning.
Yes we do. And the way I proposed it, the new mutex does not introduce
any new serialization.
To repeat, for every qcow2 callback or completion X (not qcow2 read or
write operation), we transform it in the following manner:
1. Rename X into do_X. If X is called directly from within qcow2,
change the call to do_x. Create a new X which simply calls do_X().
This change is purely textual and doesn't affect runtime at all.
2. Change X to
X()
{
create a coroutine
pack arguments to X in a structure
schedule the coroutine to execute a new function call_X with the
structure as argument
wait for the coroutine to complete
unpack the result (if any)
dispose of the coroutine
return the result
}
call_X()
{
unpack arguments
co_mutex_lock(&bs->mutex)
result = do_X()
co_mutex_unlock(&bs->mutex)
pack result
}
(in the case of aio_X callbacks, we return a fake AIOCB:
aio_X()
{
allocate AIOCB
allocate coroutine
pack arguments to X, and fake AIOCB in a structure
schedule the coroutine to execute call_X with the structure as
argument
return fake AIOCB
}
call_aio_X()
{
unpack arguments
co_mutex_lock(&bs->mutex)
do_X()
co_mutex_unlock(&bs->mutex)
}
and change the completion to complete the fake AIOCB
)
The result of this transformation is:
- if X1 executed without blocking, it still executes without blocking,
except for the case below
- if X2 blocked, it will serialize any X1 which doesn't, but it will no
longer block the vcpu thread
We could do this transformation in the block layer, as it doesn't
involve qcow2 at all. I don't think that's a good idea, though, as
qcow2 would be the only beneficiary and it would be harder to further
evolve qcow2.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2011-01-27 9:49 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-22 9:29 [Qemu-devel] [RFC][PATCH 00/12] qcow2: Convert qcow2 to use coroutines for async I/O Stefan Hajnoczi
2011-01-22 9:29 ` [Qemu-devel] [RFC][PATCH 01/12] coroutine: Add gtk-vnc coroutines library Stefan Hajnoczi
2011-01-26 15:25 ` Avi Kivity
2011-01-26 16:00 ` Anthony Liguori
2011-01-26 16:13 ` Avi Kivity
2011-01-26 16:19 ` Anthony Liguori
2011-01-26 16:22 ` Avi Kivity
2011-01-26 16:29 ` Anthony Liguori
2011-01-26 16:21 ` Anthony Liguori
2011-01-22 9:29 ` [Qemu-devel] [RFC][PATCH 02/12] continuation: Fix container_of() redefinition Stefan Hajnoczi
2011-01-22 9:29 ` [Qemu-devel] [RFC][PATCH 03/12] Make sure to release allocated stack when coroutine is released Stefan Hajnoczi
2011-01-22 9:29 ` [Qemu-devel] [RFC][PATCH 04/12] coroutine: Use thread-local leader and current variables Stefan Hajnoczi
2011-01-22 9:29 ` [Qemu-devel] [RFC][PATCH 05/12] coroutine: Add coroutines Stefan Hajnoczi
2011-01-26 15:29 ` Avi Kivity
2011-01-26 16:00 ` Anthony Liguori
2011-01-27 9:40 ` Stefan Hajnoczi
2011-01-22 9:29 ` [Qemu-devel] [RFC][PATCH 06/12] coroutine: Add qemu_coroutine_self() Stefan Hajnoczi
2011-01-22 9:29 ` [Qemu-devel] [RFC][PATCH 07/12] coroutine: Add coroutine_is_leader() Stefan Hajnoczi
2011-01-22 9:29 ` [Qemu-devel] [RFC][PATCH 08/12] coroutine: Add qemu_in_coroutine() Stefan Hajnoczi
2011-01-22 9:29 ` [Qemu-devel] [RFC][PATCH 09/12] block: Add bdrv_co_readv() and bdrv_co_writev() Stefan Hajnoczi
2011-01-22 9:29 ` [Qemu-devel] [RFC][PATCH 10/12] block: Add coroutine support to synchronous I/O functions Stefan Hajnoczi
2011-01-22 9:29 ` [Qemu-devel] [RFC][PATCH 11/12] qcow2: Convert qcow2 to use coroutines for async I/O Stefan Hajnoczi
2011-01-23 23:40 ` Anthony Liguori
2011-01-24 11:09 ` Stefan Hajnoczi
2011-01-26 15:40 ` Avi Kivity
2011-01-26 15:50 ` Kevin Wolf
2011-01-26 16:08 ` Anthony Liguori
2011-01-26 16:13 ` Avi Kivity
2011-01-26 16:28 ` Anthony Liguori
2011-01-26 16:38 ` Avi Kivity
2011-01-26 17:12 ` Anthony Liguori
2011-01-27 9:25 ` Avi Kivity
2011-01-27 9:27 ` Kevin Wolf
2011-01-27 9:49 ` Avi Kivity [this message]
2011-01-27 10:34 ` Kevin Wolf
2011-01-27 10:41 ` Avi Kivity
2011-01-27 11:27 ` Kevin Wolf
2011-01-27 12:21 ` Avi Kivity
2011-01-26 16:08 ` Avi Kivity
2011-01-27 10:09 ` Stefan Hajnoczi
2011-01-27 10:46 ` Avi Kivity
2011-01-22 9:29 ` [Qemu-devel] [RFC][PATCH 12/12] qcow2: Serialize all requests Stefan Hajnoczi
2011-01-23 23:31 ` [Qemu-devel] [RFC][PATCH 00/12] qcow2: Convert qcow2 to use coroutines for async I/O Anthony Liguori
2011-02-01 13:23 ` Kevin Wolf
2011-01-24 11:58 ` [Qemu-devel] " Kevin Wolf
2011-01-24 13:10 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D413F98.4010205@redhat.com \
--to=avi@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).