qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: "Chunqiang (CQ) Tang" <tangchq@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] thread synchronization in qcow2.c and qcow2-cluster.c
Date: Tue, 27 Apr 2010 20:49:09 +0100	[thread overview]
Message-ID: <w2rfbd9d3991004271249sd088419diba35b1a5c0a20458@mail.gmail.com> (raw)
In-Reply-To: <s2g50c1b8771004270906v69ad619cycc188f212fb0440a@mail.gmail.com>

On Tue, Apr 27, 2010 at 5:06 PM, Chunqiang (CQ) Tang <tangchq@gmail.com> wrote:
> I just started to read the code of qemu-kvm-0.12.3 recently, and was
> puzzled by the thread synchronization issue in qcow2.c and
> qcow2-cluster.c. Could someone please enlighten me? Thanks!

Is this what you are looking for:

kvm-all.c:kvm_cpu_exec:
        qemu_mutex_unlock_iothread();
        ret = kvm_vcpu_ioctl(env, KVM_RUN, 0);
        qemu_mutex_lock_iothread();

and

vl.c:main_loop_wait:
    ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv);
    qemu_mutex_lock_iothread();
    if (ret > 0) {
        IOHandlerRecord *pioh;

        QLIST_FOREACH_SAFE(ioh, &io_handlers, next, pioh) {

If I understand correctly the global iothread mutex prevents block
driver code from executing concurrently.

Stefan

  reply	other threads:[~2010-04-27 19:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-27 16:06 [Qemu-devel] thread synchronization in qcow2.c and qcow2-cluster.c Chunqiang (CQ) Tang
2010-04-27 19:49 ` Stefan Hajnoczi [this message]
2010-04-27 20:39   ` Chunqiang (CQ) Tang
2010-04-27 21:26     ` Stefan Hajnoczi
2010-04-28  8:13       ` Stefan Hajnoczi
2010-04-28 14:59         ` Chunqiang (CQ) Tang
2010-04-28  9:08     ` Kevin Wolf

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=w2rfbd9d3991004271249sd088419diba35b1a5c0a20458@mail.gmail.com \
    --to=stefanha@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tangchq@gmail.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).