qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	mdroth@linux.vnet.ibm.com, Peter Xu <peterx@redhat.com>,
	qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [RFC 0/6] monitor: allow per-monitor thread
Date: Tue, 22 Aug 2017 10:15:56 +0800	[thread overview]
Message-ID: <20170822021556.GA2146@lemon> (raw)
In-Reply-To: <20170821172852.GA3236@work-vm>

On Mon, 08/21 18:28, Dr. David Alan Gilbert wrote:
> > It's not much more than asserting qemu_mutex_iothread_locked(), the problem is
> > the new monitor thread breaks certain assumptions that was true.
> > 
> > What is interesting in this is that block layer's nested aio_poll() now not only
> > run in the main thread but also in the monitor thread. Bugs may hide there.  :)
> > 
> > That's why I suggested a "safe by default" strategy.
> 
> OK, that's going to need some more flags somewhere; we've now
> effectively got three types of command:
>    a) Commands that can only run in the main thread
>    b) Commands that can run in other monitor threads, but must have the bql
>    c) Commands that can run in other monitor threads but don't take the
>    bql
> 
>    The class (a) that you point out are a pain; arguably if we have to
> split them up then perhaps we should initially only allow (c).
> 
> > One step back, is it possible to "unblock" main thread even upon network issue?
> > What is the scenario that causes main thread hang? Is there a backtrace?
> 
> There are at least 3 scenarious I know of:
> 
>   a) Postcopy: An IO operation takes the lock and accesses guest memory;
>      the guest memory is missing due to userfault'd memory.
>      Unfortunately the network connection to the source happens to fail;
>       so we never receive that page and the thread stays stuck in the userfault.
>      We can't issue a recovery command to reopen a network connection
>      because the monitor is blocked.
>   b) Postcopy: A monitor command either accesses guest memory or has
>      to wait on another thread that is doing; e.g. info cpu  waits
>      for the CPU threads to exit the loop, but they might be blocked
>      waiting on userfault.
>   c) COLO or migration: The network fails during the critical bit
>      at the end of migration when we have the bql held.  You can't
>      issue a migration_cancel or a colo-failover via the monitor
>      because it's blocked.

Thanks for explainaing!

What commands are in class (c)? From the cover letter it seems migrate-incoming
is the only one in mind, I'm not sure how it resolves any of the three
scenarios?

> 
> There are other advantages of being able to do bql'less commands;
> things like an 'info status' or the like should be doable without bql,
> so just avoding taking the bql when the management layer is doing
> stuff (or alternatively getting faster replies on management)
> are both useful.

Agreed. It is very useful not just for migration.

Fam

  reply	other threads:[~2017-08-22  2:16 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-21  7:44 [Qemu-devel] [RFC 0/6] monitor: allow per-monitor thread Peter Xu
2017-08-21  7:44 ` [Qemu-devel] [RFC 1/6] monitor: move skip_flush into monitor_data_init Peter Xu
2017-08-21  7:44 ` [Qemu-devel] [RFC 2/6] monitor: allow monitor to create thread to poll Peter Xu
2017-08-21  7:44 ` [Qemu-devel] [RFC 3/6] QAPI: new QMP command option "without-bql" Peter Xu
2017-08-21  7:44 ` [Qemu-devel] [RFC 4/6] migration: qmp: migrate_incoming don't need BQL Peter Xu
2017-08-21  7:44 ` [Qemu-devel] [RFC 5/6] hmp: support "without_bql" Peter Xu
2017-08-21  7:44 ` [Qemu-devel] [RFC 6/6] migration: hmp: migrate_incoming don't need BQL Peter Xu
2017-08-21  8:58 ` [Qemu-devel] [RFC 0/6] monitor: allow per-monitor thread Fam Zheng
2017-08-21 10:05   ` Peter Xu
2017-08-21 10:17     ` Dr. David Alan Gilbert
2017-08-21 14:04       ` Fam Zheng
2017-08-21 14:06         ` Dr. David Alan Gilbert
2017-08-21 13:57     ` Fam Zheng
2017-08-21 15:36       ` Dr. David Alan Gilbert
2017-08-21 16:54         ` Fam Zheng
2017-08-21 17:28           ` Dr. David Alan Gilbert
2017-08-22  2:15             ` Fam Zheng [this message]
2017-08-22  2:56               ` Peter Xu
2017-08-22  4:15                 ` Fam Zheng
2017-08-22  5:59                   ` Peter Xu
2017-08-22  6:33                     ` Fam Zheng
2017-08-22  6:56                       ` Peter Xu
2017-08-22  8:29                       ` Dr. David Alan Gilbert
2017-08-22  8:48                         ` Fam Zheng
2017-08-22  8:48                   ` Dr. David Alan Gilbert
2017-08-22  4:51 ` no-reply
2017-08-22  6:21   ` Peter Xu

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=20170822021556.GA2146@lemon \
    --to=famz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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).