From 7ba3f0b84b2b25d632c1b8cc5855999bf69c7c01bd9397eca9f741a7290de80c Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Thu, 9 Apr 2020 22:45:33 +0000 Subject: [PATCH] Another bug fix for the Factory libvirt package. OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=820 --- 8e669b38-conf-add-event-channels.patch | 120 ++++++++++++++ 967f4eeb-xenconfig-event-channels.patch | 210 ++++++++++++++++++++++++ a93f55c5-libxl-add-event-channels.patch | 190 +++++++++++++++++++++ libvirt.changes | 12 ++ libvirt.spec | 9 +- libxl-set-cach-mode.patch | 4 +- libxl-support-block-script.patch | 8 +- suse-bump-xen-version.patch | 2 +- suse-libxl-disable-autoballoon.patch | 4 +- suse-xen-ovmf-loaders.patch | 2 +- 10 files changed, 548 insertions(+), 13 deletions(-) create mode 100644 8e669b38-conf-add-event-channels.patch create mode 100644 967f4eeb-xenconfig-event-channels.patch create mode 100644 a93f55c5-libxl-add-event-channels.patch diff --git a/8e669b38-conf-add-event-channels.patch b/8e669b38-conf-add-event-channels.patch new file mode 100644 index 0000000..5d6e5e1 --- /dev/null +++ b/8e669b38-conf-add-event-channels.patch @@ -0,0 +1,120 @@ +commit 8e669b382c3533793356261c6d748df56162a2c6 +Author: Jim Fehlig +Date: Tue Apr 7 16:37:09 2020 -0600 + + conf: Add a new xenbus controller option for event channels + + Event channels are like PV interrupts and in conjuction with grant frames + form a data transfer mechanism for PV drivers. They are also used for + inter-processor interrupts. Guests with a large number of vcpus and/or + many PV devices many need to increase the maximum default value of 1023. + For this reason the native Xen config format supports the + 'max_event_channels' setting. See xl.cfg(5) man page for more details. + + Similar to the existing maxGrantFrames option, add a new xenbus controller + option 'maxEventChannels', allowing to adjust the maximum value via libvirt. + + Signed-off-by: Jim Fehlig + Reviewed-by: Daniel P. Berrangé + +Index: libvirt-6.2.0/docs/formatdomain.html.in +=================================================================== +--- libvirt-6.2.0.orig/docs/formatdomain.html.in ++++ libvirt-6.2.0/docs/formatdomain.html.in +@@ -4416,7 +4416,7 @@ + <driver iothread='4'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/> + </controller> +- <controller type='xenbus' maxGrantFrames='64'/> ++ <controller type='xenbus' maxGrantFrames='64' maxEventChannels='2047'/> + ... + </devices> + ... +@@ -4476,7 +4476,11 @@ +
Since 5.2.0, the xenbus + controller has an optional attribute maxGrantFrames, + which specifies the maximum number of grant frames the controller +- makes available for connected devices.
++ makes available for connected devices. ++ Since 6.3.0, the xenbus controller ++ supports the optional maxEventChannels attribute, ++ which specifies maximum number of event channels (PV interrupts) ++ that can be used by the guest. + + +

