Xen queue

* cleanup patches.
 * improve xen backend setup performance when other xen guests are
   running/booting.
 * improve xen guest migration when running in a stubdomain.
 -----BEGIN PGP SIGNATURE-----
 
 iQFOBAABCgA4FiEE+AwAYwjiLP2KkueYDPVXL9f7Va8FAl+Os/8aHGFudGhvbnku
 cGVyYXJkQGNpdHJpeC5jb20ACgkQDPVXL9f7Va9dOwgAszgXkjlcNvoxBJsfAIPw
 wBRfui1bHjEyZe9Dq2R034bDHGrZxh7sIW4MzMzHzcbD4KkzypwHAaYfRcDmVmPz
 5NGmD6KxwmIxKQr8s0BzZ/vTVF6UuTT8iK4Vbau+m6AEFmonIUlncvWi6vDIZm2b
 C0HKGa14g0zyNL0PORjGuF7JR9urerHjyIbX6bFRfAoZYM47SsQR/RZPNAzvoYOq
 ESXSXIXGjLSOkKnjnlOpUq5AiBIk35o2PHGcYWmvV23ZwrKstM9YUgy9I++6/niw
 NopNGPmmqDUemoXuNdlTLshC6sf7IMof0Ic1qO7Et0O8UIOO5DbGbdV1zThhr3sH
 tQ==
 =V4Aj
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20201020' into staging

Xen queue

* cleanup patches.
* improve xen backend setup performance when other xen guests are
  running/booting.
* improve xen guest migration when running in a stubdomain.

# gpg: Signature made Tue 20 Oct 2020 10:55:11 BST
# gpg:                using RSA key F80C006308E22CFD8A92E7980CF5572FD7FB55AF
# gpg:                issuer "anthony.perard@citrix.com"
# gpg: Good signature from "Anthony PERARD <anthony.perard@gmail.com>" [marginal]
# gpg:                 aka "Anthony PERARD <anthony.perard@citrix.com>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 5379 2F71 024C 600F 778A  7161 D8D5 7199 DF83 42C8
#      Subkey fingerprint: F80C 0063 08E2 2CFD 8A92  E798 0CF5 572F D7FB 55AF

* remotes/aperard/tags/pull-xen-20201020:
  hw/xen: Set suppress-vmdesc for Xen machines
  xen-bus: reduce scope of backend watch
  xen: Rename XENBACKEND_DEVICE to XENBACKEND
  xen: xenguest is not used so is not needed

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-10-20 11:20:36 +01:00
commit 4c41341af7
8 changed files with 51 additions and 16 deletions

4
configure vendored
View File

@ -2532,7 +2532,7 @@ if test "$xen" != "disabled" ; then
xen_ctrl_version="$(printf '%d%02d%02d' \
$($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
xen=enabled
xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
xen_pc="xencontrol xenstore xenforeignmemory xengnttab"
xen_pc="$xen_pc xenevtchn xendevicemodel"
if $pkg_config --exists xentoolcore; then
xen_pc="$xen_pc xentoolcore"
@ -2541,7 +2541,7 @@ if test "$xen" != "disabled" ; then
xen_libs="$($pkg_config --libs $xen_pc)"
else
xen_libs="-lxenstore -lxenctrl -lxenguest"
xen_libs="-lxenstore -lxenctrl"
xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
# First we test whether Xen headers and libraries are available.

View File

