qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Yaodong Yang <yaodong.yangy@icloud.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] AioContext, IOthread and Block migration thread
Date: Tue, 27 Aug 2013 09:52:11 +0200	[thread overview]
Message-ID: <20130827075211.GD24247@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <B42C9C0A-B2DA-4836-AC30-D1C39EF81612@icloud.com>

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

      reply	other threads:[~2013-08-27  7:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-26 15:07 [Qemu-devel] AioContext, IOthread and Block migration thread Yaodong Yang
2013-08-27  7:52 ` Stefan Hajnoczi [this message]

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=20130827075211.GD24247@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yaodong.yangy@icloud.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).