qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>,
	Bandan Das <bsd@redhat.com>,
	qemu-stable@nongnu.org,
	"Daniel P. Berrange" <berrange@redhat.com>,
	mprivozn@redhat.com
Subject: [Qemu-devel] [PATCH v2 2/2] vl: Delay initialization of memory backends
Date: Fri,  2 Sep 2016 15:59:44 -0300	[thread overview]
Message-ID: <1472842784-15399-3-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1472842784-15399-1-git-send-email-ehabkost@redhat.com>

Initialization of memory backends may take a while when
prealloc=yes is used, depending on their size. Initializing
memory backends before chardevs may delay the creation of monitor
sockets, and trigger timeouts on management software that waits
until the monitor socket is created by QEMU. See, for example,
the bug report at:
https://bugzilla.redhat.com/show_bug.cgi?id=1371211

In addition to that, allocating memory before calling
configure_accelerator() breaks the tcg_enabled() checks at
memory_region_init_*().

This patch fixes those problems by adding "memory-backend-*"
classes to the delayed-initialization list.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes series v1 -> series v2:
* Changed comment and commit message to mention the
  dirty_log_mask initialization bug
---
 vl.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/vl.c b/vl.c
index b3c80d5..ee557a1 100644
--- a/vl.c
+++ b/vl.c
@@ -2810,6 +2810,19 @@ static bool object_create_initial(const char *type)
         return false;
     }
 
+    /* Memory allocation by backends needs to be done
+     * after configure_accelerator() (due to the tcg_enabled()
+     * checks at memory_region_init_*()).
+     *
+     * Also, allocation of large amounts of memory may delay
+     * chardev initialization for too long, and trigger timeouts
+     * on software that waits for a monitor socket to be created
+     * (e.g. libvirt).
+     */
+    if (g_str_has_prefix(type, "memory-backend-")) {
+        return false;
+    }
+
     return true;
 }
 
-- 
2.7.4

  parent reply	other threads:[~2016-09-02 19:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02 18:59 [Qemu-devel] [PATCH v2 0/2] Delay initialization of memory backends Eduardo Habkost
2016-09-02 18:59 ` [Qemu-devel] [PATCH v2 1/2] vhost-user-test: Use libqos instead of pxe-virtio.rom Eduardo Habkost
2016-09-02 18:59 ` Eduardo Habkost [this message]
2016-09-05  9:03 ` [Qemu-devel] [PATCH v2 0/2] Delay initialization of memory backends Markus Armbruster
2016-09-05 12:26 ` Paolo Bonzini
2016-09-05 19:01   ` Eduardo Habkost
2016-09-06  2:24     ` Michael S. Tsirkin
2016-09-06  7:39       ` Maxime Coquelin

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=1472842784-15399-3-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=bsd@redhat.com \
    --cc=mprivozn@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /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).