qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <famz@redhat.com>,
	qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [RFC] dataplane: IOThreads and writing dataplane-capable code
Date: Thu, 8 May 2014 14:44:35 +0100	[thread overview]
Message-ID: <20140508134435.GB2408@work-vm> (raw)
In-Reply-To: <20140508101655.GA7534@stefanha-thinkpad.redhat.com>

* Stefan Hajnoczi (stefanha@redhat.com) wrote:

<snip>

> How to synchronize with an IOThread
> -----------------------------------
> AioContext is not thread-safe so some rules must be followed when using file
> descriptors, event notifiers, timers, or BHs across threads:
> 
> 1. AioContext functions can be called safely from file descriptor, event
> notifier, timer, or BH callbacks invoked by the AioContext.  No locking is
> necessary.
> 
> 2. Other threads wishing to access the AioContext must use
> aio_context_acquire()/aio_context_release() for mutual exclusion.  Once the
> context is acquired no other thread can access it or run event loop iterations
> in this AioContext.
> 
> aio_context_acquire()/aio_context_release() calls may be nested.  This
> means you can call them if you're not sure whether #1 applies.
> 
> Side note: the best way to schedule a function call across threads is to create
> a BH in the target AioContext beforehand and then call qemu_bh_schedule().  No
> acquire/release or locking is needed for the qemu_bh_schedule() call.  But be
> sure to acquire the AioContext for aio_bh_new() if necessary.

How do these IOThreads pause during migration?
Are they paused by the 'qemu_mutex_lock_iothread' that the migration thread calls?

Dave
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  parent reply	other threads:[~2014-05-08 13:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08 10:16 [Qemu-devel] [RFC] dataplane: IOThreads and writing dataplane-capable code Stefan Hajnoczi
2014-05-08 11:33 ` Fam Zheng
2014-05-08 11:56   ` Stefan Hajnoczi
2014-05-08 12:12     ` Paolo Bonzini
2014-05-08 13:08 ` Kevin Wolf
2014-05-08 13:10   ` Paolo Bonzini
2014-05-08 13:18     ` Stefan Hajnoczi
2014-05-08 13:44 ` Dr. David Alan Gilbert [this message]
2014-05-08 14:42   ` Stefan Hajnoczi
2014-05-08 18:58     ` Dr. David Alan Gilbert
2014-05-09  8:20       ` 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=20140508134435.GB2408@work-vm \
    --to=dgilbert@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).