+Index: libvirt-6.2.0/docs/schemas/domaincommon.rng +=================================================================== +--- libvirt-6.2.0.orig/docs/schemas/domaincommon.rng ++++ libvirt-6.2.0/docs/schemas/domaincommon.rng +@@ -2548,6 +2548,11 @@ + + + ++ ++ ++ ++ ++ + + + +Index: libvirt-6.2.0/src/conf/domain_conf.c +=================================================================== +--- libvirt-6.2.0.orig/src/conf/domain_conf.c ++++ libvirt-6.2.0/src/conf/domain_conf.c +@@ -2245,6 +2245,7 @@ virDomainControllerDefNew(virDomainContr + break; + case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: + def->opts.xenbusopts.maxGrantFrames = -1; ++ def->opts.xenbusopts.maxEventChannels = -1; + break; + case VIR_DOMAIN_CONTROLLER_TYPE_IDE: + case VIR_DOMAIN_CONTROLLER_TYPE_FDC: +@@ -11337,6 +11338,7 @@ virDomainControllerDefParseXML(virDomain + break; + case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: { + g_autofree char *gntframes = virXMLPropString(node, "maxGrantFrames"); ++ g_autofree char *eventchannels = virXMLPropString(node, "maxEventChannels"); + + if (gntframes) { + int r = virStrToLong_i(gntframes, NULL, 10, +@@ -11347,6 +11349,15 @@ virDomainControllerDefParseXML(virDomain + goto error; + } + } ++ if (eventchannels) { ++ int r = virStrToLong_i(eventchannels, NULL, 10, ++ &def->opts.xenbusopts.maxEventChannels); ++ if (r != 0 || def->opts.xenbusopts.maxEventChannels < 0) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, ++ _("Invalid maxEventChannels: %s"), eventchannels); ++ goto error; ++ } ++ } + break; + } + +@@ -25267,6 +25278,10 @@ virDomainControllerDefFormat(virBufferPt + virBufferAsprintf(&attrBuf, " maxGrantFrames='%d'", + def->opts.xenbusopts.maxGrantFrames); + } ++ if (def->opts.xenbusopts.maxEventChannels != -1) { ++ virBufferAsprintf(&attrBuf, " maxEventChannels='%d'", ++ def->opts.xenbusopts.maxEventChannels); ++ } + break; + + default: +Index: libvirt-6.2.0/src/conf/domain_conf.h +=================================================================== +--- libvirt-6.2.0.orig/src/conf/domain_conf.h ++++ libvirt-6.2.0/src/conf/domain_conf.h +@@ -730,6 +730,7 @@ struct _virDomainUSBControllerOpts { + + struct _virDomainXenbusControllerOpts { + int maxGrantFrames; /* -1 == undef */ ++ int maxEventChannels; /* -1 == undef */ + }; + + /* Stores the virtual disk controller configuration */ diff --git a/967f4eeb-xenconfig-event-channels.patch b/967f4eeb-xenconfig-event-channels.patch new file mode 100644 index 0000000..03e588d --- /dev/null +++ b/967f4eeb-xenconfig-event-channels.patch @@ -0,0 +1,210 @@ +commit 967f4eebdcfed014fb8ad4569e9a04cdc731e9a6 +Author: Jim Fehlig +Date: Tue Apr 7 17:33:26 2020 -0600 + + xenconfig: Add support for max_event_channels + + Add support in the domXML<->native config converter for max_event_channels. + The parser and formater functions for max_grant_frames were reworked to + also parse max_event_channels. In doing so the xenbus controller is added + earlier in the config parsing, requiring a small adjustment to one of the + existing tests. Include a new test for the event channel conversion. + + Signed-off-by: Jim Fehlig + Reviewed-by: Daniel P. Berrangé + +Index: libvirt-6.2.0/src/libxl/xen_xl.c +=================================================================== +--- libvirt-6.2.0.orig/src/libxl/xen_xl.c ++++ libvirt-6.2.0/src/libxl/xen_xl.c +@@ -597,19 +597,12 @@ xenParseXLVnuma(virConfPtr conf, + } + #endif + +-#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS + static int +-xenParseXLGntLimits(virConfPtr conf, virDomainDefPtr def) ++xenParseXLXenbusLimits(virConfPtr conf, virDomainDefPtr def) + { +- unsigned long max_gntframes; + int ctlr_idx; + virDomainControllerDefPtr xenbus_ctlr; +- +- if (xenConfigGetULong(conf, "max_grant_frames", &max_gntframes, 0) < 0) +- return -1; +- +- if (max_gntframes <= 0) +- return 0; ++ unsigned long limit; + + ctlr_idx = virDomainControllerFindByType(def, VIR_DOMAIN_CONTROLLER_TYPE_XENBUS); + if (ctlr_idx == -1) +@@ -620,10 +613,20 @@ xenParseXLGntLimits(virConfPtr conf, vir + if (xenbus_ctlr == NULL) + return -1; + +- xenbus_ctlr->opts.xenbusopts.maxGrantFrames = max_gntframes; ++ if (xenConfigGetULong(conf, "max_event_channels", &limit, 0) < 0) ++ return -1; ++ if (limit > 0) ++ xenbus_ctlr->opts.xenbusopts.maxEventChannels = limit; ++ ++#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS ++ if (xenConfigGetULong(conf, "max_grant_frames", &limit, 0) < 0) ++ return -1; ++ if (limit > 0) ++ xenbus_ctlr->opts.xenbusopts.maxGrantFrames = limit; ++#endif ++ + return 0; + } +-#endif + + static int + xenParseXLDiskSrc(virDomainDiskDefPtr disk, char *srcstr) +@@ -1180,10 +1183,8 @@ xenParseXL(virConfPtr conf, + goto cleanup; + #endif + +-#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS +- if (xenParseXLGntLimits(conf, def) < 0) ++ if (xenParseXLXenbusLimits(conf, def) < 0) + goto cleanup; +-#endif + + if (xenParseXLCPUID(conf, def) < 0) + goto cleanup; +@@ -1532,23 +1533,31 @@ xenFormatXLDomainVnuma(virConfPtr conf, + } + #endif + +-#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS + static int +-xenFormatXLGntLimits(virConfPtr conf, virDomainDefPtr def) ++xenFormatXLXenbusLimits(virConfPtr conf, virDomainDefPtr def) + { + size_t i; + + for (i = 0; i < def->ncontrollers; i++) { +- if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_XENBUS && +- def->controllers[i]->opts.xenbusopts.maxGrantFrames > 0) { +- if (xenConfigSetInt(conf, "max_grant_frames", +- def->controllers[i]->opts.xenbusopts.maxGrantFrames) < 0) +- return -1; ++ if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_XENBUS) { ++ if (def->controllers[i]->opts.xenbusopts.maxEventChannels > 0) { ++ if (xenConfigSetInt(conf, "max_event_channels", ++ def->controllers[i]->opts.xenbusopts.maxEventChannels) < 0) ++ return -1; ++ } ++ ++#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS ++ if (def->controllers[i]->opts.xenbusopts.maxGrantFrames > 0) { ++ if (xenConfigSetInt(conf, "max_grant_frames", ++ def->controllers[i]->opts.xenbusopts.maxGrantFrames) < 0) ++ return -1; ++ } ++#endif + } + } ++ + return 0; + } +-#endif + + static char * + xenFormatXLDiskSrcNet(virStorageSourcePtr src) +@@ -2191,10 +2200,8 @@ xenFormatXL(virDomainDefPtr def, virConn + return NULL; + #endif + +-#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS +- if (xenFormatXLGntLimits(conf, def) < 0) ++ if (xenFormatXLXenbusLimits(conf, def) < 0) + return NULL; +-#endif + + if (xenFormatXLDomainDisks(conf, def) < 0) + return NULL; +Index: libvirt-6.2.0/tests/xlconfigdata/test-max-eventchannels.cfg +=================================================================== +--- /dev/null ++++ libvirt-6.2.0/tests/xlconfigdata/test-max-eventchannels.cfg +@@ -0,0 +1,13 @@ ++name = "XenGuest1" ++uuid = "45b60f51-88a9-47a8-a3b3-5e66d71b2283" ++maxmem = 512 ++memory = 512 ++vcpus = 1 ++localtime = 0 ++on_poweroff = "preserve" ++on_reboot = "restart" ++on_crash = "preserve" ++vif = [ "mac=5a:36:0e:be:00:09" ] ++bootloader = "/usr/bin/pygrub" ++max_event_channels = 2047 ++disk = [ "format=qcow2,vdev=xvda,access=rw,backendtype=qdisk,target=/var/lib/xen/images/debian/disk.qcow2" ] +Index: libvirt-6.2.0/tests/xlconfigdata/test-max-eventchannels.xml +=================================================================== +--- /dev/null ++++ libvirt-6.2.0/tests/xlconfigdata/test-max-eventchannels.xml +@@ -0,0 +1,32 @@ ++ ++ XenGuest1 ++ 45b60f51-88a9-47a8-a3b3-5e66d71b2283 ++ 524288 ++ 524288 ++ 1 ++ /usr/bin/pygrub ++ ++ linux ++ ++ ++ preserve ++ restart ++ preserve ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +Index: libvirt-6.2.0/tests/xlconfigdata/test-usbctrl.xml +=================================================================== +--- libvirt-6.2.0.orig/tests/xlconfigdata/test-usbctrl.xml ++++ libvirt-6.2.0/tests/xlconfigdata/test-usbctrl.xml +@@ -18,8 +18,8 @@ + + + +- + ++ + + + +Index: libvirt-6.2.0/tests/xlconfigtest.c +=================================================================== +--- libvirt-6.2.0.orig/tests/xlconfigtest.c ++++ libvirt-6.2.0/tests/xlconfigtest.c +@@ -294,6 +294,8 @@ mymain(void) + DO_TEST("max-gntframes"); + #endif + ++ DO_TEST("max-eventchannels"); ++ + DO_TEST("vif-typename"); + DO_TEST("vif-multi-ip"); + DO_TEST("usb"); diff --git a/a93f55c5-libxl-add-event-channels.patch b/a93f55c5-libxl-add-event-channels.patch new file mode 100644 index 0000000..ecbfb45 --- /dev/null +++ b/a93f55c5-libxl-add-event-channels.patch @@ -0,0 +1,190 @@ +commit a93f55c53d83ec63fe703db38cb519465b1d2445 +Author: Jim Fehlig +Date: Tue Apr 7 17:15:04 2020 -0600 + + libxl: Add support for max_event_channels + + Add support for setting event_channels in libxl domain config object and + include a test to check that it is properly converted from XML to libxl + domain config. + + Signed-off-by: Jim Fehlig + Reviewed-by: Daniel P. Berrangé + +Index: libvirt-6.2.0/src/libxl/libxl_conf.c +=================================================================== +--- libvirt-6.2.0.orig/src/libxl/libxl_conf.c ++++ libvirt-6.2.0/src/libxl/libxl_conf.c +@@ -380,13 +380,17 @@ libxlMakeDomBuildInfo(virDomainDefPtr de + b_info->max_memkb = virDomainDefGetMemoryInitial(def); + b_info->target_memkb = def->mem.cur_balloon; + +-#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS + for (i = 0; i < def->ncontrollers; i++) { +- if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_XENBUS && +- def->controllers[i]->opts.xenbusopts.maxGrantFrames > 0) +- b_info->max_grant_frames = def->controllers[i]->opts.xenbusopts.maxGrantFrames; +- } ++ if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_XENBUS) { ++ if (def->controllers[i]->opts.xenbusopts.maxEventChannels > 0) ++ b_info->event_channels = def->controllers[i]->opts.xenbusopts.maxEventChannels; ++ ++#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS ++ if (def->controllers[i]->opts.xenbusopts.maxGrantFrames > 0) ++ b_info->max_grant_frames = def->controllers[i]->opts.xenbusopts.maxGrantFrames; + #endif ++ } ++ } + + if (hvm || pvh) { + if (caps && +Index: libvirt-6.2.0/tests/libxlxml2domconfigdata/max-eventchannels-hvm.json +=================================================================== +--- /dev/null ++++ libvirt-6.2.0/tests/libxlxml2domconfigdata/max-eventchannels-hvm.json +@@ -0,0 +1,90 @@ ++{ ++ "c_info": { ++ "type": "hvm", ++ "name": "test-hvm", ++ "uuid": "2147d599-9cc6-c0dc-92ab-4064b5446e9b" ++ }, ++ "b_info": { ++ "max_vcpus": 4, ++ "avail_vcpus": [ ++ 0, ++ 1, ++ 2, ++ 3 ++ ], ++ "max_memkb": 1048576, ++ "target_memkb": 1048576, ++ "video_memkb": 8192, ++ "shadow_memkb": 12288, ++ "event_channels": 2047, ++ "device_model_version": "qemu_xen", ++ "device_model": "/bin/true", ++ "sched_params": { ++ ++ }, ++ "type.hvm": { ++ "pae": "True", ++ "apic": "True", ++ "acpi": "True", ++ "vga": { ++ "kind": "cirrus" ++ }, ++ "vnc": { ++ "enable": "True", ++ "listen": "0.0.0.0", ++ "findunused": "False" ++ }, ++ "sdl": { ++ "enable": "False" ++ }, ++ "spice": { ++ ++ }, ++ "boot": "c", ++ "rdm": { ++ ++ } ++ }, ++ "arch_arm": { ++ ++ } ++ }, ++ "disks": [ ++ { ++ "pdev_path": "/var/lib/xen/images/test-hvm.img", ++ "vdev": "hda", ++ "backend": "qdisk", ++ "format": "raw", ++ "removable": 1, ++ "readwrite": 1 ++ } ++ ], ++ "nics": [ ++ { ++ "devid": 0, ++ "mac": "00:16:3e:66:12:b4", ++ "bridge": "br0", ++ "script": "/etc/xen/scripts/vif-bridge", ++ "nictype": "vif_ioemu" ++ } ++ ], ++ "vfbs": [ ++ { ++ "devid": -1, ++ "vnc": { ++ "enable": "True", ++ "listen": "0.0.0.0", ++ "findunused": "False" ++ }, ++ "sdl": { ++ "enable": "False" ++ } ++ } ++ ], ++ "vkbs": [ ++ { ++ "devid": -1 ++ } ++ ], ++ "on_reboot": "restart" ++} +Index: libvirt-6.2.0/tests/libxlxml2domconfigdata/max-eventchannels-hvm.xml +=================================================================== +--- /dev/null ++++ libvirt-6.2.0/tests/libxlxml2domconfigdata/max-eventchannels-hvm.xml +@@ -0,0 +1,37 @@ ++ ++ test-hvm ++ None ++ 2147d599-9cc6-c0dc-92ab-4064b5446e9b ++ 1048576 ++ 1048576 ++ 4 ++ destroy ++ restart ++ destroy ++ ++ ++ hvm ++ /usr/lib/xen/boot/hvmloader ++ ++ ++ ++ ++ ++ ++ ++ ++ /bin/true ++ ++ ++ ++ ++ ++ ++ ++ ++ ++