Skip to content

Commit

Permalink
vl: Delay initialization of memory backends
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ehabkost committed Sep 5, 2016
1 parent cdafe92 commit 6546d0d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions vl.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6546d0d

Please sign in to comment.