From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: xen-devel@lists.xen.org
Cc: "Wei Liu" <wei.liu2@citrix.com>,
"Ian Jackson" <ian.jackson@eu.citrix.com>,
"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Subject: [PATCH v2 2/2] libxl: do not start dom0 qemu for stubdomain when not needed
Date: Fri, 28 Jul 2017 18:42:14 +0200 [thread overview]
Message-ID: <1501260134-11837-2-git-send-email-marmarek@invisiblethingslab.com> (raw)
In-Reply-To: <1501260134-11837-1-git-send-email-marmarek@invisiblethingslab.com>
Do not setup vfb+vkb when no access method was configured. Then check if
qemu is really needed.
The only not configurable thing forcing qemu running in dom0 after this
change are consoles used to save/restore. But even in that case, there
is much smaller part of qemu exposed.
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
tools/libxl/libxl_dm.c | 54 ++++++++++++++++++++++++++++++++++++--------------
1 file changed, 39 insertions(+), 15 deletions(-)
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 44ebd70..e0e6a99 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -1868,13 +1868,17 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
ret = libxl__domain_build_info_setdefault(gc, &dm_config->b_info);
if (ret) goto out;
- GCNEW(vfb);
- GCNEW(vkb);
- libxl__vfb_and_vkb_from_hvm_guest_config(gc, guest_config, vfb, vkb);
- dm_config->vfbs = vfb;
- dm_config->num_vfbs = 1;
- dm_config->vkbs = vkb;
- dm_config->num_vkbs = 1;
+ if (libxl_defbool_val(guest_config->b_info.u.hvm.vnc.enable)
+ || libxl_defbool_val(guest_config->b_info.u.hvm.spice.enable)
+ || libxl_defbool_val(guest_config->b_info.u.hvm.sdl.enable)) {
+ GCNEW(vfb);
+ GCNEW(vkb);
+ libxl__vfb_and_vkb_from_hvm_guest_config(gc, guest_config, vfb, vkb);
+ dm_config->vfbs = vfb;
+ dm_config->num_vfbs = 1;
+ dm_config->vkbs = vkb;
+ dm_config->num_vkbs = 1;
+ }
stubdom_state->pv_kernel.path
= libxl__abs_path(gc, "ioemu-stubdom.gz", libxl__xenfirmwaredir_path());
@@ -1959,6 +1963,7 @@ static void spawn_stub_launch_dm(libxl__egc *egc,
libxl__domain_build_state *const d_state = sdss->dm.build_state;
libxl__domain_build_state *const stubdom_state = &sdss->dm_state;
uint32_t dm_domid = sdss->pvqemu.guest_domid;
+ int need_qemu;
if (ret) {
LOGD(ERROR, guest_domid, "error connecting disk devices");
@@ -1975,12 +1980,16 @@ static void spawn_stub_launch_dm(libxl__egc *egc,
if (ret)
goto out;
}
- ret = libxl__device_vfb_add(gc, dm_domid, &dm_config->vfbs[0]);
- if (ret)
- goto out;
- ret = libxl__device_vkb_add(gc, dm_domid, &dm_config->vkbs[0]);
- if (ret)
- goto out;
+ if (dm_config->num_vfbs) {
+ ret = libxl__device_vfb_add(gc, dm_domid, &dm_config->vfbs[0]);
+ if (ret)
+ goto out;
+ }
+ if (dm_config->num_vkbs) {
+ ret = libxl__device_vkb_add(gc, dm_domid, &dm_config->vkbs[0]);
+ if (ret)
+ goto out;
+ }
if (guest_config->b_info.u.hvm.serial)
num_console++;
@@ -1988,7 +1997,6 @@ static void spawn_stub_launch_dm(libxl__egc *egc,
console = libxl__calloc(gc, num_console, sizeof(libxl__device_console));
for (i = 0; i < num_console; i++) {
- libxl__device device;
console[i].devid = i;
console[i].consback = LIBXL__CONSOLE_BACKEND_IOEMU;
/* STUBDOM_CONSOLE_LOGGING (console 0) is for minios logging
@@ -2005,6 +2013,9 @@ static void spawn_stub_launch_dm(libxl__egc *egc,
if (ret) goto out;
console[i].output = GCSPRINTF("file:%s", filename);
free(filename);
+ /* will be changed back to LIBXL__CONSOLE_BACKEND_IOEMU if qemu
+ * will be in use */
+ console[i].consback = LIBXL__CONSOLE_BACKEND_XENCONSOLED;
break;
case STUBDOM_CONSOLE_SAVE:
console[i].output = GCSPRINTF("file:%s",
@@ -2019,6 +2030,14 @@ static void spawn_stub_launch_dm(libxl__egc *egc,
console[i].output = "pty";
break;
}
+ }
+
+ need_qemu = libxl__need_xenpv_qemu(gc, dm_config);
+
+ for (i = 0; i < num_console; i++) {
+ libxl__device device;
+ if (need_qemu)
+ console[i].consback = LIBXL__CONSOLE_BACKEND_IOEMU;
ret = libxl__device_console_add(gc, dm_domid, &console[i],
i == STUBDOM_CONSOLE_LOGGING ? stubdom_state : NULL,
&device);
@@ -2032,7 +2051,12 @@ static void spawn_stub_launch_dm(libxl__egc *egc,
sdss->pvqemu.build_state = &sdss->dm_state;
sdss->pvqemu.callback = spawn_stubdom_pvqemu_cb;
- libxl__spawn_local_dm(egc, &sdss->pvqemu);
+ if (!need_qemu) {
+ /* If dom0 qemu not needed, do not launch it */
+ spawn_stubdom_pvqemu_cb(egc, &sdss->pvqemu, 0);
+ } else {
+ libxl__spawn_local_dm(egc, &sdss->pvqemu);
+ }
return;
--
2.7.5
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-07-28 16:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-28 16:42 [PATCH v2 1/2] libxl: use xen-blkback for 'vbd' disk types by default Marek Marczykowski-Górecki
2017-07-28 16:42 ` Marek Marczykowski-Górecki [this message]
2017-07-31 16:23 ` [PATCH v2 2/2] libxl: do not start dom0 qemu for stubdomain when not needed Wei Liu
2017-07-31 16:36 ` Ian Jackson
2017-07-31 15:56 ` [PATCH v2 1/2] libxl: use xen-blkback for 'vbd' disk types by default Wei Liu
2017-07-31 16:01 ` Wei Liu
2017-08-01 12:02 ` Marek Marczykowski-Górecki
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=1501260134-11837-2-git-send-email-marmarek@invisiblethingslab.com \
--to=marmarek@invisiblethingslab.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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).