* [Qemu-devel] AioContext, IOthread and Block migration thread
@ 2013-08-26 15:07 Yaodong Yang
2013-08-27 7:52 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Yaodong Yang @ 2013-08-26 15:07 UTC (permalink / raw)
To: qemu-devel@nongnu.org; +Cc: Yaodong Yang
I'm a newer in QEMU, and I have the following questions:
1. Is it true that all the requests to disk images need to go through function bdrv_co_do_readv() or bdrv_co_do_writev()?
2. In block-migration thread, the bdrv_co_do_readv is also called to read blocks from disk images, in order to finish migration. How do migration thread and IOthread cooperate with each other? there is an coroutine created inside migration thread and a new botoom half created for this purpose, but I do not understand well about it. Could someone explain it for me?
3. What is the meaning of copy on read ?
Thanks!
Yaodong
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] AioContext, IOthread and Block migration thread
2013-08-26 15:07 [Qemu-devel] AioContext, IOthread and Block migration thread Yaodong Yang
@ 2013-08-27 7:52 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2013-08-27 7:52 UTC (permalink / raw)
To: Yaodong Yang; +Cc: qemu-devel@nongnu.org
On Mon, Aug 26, 2013 at 10:07:23AM -0500, Yaodong Yang wrote:
> 1. Is it true that all the requests to disk images need to go through function bdrv_co_do_readv() or bdrv_co_do_writev()?
Yes, read/write requests go through those functions.
> 2. In block-migration thread, the bdrv_co_do_readv is also called to read blocks from disk images, in order to finish migration. How do migration thread and IOthread cooperate with each other? there is an coroutine created inside migration thread and a new botoom half created for this purpose, but I do not understand well about it. Could someone explain it for me?
QEMU has a global mutex (big lock) that is used to protect shared data:
/* In migration thread: */
qemu_mutex_lock_iothread();
bdrv_*(bs, ...);
qemu_mutex_unlock_iothread();
> 3. What is the meaning of copy on read ?
Copy-on-read means that an image file is populated when read requests
are processed.
It's used together with backing files:
template.img <- vm001.qcow2
In the beginning vm001.qcow2 might be empty so all reads go to
template.img. When copy-on-read is enabled, data read from template.img
will be written to vm001.qcow2. The next time a read is made to the
same sectors they can be fetched from vm001.qcow2 instead.
This is a useful feature for migrating (copying) an image to a new file
system while the guest is still running. It can also be used to reduce
network load when template.img is on NFS.
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-27 7:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-26 15:07 [Qemu-devel] AioContext, IOthread and Block migration thread Yaodong Yang
2013-08-27 7:52 ` Stefan Hajnoczi
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).