@ -987,7 +987,7 @@ static void xenfv_4_2_machine_options(MachineClass *m)
pc_i440fx_4_2_machine_options(m);
m->desc = "Xen Fully-virtualized PC";
m->max_cpus = HVM_MAX_VCPUS;
m->default_machine_opts = "accel=xen";
m->default_machine_opts = "accel=xen,suppress-vmdesc=on";
}
DEFINE_PC_MACHINE(xenfv_4_2, "xenfv-4.2", pc_xen_hvm_init,
@ -999,7 +999,7 @@ static void xenfv_3_1_machine_options(MachineClass *m)
m->desc = "Xen Fully-virtualized PC";
m->alias = "xenfv";
m->max_cpus = HVM_MAX_VCPUS;
m->default_machine_opts = "accel=xen";
m->default_machine_opts = "accel=xen,suppress-vmdesc=on";
}
DEFINE_PC_MACHINE(xenfv, "xenfv-3.1", pc_xen_hvm_init,

View File

@ -37,8 +37,6 @@
#include "sysemu/block-backend.h"
#include "qemu/error-report.h"
#include "qemu/module.h"
#include <xenguest.h>
#include "qom/object.h"
//#define DEBUG_PLATFORM

View File

@ -41,6 +41,12 @@ static void xen_backend_table_add(XenBackendImpl *impl)
g_hash_table_insert(xen_backend_table_get(), (void *)impl->type, impl);
}
static const char **xen_backend_table_keys(unsigned int *count)
{
return (const char **)g_hash_table_get_keys_as_array(
xen_backend_table_get(), count);
}
static const XenBackendImpl *xen_backend_table_lookup(const char *type)
{
return g_hash_table_lookup(xen_backend_table_get(), type);
@ -70,6 +76,11 @@ void xen_backend_register(const XenBackendInfo *info)
xen_backend_table_add(impl);
}
const char **xen_backend_get_types(unsigned int *count)
{
return xen_backend_table_keys(count);
}
static QLIST_HEAD(, XenBackendInstance) backend_list;
static void xen_backend_list_add(XenBackendInstance *backend)

View File

@ -430,7 +430,15 @@ static void xen_bus_unrealize(BusState *bus)
trace_xen_bus_unrealize();
if (xenbus->backend_watch) {
xen_bus_remove_watch(xenbus, xenbus->backend_watch, NULL);
unsigned int i;
for (i = 0; i < xenbus->backend_types; i++) {
if (xenbus->backend_watch[i]) {
xen_bus_remove_watch(xenbus, xenbus->backend_watch[i], NULL);
}
}
g_free(xenbus->backend_watch);
xenbus->backend_watch = NULL;
}
@ -446,8 +454,11 @@ static void xen_bus_unrealize(BusState *bus)
static void xen_bus_realize(BusState *bus, Error **errp)
{
char *key = g_strdup_printf("%u", xen_domid);
XenBus *xenbus = XEN_BUS(bus);
unsigned int domid;
const char **type;
unsigned int i;
Error *local_err = NULL;
trace_xen_bus_realize();
@ -469,19 +480,32 @@ static void xen_bus_realize(BusState *bus, Error **errp)
module_call_init(MODULE_INIT_XEN_BACKEND);
xenbus->backend_watch =
xen_bus_add_watch(xenbus, "", /* domain root node */
"backend", xen_bus_backend_changed, &local_err);
if (local_err) {
/* This need not be treated as a hard error so don't propagate */
error_reportf_err(local_err,
"failed to set up enumeration watch: ");
type = xen_backend_get_types(&xenbus->backend_types);
xenbus->backend_watch = g_new(XenWatch *, xenbus->backend_types);
for (i = 0; i < xenbus->backend_types; i++) {
char *node = g_strdup_printf("backend/%s", type[i]);
xenbus->backend_watch[i] =
xen_bus_add_watch(xenbus, node, key, xen_bus_backend_changed,
&local_err);
if (local_err) {
/* This need not be treated as a hard error so don't propagate */
error_reportf_err(local_err,
"failed to set up '%s' enumeration watch: ",
type[i]);
}
g_free(node);
}
g_free(type);
g_free(key);
return;
fail:
xen_bus_unrealize(bus);
g_free(key);
}
static void xen_bus_unplug_request(HotplugHandler *hotplug,

View File

@ -31,6 +31,7 @@ void xen_backend_set_device(XenBackendInstance *backend,
XenDevice *xen_backend_get_device(XenBackendInstance *backend);
void xen_backend_register(const XenBackendInfo *info);
const char **xen_backend_get_types(unsigned int *nr);
void xen_backend_device_create(XenBus *xenbus, const char *type,
const char *name, QDict *opts, Error **errp);

View File

@ -66,7 +66,8 @@ struct XenBus {
domid_t backend_id;
struct xs_handle *xsh;
XenWatchList *watch_list;
XenWatch *backend_watch;
unsigned int backend_types;
XenWatch **backend_watch;
QLIST_HEAD(, XenDevice) inactive_devices;
};

View File

@ -11,7 +11,7 @@
#define TYPE_XENBACKEND "xen-backend"
typedef struct XenLegacyDevice XenLegacyDevice;
DECLARE_INSTANCE_CHECKER(XenLegacyDevice, XENBACKEND_DEVICE,
DECLARE_INSTANCE_CHECKER(XenLegacyDevice, XENBACKEND,
TYPE_XENBACKEND)
/* variables */