Hello community, here is the log from the commit of package xen for openSUSE:Factory checked in at 2020-12-21 10:22:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xen (Old) and /work/SRC/openSUSE:Factory/.xen.new.5145 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xen" Mon Dec 21 10:22:13 2020 rev:294 rq:856892 version:4.14.1_02 Changes: -------- --- /work/SRC/openSUSE:Factory/xen/xen.changes 2020-11-12 22:33:05.637777007 +0100 +++ /work/SRC/openSUSE:Factory/.xen.new.5145/xen.changes 2020-12-21 10:22:48.911948729 +0100 @@ -1,0 +2,127 @@ +Thu Dec 17 10:15:31 MST 2020 - carn...@suse.com + +- Update to Xen 4.14.1 bug fix release (bsc#1027519) + xen-4.14.1-testing-src.tar.bz2 + Contains the following recent security fixes + bsc#1179516 XSA-359 - CVE-2020-29571 + bsc#1179514 XSA-358 - CVE-2020-29570 + bsc#1179513 XSA-356 - CVE-2020-29567 + bsc#1178963 XSA-355 - CVE-2020-29040 + bsc#1178591 XSA-351 - CVE-2020-28368 + bsc#1179506 XSA-348 - CVE-2020-29566 + bsc#1179502 XSA-325 - CVE-2020-29483 + bsc#1179501 XSA-324 - CVE-2020-29484 + bsc#1179498 XSA-322 - CVE-2020-29481 + bsc#1179496 XSA-115 - CVE-2020-29480 +- Dropped patches contained in new tarball + 5f1a9916-x86-S3-put-data-sregs-into-known-state.patch + 5f21b9fd-x86-cpuid-APIC-bit-clearing.patch + 5f479d9e-x86-begin-to-support-MSR_ARCH_CAPS.patch + 5f4cf06e-x86-Dom0-expose-MSR_ARCH_CAPS.patch + 5f4cf96a-x86-PV-fix-SEGBASE_GS_USER_SEL.patch + 5f560c42-x86-PV-64bit-segbase-consistency.patch + 5f560c42-x86-PV-rewrite-segment-ctxt-switch.patch + 5f5b6b7a-hypfs-fix-custom-param-writes.patch + 5f607915-x86-HVM-more-consistent-IO-completion.patch + 5f6a002d-x86-PV-handle-MSR_MISC_ENABLE-correctly.patch + 5f6a0049-memory-dont-skip-RCU-unlock-in-acquire_resource.patch + 5f6a0067-x86-vPT-fix-race-when-migrating-timers.patch + 5f6a008e-x86-MSI-drop-read_msi_msg.patch + 5f6a00aa-x86-MSI-X-restrict-reading-of-PBA-bases.patch + 5f6a00c4-evtchn-relax-port_is_valid.patch + 5f6a00df-x86-PV-avoid-double-exception-injection.patch + 5f6a00f4-evtchn-add-missing-barriers.patch + 5f6a0111-evtchn-x86-enforce-correct-upper-limit.patch + 5f6a013f-evtchn_reset-shouldnt-succeed-with.patch + 5f6a0160-evtchn-IRQ-safe-per-channel-lock.patch + 5f6a0178-evtchn-address-races-with-evtchn_reset.patch + 5f6a01a4-evtchn-preempt-in-evtchn_destroy.patch + 5f6a01c6-evtchn-preempt-in-evtchn_reset.patch + 5f6cfb5b-x86-PV-dont-GP-for-SYSENTER-with-NT-set.patch + 5f6cfb5b-x86-PV-dont-clobber-NT-on-return-to-guest.patch + 5f71a21e-x86-S3-fix-shadow-stack-resume.patch + 5f76ca65-evtchn-Flask-prealloc-for-send.patch + 5f76caaf-evtchn-FIFO-use-stable-fields.patch + 5f897c25-x86-traps-fix-read_registers-for-DF.patch + 5f897c7b-x86-smpboot-restrict-memguard_guard_stack.patch + 5f8ed5d3-x86-mm-map_pages_to_xen-single-exit-path.patch + 5f8ed5eb-x86-mm-modify_xen_mappings-one-exit-path.patch + 5f8ed603-x86-mm-prevent-races-in-mapping-updates.patch + 5f8ed635-IOMMU-suppress-iommu_dont_flush_iotlb-when.patch + 5f8ed64c-IOMMU-hold-page-ref-until-TLB-flush.patch + 5f8ed682-AMD-IOMMU-convert-amd_iommu_pte.patch + 5f8ed69c-AMD-IOMMU-update-live-PTEs-atomically.patch + 5f8ed6b0-AMD-IOMMU-suitably-order-DTE-mods.patch + xsa286-1.patch + xsa286-2.patch + xsa286-3.patch + xsa286-4.patch + xsa286-5.patch + xsa286-6.patch + xsa351-1.patch + xsa351-2.patch + xsa351-3.patch + xsa355.patch + +------------------------------------------------------------------- +Tue Dec 15 15:15:15 UTC 2020 - oher...@suse.de + +- bsc#1178736 - allow restart of xenwatchdogd, enable tuning of + keep-alive interval and timeout options via XENWATCHDOGD_ARGS= + add xenwatchdogd-options.patch + add xenwatchdogd-restart.patch + +------------------------------------------------------------------- +Tue Dec 15 10:10:10 UTC 2020 - oher...@suse.de + +- bsc#1177112 - Fix libxc.sr.superpage.patch + The receiving side may punch holes incorrectly into optimistically + allocated superpages. Also reduce overhead in bitmap handling. + add libxc-bitmap-50a5215f30e964a6f16165ab57925ca39f31a849.patch + add libxc-bitmap-long.patch + add libxc-bitmap-longs.patch + +------------------------------------------------------------------- +Mon Dec 14 14:22:08 MST 2020 - carn...@suse.com + +- boo#1029961 - Move files in xen-tools-domU to /usr/bin from /bin + xen-destdir.patch + Drop tmp_build.patch + +------------------------------------------------------------------- +Fri Dec 4 06:54:08 MST 2020 - carn...@suse.com + +- bsc#1176782 - L3: xl dump-core shows missing nr_pages during + core. If maxmem and current are the same the issue doesn't happen + 5fca3b32-tools-libs-ctrl-fix-dumping-of-ballooned-guest.patch + +------------------------------------------------------------------- +Fri Nov 20 15:09:49 MST 2020 - carn...@suse.com + +- bsc#1178963 - VUL-0: xen: stack corruption from XSA-346 change + (XSA-355) + xsa355.patch + +------------------------------------------------------------------- +Fri Nov 20 20:20:20 UTC 2020 - oher...@suse.de + +- Fix build error with libxl.fix-libacpi-dependency.patch + +------------------------------------------------------------------- +Fri Nov 20 19:19:19 UTC 2020 - oher...@suse.de + +- Enhance libxc.migrate_tracking.patch + Hide SUSEINFO messages from pause/unpause/resume from xl command. + They are intended for libvirt logging, but lacked info about + execution context. + Remove extra logging about dirty pages in each iteration, the + number of transferred pages + protocol overhead is already + reported elsewhere. + +------------------------------------------------------------------- +Fri Nov 20 18:18:18 UTC 2020 - oher...@suse.de + +- Remove libxl.libxl__domain_pvcontrol.patch + It is already part of 4.14.0-rc1 + +------------------------------------------------------------------- @@ -4,2 +131,2 @@ -- bsc#1178591 - VUL-0: xen: Intel RAPL sidechannel attack aka - PLATYPUS attack aka XSA-351 +- bsc#1178591 - VUL-0: CVE-2020-28368: xen: Intel RAPL sidechannel + attack aka PLATYPUS attack aka XSA-351 @@ -101,2 +228,2 @@ -- bsc#1177409 - VUL-0: xen: x86 PV guest INVLPG-like flushes may - leave stale TLB entries (XSA-286) +- bsc#1177409 - VUL-0: CVE-2020-27674: xen: x86 PV guest + INVLPG-like flushes may leave stale TLB entries (XSA-286) @@ -109,2 +236,2 @@ -- bsc#1177412 - VUL-0: xen: Race condition in Xen mapping code - (XSA-345) +- bsc#1177412 - VUL-0: CVE-2020-27672: xen: Race condition in Xen + mapping code (XSA-345) @@ -114,2 +241,2 @@ -- bsc#1177413 - VUL-0: xen: undue deferral of IOMMU TLB flushes - (XSA-346) +- bsc#1177413 - VUL-0: CVE-2020-27671: xen: undue deferral of IOMMU + TLB flushes (XSA-346) @@ -118,2 +245,2 @@ -- bsc#1177414 - VUL-0: xen: unsafe AMD IOMMU page table updates - (XSA-347) +- bsc#1177414 - VUL-0: CVE-2020-27670: xen: unsafe AMD IOMMU page + table updates (XSA-347) Old: ---- 5f1a9916-x86-S3-put-data-sregs-into-known-state.patch 5f21b9fd-x86-cpuid-APIC-bit-clearing.patch 5f479d9e-x86-begin-to-support-MSR_ARCH_CAPS.patch 5f4cf06e-x86-Dom0-expose-MSR_ARCH_CAPS.patch 5f4cf96a-x86-PV-fix-SEGBASE_GS_USER_SEL.patch 5f560c42-x86-PV-64bit-segbase-consistency.patch 5f560c42-x86-PV-rewrite-segment-ctxt-switch.patch 5f5b6b7a-hypfs-fix-custom-param-writes.patch 5f607915-x86-HVM-more-consistent-IO-completion.patch 5f6a002d-x86-PV-handle-MSR_MISC_ENABLE-correctly.patch 5f6a0049-memory-dont-skip-RCU-unlock-in-acquire_resource.patch 5f6a0067-x86-vPT-fix-race-when-migrating-timers.patch 5f6a008e-x86-MSI-drop-read_msi_msg.patch 5f6a00aa-x86-MSI-X-restrict-reading-of-PBA-bases.patch 5f6a00c4-evtchn-relax-port_is_valid.patch 5f6a00df-x86-PV-avoid-double-exception-injection.patch 5f6a00f4-evtchn-add-missing-barriers.patch 5f6a0111-evtchn-x86-enforce-correct-upper-limit.patch 5f6a013f-evtchn_reset-shouldnt-succeed-with.patch 5f6a0160-evtchn-IRQ-safe-per-channel-lock.patch 5f6a0178-evtchn-address-races-with-evtchn_reset.patch 5f6a01a4-evtchn-preempt-in-evtchn_destroy.patch 5f6a01c6-evtchn-preempt-in-evtchn_reset.patch 5f6cfb5b-x86-PV-dont-GP-for-SYSENTER-with-NT-set.patch 5f6cfb5b-x86-PV-dont-clobber-NT-on-return-to-guest.patch 5f71a21e-x86-S3-fix-shadow-stack-resume.patch 5f76ca65-evtchn-Flask-prealloc-for-send.patch 5f76caaf-evtchn-FIFO-use-stable-fields.patch 5f897c25-x86-traps-fix-read_registers-for-DF.patch 5f897c7b-x86-smpboot-restrict-memguard_guard_stack.patch 5f8ed5d3-x86-mm-map_pages_to_xen-single-exit-path.patch 5f8ed5eb-x86-mm-modify_xen_mappings-one-exit-path.patch 5f8ed603-x86-mm-prevent-races-in-mapping-updates.patch 5f8ed635-IOMMU-suppress-iommu_dont_flush_iotlb-when.patch 5f8ed64c-IOMMU-hold-page-ref-until-TLB-flush.patch 5f8ed682-AMD-IOMMU-convert-amd_iommu_pte.patch 5f8ed69c-AMD-IOMMU-update-live-PTEs-atomically.patch 5f8ed6b0-AMD-IOMMU-suitably-order-DTE-mods.patch libxl.libxl__domain_pvcontrol.patch tmp_build.patch xen-4.14.0-testing-src.tar.bz2 xsa286-1.patch xsa286-2.patch xsa286-3.patch xsa286-4.patch xsa286-5.patch xsa286-6.patch xsa351-1.patch xsa351-2.patch xsa351-3.patch New: ---- 5fca3b32-tools-libs-ctrl-fix-dumping-of-ballooned-guest.patch libxc-bitmap-50a5215f30e964a6f16165ab57925ca39f31a849.patch libxc-bitmap-long.patch libxc-bitmap-longs.patch libxl.fix-libacpi-dependency.patch xen-4.14.1-testing-src.tar.bz2 xenwatchdogd-options.patch xenwatchdogd-restart.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xen.spec ++++++ --- /var/tmp/diff_new_pack.emQGk0/_old 2020-12-21 10:22:51.979951424 +0100 +++ /var/tmp/diff_new_pack.emQGk0/_new 2020-12-21 10:22:51.983951427 +0100 @@ -25,7 +25,7 @@ Name: xen ExclusiveArch: %ix86 x86_64 aarch64 %define changeset 41121 -%define xen_build_dir xen-4.14.0-testing +%define xen_build_dir xen-4.14.1-testing # %define with_gdbsx 0 %define with_dom0_support 0 @@ -125,12 +125,12 @@ BuildRequires: pesign-obs-integration %endif -Version: 4.14.0_12 +Version: 4.14.1_02 Release: 0 Summary: Xen Virtualization: Hypervisor (aka VMM aka Microkernel) License: GPL-2.0-only Group: System/Kernel -Source0: xen-4.14.0-testing-src.tar.bz2 +Source0: xen-4.14.1-testing-src.tar.bz2 Source1: stubdom.tar.bz2 Source5: ipxe.tar.bz2 Source6: mini-os.tar.bz2 @@ -163,54 +163,8 @@ # For xen-libs Source99: baselibs.conf # Upstream patches -Patch1: 5f1a9916-x86-S3-put-data-sregs-into-known-state.patch -Patch2: 5f21b9fd-x86-cpuid-APIC-bit-clearing.patch -Patch3: 5f479d9e-x86-begin-to-support-MSR_ARCH_CAPS.patch -Patch4: 5f4cf06e-x86-Dom0-expose-MSR_ARCH_CAPS.patch -Patch5: 5f4cf96a-x86-PV-fix-SEGBASE_GS_USER_SEL.patch -Patch6: 5f560c42-x86-PV-64bit-segbase-consistency.patch -Patch7: 5f560c42-x86-PV-rewrite-segment-ctxt-switch.patch -Patch8: 5f5b6b7a-hypfs-fix-custom-param-writes.patch -Patch9: 5f607915-x86-HVM-more-consistent-IO-completion.patch -Patch10: 5f6a002d-x86-PV-handle-MSR_MISC_ENABLE-correctly.patch -Patch11: 5f6a0049-memory-dont-skip-RCU-unlock-in-acquire_resource.patch -Patch12: 5f6a0067-x86-vPT-fix-race-when-migrating-timers.patch -Patch13: 5f6a008e-x86-MSI-drop-read_msi_msg.patch -Patch14: 5f6a00aa-x86-MSI-X-restrict-reading-of-PBA-bases.patch -Patch15: 5f6a00c4-evtchn-relax-port_is_valid.patch -Patch16: 5f6a00df-x86-PV-avoid-double-exception-injection.patch -Patch17: 5f6a00f4-evtchn-add-missing-barriers.patch -Patch18: 5f6a0111-evtchn-x86-enforce-correct-upper-limit.patch -Patch19: 5f6a013f-evtchn_reset-shouldnt-succeed-with.patch -Patch20: 5f6a0160-evtchn-IRQ-safe-per-channel-lock.patch -Patch21: 5f6a0178-evtchn-address-races-with-evtchn_reset.patch -Patch22: 5f6a01a4-evtchn-preempt-in-evtchn_destroy.patch -Patch23: 5f6a01c6-evtchn-preempt-in-evtchn_reset.patch -Patch24: 5f6cfb5b-x86-PV-dont-clobber-NT-on-return-to-guest.patch -Patch25: 5f6cfb5b-x86-PV-dont-GP-for-SYSENTER-with-NT-set.patch -Patch26: 5f71a21e-x86-S3-fix-shadow-stack-resume.patch -Patch27: 5f76ca65-evtchn-Flask-prealloc-for-send.patch -Patch28: 5f76caaf-evtchn-FIFO-use-stable-fields.patch -Patch29: 5f897c25-x86-traps-fix-read_registers-for-DF.patch -Patch30: 5f897c7b-x86-smpboot-restrict-memguard_guard_stack.patch -Patch31: 5f8ed5d3-x86-mm-map_pages_to_xen-single-exit-path.patch -Patch32: 5f8ed5eb-x86-mm-modify_xen_mappings-one-exit-path.patch -Patch33: 5f8ed603-x86-mm-prevent-races-in-mapping-updates.patch -Patch34: 5f8ed635-IOMMU-suppress-iommu_dont_flush_iotlb-when.patch -Patch35: 5f8ed64c-IOMMU-hold-page-ref-until-TLB-flush.patch -Patch36: 5f8ed682-AMD-IOMMU-convert-amd_iommu_pte.patch -Patch37: 5f8ed69c-AMD-IOMMU-update-live-PTEs-atomically.patch -Patch38: 5f8ed6b0-AMD-IOMMU-suitably-order-DTE-mods.patch -Patch28601: xsa286-1.patch -Patch28602: xsa286-2.patch -Patch28603: xsa286-3.patch -Patch28604: xsa286-4.patch -Patch28605: xsa286-5.patch -Patch28606: xsa286-6.patch -Patch35101: xsa351-1.patch -Patch35102: xsa351-2.patch -Patch35103: xsa351-3.patch -# +Patch1: 5fca3b32-tools-libs-ctrl-fix-dumping-of-ballooned-guest.patch +# libxc Patch300: libxc-sr-3cccdae45242dab27198b8e150be0c85acd5d3c9.patch Patch301: libxc-sr-readv_exact.patch Patch302: libxc-sr-add-xc_is_known_page_type.patch @@ -235,6 +189,9 @@ Patch321: libxc-sr-restore-read_record.patch Patch322: libxc-sr-restore-handle_buffered_page_data.patch Patch323: libxc-sr-restore-handle_incoming_page_data.patch +Patch324: libxc-bitmap-50a5215f30e964a6f16165ab57925ca39f31a849.patch +Patch325: libxc-bitmap-longs.patch +Patch326: libxc-bitmap-long.patch # Our platform specific patches Patch400: xen-destdir.patch Patch401: vif-bridge-no-iptables.patch @@ -268,7 +225,7 @@ Patch465: xen.libxl.dmmd.patch Patch466: libxl.set-migration-constraints-from-cmdline.patch Patch467: xenstore-run-in-studomain.patch -Patch468: libxl.libxl__domain_pvcontrol.patch +Patch468: libxl.fix-libacpi-dependency.patch Patch469: libxl.helper_done-crash.patch Patch470: libxl.LIBXL_HOTPLUG_TIMEOUT.patch Patch471: libxc.migrate_tracking.patch @@ -280,12 +237,13 @@ Patch600: xen.bug1026236.suse_vtsc_tolerance.patch Patch601: x86-ioapic-ack-default.patch Patch602: x86-cpufreq-report.patch +Patch603: xenwatchdogd-options.patch +Patch604: xenwatchdogd-restart.patch Patch621: xen.build-compare.doc_html.patch Patch623: ipxe-no-error-logical-not-parentheses.patch Patch624: ipxe-use-rpm-opt-flags.patch # Build patches Patch99996: xen.stubdom.newlib.patch -Patch99998: tmp_build.patch Patch99999: reproducible.patch URL: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -463,53 +421,7 @@ %setup -q -n %xen_build_dir -a 1 -a 5 -a 6 -a 57 # Upstream patches %patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 -%patch17 -p1 -%patch18 -p1 -%patch19 -p1 -%patch20 -p1 -%patch21 -p1 -%patch22 -p1 -%patch23 -p1 -%patch24 -p1 -%patch25 -p1 -%patch26 -p1 -%patch27 -p1 -%patch28 -p1 -%patch29 -p1 -%patch30 -p1 -%patch31 -p1 -%patch32 -p1 -%patch33 -p1 -%patch34 -p1 -%patch35 -p1 -%patch36 -p1 -%patch37 -p1 -%patch38 -p1 -%patch28601 -p1 -%patch28602 -p1 -%patch28603 -p1 -%patch28604 -p1 -%patch28605 -p1 -%patch28606 -p1 -%patch35101 -p1 -%patch35102 -p1 -%patch35103 -p1 -# +# libxc %patch300 -p1 %patch301 -p1 %patch302 -p1 @@ -534,6 +446,9 @@ %patch321 -p1 %patch322 -p1 %patch323 -p1 +%patch324 -p1 +%patch325 -p1 +%patch326 -p1 # Our platform specific patches %patch400 -p1 %patch401 -p1 @@ -579,12 +494,13 @@ %patch600 -p1 %patch601 -p1 %patch602 -p1 +%patch603 -p1 +%patch604 -p1 %patch621 -p1 %patch623 -p1 %patch624 -p1 # Build patches %patch99996 -p1 -%patch99998 -p1 %patch99999 -p1 %build @@ -1109,7 +1025,6 @@ rm -f %{buildroot}/%{_bindir}/xenalyze* rm -f %{buildroot}/%{_bindir}/xenco* rm -f %{buildroot}/%{_bindir}/xen-cpuid -rm -f %{buildroot}/%{_bindir}/xenstore* rm -f %{buildroot}/%{_bindir}/pygrub rm -f %{buildroot}/%{_bindir}/remus rm -f %{buildroot}/usr/etc/qemu/target-x86_64.conf @@ -1314,9 +1229,9 @@ %defattr(-,root,root) %ifarch %ix86 x86_64 /usr/bin/xen-detect +%exclude /usr/bin/xenstore-control %endif -/bin/domu-xenstore* -/bin/xenstore-* +/usr/bin/xenstore* %if %{?with_dom0_support}0 %config %{_unitdir}/%{name}-vcpu-watch.service %endif ++++++ 5fca3b32-tools-libs-ctrl-fix-dumping-of-ballooned-guest.patch ++++++ Subject: tools/libs/ctrl: fix dumping of ballooned guest From: Juergen Gross jgr...@suse.com Wed Nov 11 11:01:43 2020 +0100 Date: Fri Dec 4 13:35:46 2020 +0000: Git: 5e666356a9d55fbd9eb5b8506088aa760e107b5b A guest with memory < maxmem often can't be dumped via xl dump-core without an error message today: xc: info: exceeded nr_pages (262144) losing pages In case the last page of the guest isn't allocated the loop in xc_domain_dumpcore_via_callback() will always spit out this message, as the number of already dumped pages is tested before the next page is checked to be valid. The guest's p2m_size might be lower than expected, so this should be tested in order to avoid reading past the end of it. The guest might use high bits in p2m entries to flag special cases like foreign mappings. Entries with an MFN larger than the highest MFN of the host should be skipped. Signed-off-by: Juergen Gross <jgr...@suse.com> --- xen-4.14.0-testing.orig/tools/libxc/xc_core.c +++ xen-4.14.0-testing/tools/libxc/xc_core.c @@ -438,6 +438,7 @@ xc_domain_dumpcore_via_callback(xc_inter unsigned long i; unsigned long j; unsigned long nr_pages; + unsigned long max_mfn; xc_core_memory_map_t *memory_map = NULL; unsigned int nr_memory_map; @@ -576,6 +577,10 @@ xc_domain_dumpcore_via_callback(xc_inter &p2m, &dinfo->p2m_size); if ( sts != 0 ) goto out; + + sts = xc_maximum_ram_page(xch, &max_mfn); + if ( sts != 0 ) + goto out; } else { @@ -817,19 +822,12 @@ xc_domain_dumpcore_via_callback(xc_inter { uint64_t gmfn; void *vaddr; - - if ( j >= nr_pages ) - { - /* - * When live dump-mode (-L option) is specified, - * guest domain may increase memory. - */ - IPRINTF("exceeded nr_pages (%ld) losing pages", nr_pages); - goto copy_done; - } if ( !auto_translated_physmap ) { + if ( i >= dinfo->p2m_size ) + break; + if ( dinfo->guest_width >= sizeof(unsigned long) ) { if ( dinfo->guest_width == sizeof(unsigned long) ) @@ -845,6 +843,14 @@ xc_domain_dumpcore_via_callback(xc_inter if ( gmfn == (uint32_t)INVALID_PFN ) continue; } + if ( gmfn > max_mfn ) + continue; + + if ( j >= nr_pages ) + { + j++; + continue; + } p2m_array[j].pfn = i; p2m_array[j].gmfn = gmfn; @@ -854,6 +860,12 @@ xc_domain_dumpcore_via_callback(xc_inter if ( !xc_core_arch_gpfn_may_present(&arch_ctxt, i) ) continue; + if ( j >= nr_pages ) + { + j++; + continue; + } + gmfn = i; pfn_array[j] = i; } @@ -878,7 +890,15 @@ xc_domain_dumpcore_via_callback(xc_inter } } -copy_done: + if ( j > nr_pages ) + { + /* + * When live dump-mode (-L option) is specified, + * guest domain may increase memory. + */ + IPRINTF("exceeded nr_pages (%ld) losing %ld pages", nr_pages, j - nr_pages); + } + sts = dump_rtn(xch, args, dump_mem_start, dump_mem - dump_mem_start); if ( sts != 0 ) goto out; ++++++ libxc-bitmap-50a5215f30e964a6f16165ab57925ca39f31a849.patch ++++++ From: Olaf Hering <o...@aepfle.de> Date: Thu, 24 Sep 2020 20:08:43 +0200 Subject: libxc bitmap 50a5215f30e964a6f16165ab57925ca39f31a849 libxc/bitops: increase potential size of bitmaps If the bitmap is used to represent domU pages, the amount of memory is limited to 8TB due to the 32bit value. Adjust the code to use 64bit values as input. All callers already use some form of 64bit as input, so no further adjustment is required. Signed-off-by: Olaf Hering <o...@aepfle.de> Acked-by: Andrew Cooper <andrew.coop...@citrix.com> Acked-by: Wei Liu <w...@xen.org> --- tools/libxc/xc_bitops.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) Index: xen-4.14.0-testing/tools/libxc/xc_bitops.h =================================================================== --- xen-4.14.0-testing.orig/tools/libxc/xc_bitops.h +++ xen-4.14.0-testing/tools/libxc/xc_bitops.h @@ -14,52 +14,52 @@ #define BITMAP_SHIFT(_nr) ((_nr) % 8) /* calculate required space for number of bytes needed to hold nr_bits */ -static inline int bitmap_size(int nr_bits) +static inline unsigned long bitmap_size(unsigned long nr_bits) { return (nr_bits + 7) / 8; } -static inline void *bitmap_alloc(int nr_bits) +static inline void *bitmap_alloc(unsigned long nr_bits) { return calloc(1, bitmap_size(nr_bits)); } -static inline void bitmap_set(void *addr, int nr_bits) +static inline void bitmap_set(void *addr, unsigned long nr_bits) { memset(addr, 0xff, bitmap_size(nr_bits)); } -static inline void bitmap_clear(void *addr, int nr_bits) +static inline void bitmap_clear(void *addr, unsigned long nr_bits) { memset(addr, 0, bitmap_size(nr_bits)); } -static inline int test_bit(int nr, const void *_addr) +static inline int test_bit(unsigned long nr, const void *_addr) { const char *addr = _addr; return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1; } -static inline void clear_bit(int nr, void *_addr) +static inline void clear_bit(unsigned long nr, void *_addr) { char *addr = _addr; BITMAP_ENTRY(nr, addr) &= ~(1UL << BITMAP_SHIFT(nr)); } -static inline void set_bit(int nr, void *_addr) +static inline void set_bit(unsigned long nr, void *_addr) { char *addr = _addr; BITMAP_ENTRY(nr, addr) |= (1UL << BITMAP_SHIFT(nr)); } -static inline int test_and_clear_bit(int nr, void *addr) +static inline int test_and_clear_bit(unsigned long nr, void *addr) { int oldbit = test_bit(nr, addr); clear_bit(nr, addr); return oldbit; } -static inline int test_and_set_bit(int nr, void *addr) +static inline int test_and_set_bit(unsigned long nr, void *addr) { int oldbit = test_bit(nr, addr); set_bit(nr, addr); @@ -67,11 +67,11 @@ static inline int test_and_set_bit(int n } static inline void bitmap_or(void *_dst, const void *_other, - int nr_bits) + unsigned long nr_bits) { char *dst = _dst; const char *other = _other; - int i; + unsigned long i; for ( i = 0; i < bitmap_size(nr_bits); ++i ) dst[i] |= other[i]; } ++++++ libxc-bitmap-long.patch ++++++ From: Olaf Hering <o...@aepfle.de> Date: Wed, 9 Dec 2020 16:40:00 +0100 Subject: bitmap long tools: add API to work with sevaral bits at once Introduce new API to test if a fixed number of bits is clear or set, and clear or set them all at once. The caller has to make sure the input bitnumber is a multiply of BITS_PER_LONG. This API avoids the loop over each bit in a known range just to see if all of them are either clear or set. Signed-off-by: Olaf Hering <o...@aepfle.de> --- tools/libxc/xc_bitops.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) Index: xen-4.14.0-testing/tools/libxc/xc_bitops.h =================================================================== --- xen-4.14.0-testing.orig/tools/libxc/xc_bitops.h +++ xen-4.14.0-testing/tools/libxc/xc_bitops.h @@ -79,4 +79,29 @@ static inline void bitmap_or(void *_dst, dst[i] |= other[i]; } +static inline int test_bit_long_set(unsigned long nr_base, const void *_addr) +{ + const unsigned long *addr = _addr; + unsigned long val = addr[nr_base / BITS_PER_LONG]; + return val == ~0; +} + +static inline int test_bit_long_clear(unsigned long nr_base, const void *_addr) +{ + const unsigned long *addr = _addr; + unsigned long val = addr[nr_base / BITS_PER_LONG]; + return val == 0; +} + +static inline void clear_bit_long(unsigned long nr_base, void *_addr) +{ + unsigned long *addr = _addr; + addr[nr_base / BITS_PER_LONG] = 0; +} + +static inline void set_bit_long(unsigned long nr_base, void *_addr) +{ + unsigned long *addr = _addr; + addr[nr_base / BITS_PER_LONG] = ~0; +} #endif /* XC_BITOPS_H */ ++++++ libxc-bitmap-longs.patch ++++++ From: Olaf Hering <o...@aepfle.de> Date: Wed, 9 Dec 2020 16:22:14 +0100 Subject: bitmap longs tools: allocate bitmaps in units of unsigned long Allocate enough memory so that the returned pointer can be safely accessed as an array of unsigned long. The actual bitmap size in units of bytes, as returned by bitmap_size, remains unchanged. Signed-off-by: Olaf Hering <o...@aepfle.de> --- tools/libxc/xc_bitops.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) Index: xen-4.14.0-testing/tools/libxc/xc_bitops.h =================================================================== --- xen-4.14.0-testing.orig/tools/libxc/xc_bitops.h +++ xen-4.14.0-testing/tools/libxc/xc_bitops.h @@ -21,7 +21,10 @@ static inline unsigned long bitmap_size( static inline void *bitmap_alloc(unsigned long nr_bits) { - return calloc(1, bitmap_size(nr_bits)); + unsigned long longs; + + longs = (nr_bits + BITS_PER_LONG - 1) / BITS_PER_LONG; + return calloc(longs, sizeof(unsigned long)); } static inline void bitmap_set(void *addr, unsigned long nr_bits) ++++++ libxc.migrate_tracking.patch ++++++ --- /var/tmp/diff_new_pack.emQGk0/_old 2020-12-21 10:22:52.231951645 +0100 +++ /var/tmp/diff_new_pack.emQGk0/_new 2020-12-21 10:22:52.231951645 +0100 @@ -1,11 +1,23 @@ Track live migration state unconditionally in logfiles to see how long a domU was suspended. Depends on libxc.sr.superpage.patch -Index: xen-4.14.0-testing/tools/libxc/xc_domain.c +Index: xen-4.14.1-testing/tools/libs/toollog/include/xentoollog.h =================================================================== ---- xen-4.14.0-testing.orig/tools/libxc/xc_domain.c -+++ xen-4.14.0-testing/tools/libxc/xc_domain.c -@@ -69,20 +69,26 @@ int xc_domain_cacheflush(xc_interface *x +--- xen-4.14.1-testing.orig/tools/libs/toollog/include/xentoollog.h ++++ xen-4.14.1-testing/tools/libs/toollog/include/xentoollog.h +@@ -133,6 +133,7 @@ const char *xtl_level_to_string(xentooll + }); + + ++#define XL_NO_SUSEINFO "XL_NO_SUSEINFO" + #endif /* XENTOOLLOG_H */ + + /* +Index: xen-4.14.1-testing/tools/libxc/xc_domain.c +=================================================================== +--- xen-4.14.1-testing.orig/tools/libxc/xc_domain.c ++++ xen-4.14.1-testing/tools/libxc/xc_domain.c +@@ -69,20 +69,28 @@ int xc_domain_cacheflush(xc_interface *x int xc_domain_pause(xc_interface *xch, uint32_t domid) { @@ -15,7 +27,8 @@ domctl.domain = domid; - return do_domctl(xch, &domctl); + ret = do_domctl(xch, &domctl); -+ SUSEINFO("domid %u: %s returned %d", domid, __func__, ret); ++ if (getenv(XL_NO_SUSEINFO) == NULL) ++ SUSEINFO("domid %u: %s returned %d", domid, __func__, ret); + return ret; } @@ -29,19 +42,24 @@ domctl.domain = domid; - return do_domctl(xch, &domctl); + ret = do_domctl(xch, &domctl); -+ SUSEINFO("domid %u: %s returned %d", domid, __func__, ret); ++ if (getenv(XL_NO_SUSEINFO) == NULL) ++ SUSEINFO("domid %u: %s returned %d", domid, __func__, ret); + return ret; } -Index: xen-4.14.0-testing/tools/libxc/xc_private.h +Index: xen-4.14.1-testing/tools/libxc/xc_private.h =================================================================== ---- xen-4.14.0-testing.orig/tools/libxc/xc_private.h -+++ xen-4.14.0-testing/tools/libxc/xc_private.h -@@ -42,6 +42,11 @@ +--- xen-4.14.1-testing.orig/tools/libxc/xc_private.h ++++ xen-4.14.1-testing/tools/libxc/xc_private.h +@@ -42,6 +42,15 @@ #include <xen-tools/libs.h> ++/* ++ * Using loglevel ERROR to make sure the intended informational messages appear ++ * in libvirts libxl-driver.log ++ */ +#define SUSEINFO(_m, _a...) do { int ERROR_errno = errno; \ + xc_report(xch, xch->error_handler, XTL_ERROR, XC_ERROR_NONE, "SUSEINFO: " _m , ## _a ); \ + errno = ERROR_errno; \ @@ -50,11 +68,11 @@ #if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG) && !defined(__MINIOS__) /* Compile in Valgrind client requests? */ #include <valgrind/memcheck.h> -Index: xen-4.14.0-testing/tools/libxc/xc_resume.c +Index: xen-4.14.1-testing/tools/libxc/xc_resume.c =================================================================== ---- xen-4.14.0-testing.orig/tools/libxc/xc_resume.c -+++ xen-4.14.0-testing/tools/libxc/xc_resume.c -@@ -284,7 +284,9 @@ out: +--- xen-4.14.1-testing.orig/tools/libxc/xc_resume.c ++++ xen-4.14.1-testing/tools/libxc/xc_resume.c +@@ -284,7 +284,10 @@ out: */ int xc_domain_resume(xc_interface *xch, uint32_t domid, int fast) { @@ -62,13 +80,14 @@ + int ret = (fast ? xc_domain_resume_cooperative(xch, domid) : xc_domain_resume_any(xch, domid)); -+ SUSEINFO("domid %u: %s%s returned %d", domid, __func__, fast ? " fast" : "", ret); ++ if (getenv(XL_NO_SUSEINFO) == NULL) ++ SUSEINFO("domid %u: %s%s returned %d", domid, __func__, fast ? " fast" : "", ret); + return ret; } -Index: xen-4.14.0-testing/tools/libxc/xc_sr_common.c +Index: xen-4.14.1-testing/tools/libxc/xc_sr_common.c =================================================================== ---- xen-4.14.0-testing.orig/tools/libxc/xc_sr_common.c -+++ xen-4.14.0-testing/tools/libxc/xc_sr_common.c +--- xen-4.14.1-testing.orig/tools/libxc/xc_sr_common.c ++++ xen-4.14.1-testing/tools/libxc/xc_sr_common.c @@ -204,6 +204,65 @@ bool _xc_sr_bitmap_resize(struct xc_sr_b return true; } @@ -135,10 +154,10 @@ /* * Local variables: * mode: C -Index: xen-4.14.0-testing/tools/libxc/xc_sr_common.h +Index: xen-4.14.1-testing/tools/libxc/xc_sr_common.h =================================================================== ---- xen-4.14.0-testing.orig/tools/libxc/xc_sr_common.h -+++ xen-4.14.0-testing/tools/libxc/xc_sr_common.h +--- xen-4.14.1-testing.orig/tools/libxc/xc_sr_common.h ++++ xen-4.14.1-testing/tools/libxc/xc_sr_common.h @@ -268,6 +268,7 @@ struct xc_sr_context xc_stream_type_t stream_type; @@ -147,7 +166,7 @@ union /* Common save or restore data. */ { -@@ -526,6 +527,8 @@ static inline int pfn_set_populated(stru +@@ -537,6 +538,8 @@ static inline int pfn_set_populated(stru return 0; } @@ -156,10 +175,10 @@ struct xc_sr_record { uint32_t type; -Index: xen-4.14.0-testing/tools/libxc/xc_sr_restore.c +Index: xen-4.14.1-testing/tools/libxc/xc_sr_restore.c =================================================================== ---- xen-4.14.0-testing.orig/tools/libxc/xc_sr_restore.c -+++ xen-4.14.0-testing/tools/libxc/xc_sr_restore.c +--- xen-4.14.1-testing.orig/tools/libxc/xc_sr_restore.c ++++ xen-4.14.1-testing/tools/libxc/xc_sr_restore.c @@ -875,6 +875,7 @@ static int restore(struct xc_sr_context struct xc_sr_rhdr rhdr; int rc, saved_rc = 0, saved_errno = 0; @@ -184,10 +203,10 @@ if ( read_headers(&ctx) ) return -1; -Index: xen-4.14.0-testing/tools/libxc/xc_sr_save.c +Index: xen-4.14.1-testing/tools/libxc/xc_sr_save.c =================================================================== ---- xen-4.14.0-testing.orig/tools/libxc/xc_sr_save.c -+++ xen-4.14.0-testing/tools/libxc/xc_sr_save.c +--- xen-4.14.1-testing.orig/tools/libxc/xc_sr_save.c ++++ xen-4.14.1-testing/tools/libxc/xc_sr_save.c @@ -354,7 +354,7 @@ static void show_transfer_rate(struct xc MiB_sec /= 1024U*1024U; @@ -213,27 +232,16 @@ cleanup(ctx); if ( saved_rc ) -@@ -1046,6 +1048,10 @@ static int suse_precopy_policy(struct pr - goto out; - } - /* Keep going */ -+ if ( stats.dirty_count >= 0 ) -+ SUSEINFO("domid %u: dirty pages %ld after iteration %u/%u", -+ suse_flags.ctx->domid, -+ suse_flags.dirty_count, stats.iteration, suse_flags.max_iters); - return XGS_POLICY_CONTINUE_PRECOPY; - - out: -@@ -1059,6 +1065,8 @@ out: +@@ -1059,6 +1061,8 @@ out: return XGS_POLICY_ABORT; } suspend: -+ SUSEINFO("domid %u: suspending, remaining dirty pages %ld prior final transit", ++ SUSEINFO("domid %u: suspending, %ld remaining dirty pages prior final transit", + suse_flags.ctx->domid, suse_flags.dirty_count); return XGS_POLICY_STOP_AND_COPY; } -@@ -1128,6 +1136,7 @@ int xc_domain_save_suse(xc_interface *xc +@@ -1128,6 +1132,7 @@ int xc_domain_save_suse(xc_interface *xc io_fd, dom, flags, ctx.dominfo.hvm); ctx.domid = dom; @@ -241,3 +249,16 @@ if ( ctx.dominfo.hvm ) { +Index: xen-4.14.1-testing/tools/xl/xl.c +=================================================================== +--- xen-4.14.1-testing.orig/tools/xl/xl.c ++++ xen-4.14.1-testing/tools/xl/xl.c +@@ -398,6 +398,8 @@ int main(int argc, char **argv) + (progress_use_cr ? XTL_STDIOSTREAM_PROGRESS_USE_CR : 0)); + if (!logger) exit(EXIT_FAILURE); + ++ /* Provide context to libxl and libxc: no SUSEINFO() from xl */ ++ setenv(XL_NO_SUSEINFO, "1", 0); + xl_ctx_alloc(); + + atexit(xl_ctx_free); ++++++ libxc.sr.superpage.patch ++++++ --- /var/tmp/diff_new_pack.emQGk0/_old 2020-12-21 10:22:52.239951652 +0100 +++ /var/tmp/diff_new_pack.emQGk0/_new 2020-12-21 10:22:52.239951652 +0100 @@ -149,7 +149,7 @@ /* Sender has invoked verify mode on the stream. */ bool verify; -@@ -426,6 +443,12 @@ struct xc_sr_context +@@ -426,6 +443,14 @@ struct xc_sr_context { /* HVM context blob. */ struct xc_sr_blob context; @@ -158,11 +158,13 @@ + struct xc_sr_bitmap attempted_1g; + struct xc_sr_bitmap attempted_2m; + struct xc_sr_bitmap allocated_pfns; -+ xen_pfn_t idx1G_prev, idx2M_prev; ++ xen_pfn_t prev_populated_pfn; ++ xen_pfn_t iteration_tracker_pfn; ++ unsigned long iteration; } restore; }; } hvm; -@@ -440,6 +463,69 @@ extern struct xc_sr_save_ops save_ops_x8 +@@ -440,6 +465,78 @@ extern struct xc_sr_save_ops save_ops_x8 extern struct xc_sr_restore_ops restore_ops_x86_pv; extern struct xc_sr_restore_ops restore_ops_x86_hvm; @@ -190,6 +192,15 @@ + return true; +} + ++static inline bool xc_sr_set_long_bit(unsigned long base_bit, struct xc_sr_bitmap *bm) ++{ ++ if (!xc_sr_bitmap_resize(bm, base_bit + BITS_PER_LONG)) ++ return false; ++ ++ set_bit_long(base_bit, bm->p); ++ return true; ++} ++ +static inline bool xc_sr_test_bit(unsigned long bit, struct xc_sr_bitmap *bm) +{ + if (bit > bm->bits) @@ -232,7 +243,7 @@ struct xc_sr_record { uint32_t type; -@@ -490,14 +576,6 @@ int read_record_header(struct xc_sr_cont +@@ -490,14 +587,6 @@ int read_record_header(struct xc_sr_cont int read_record_data(struct xc_sr_context *ctx, int fd, struct xc_sr_rhdr *rhdr, struct xc_sr_record *rec); @@ -471,7 +482,7 @@ free(ctx->x86.restore.cpuid.ptr); free(ctx->x86.restore.msr.ptr); -@@ -249,6 +277,322 @@ static int x86_hvm_cleanup(struct xc_sr_ +@@ -249,6 +277,372 @@ static int x86_hvm_cleanup(struct xc_sr_ return 0; } @@ -491,6 +502,22 @@ + return 0; +} + ++/* ++ * Set a range of pfns as allocated, expanding the tracking structures if needed. ++ */ ++static int pfn_set_long_allocated(struct xc_sr_context *ctx, xen_pfn_t base_pfn) ++{ ++ xc_interface *xch = ctx->xch; ++ ++ if ( !xc_sr_set_long_bit(base_pfn, &ctx->x86.hvm.restore.allocated_pfns) ) ++ { ++ ERROR("Failed to realloc allocated_pfns bitmap"); ++ errno = ENOMEM; ++ return -1; ++ } ++ return 0; ++} ++ +struct x86_hvm_sp { + xen_pfn_t pfn; + xen_pfn_t base_pfn; @@ -506,7 +533,7 @@ +{ + xc_interface *xch = ctx->xch; + struct xc_sr_bitmap *bm; -+ unsigned int order, shift; ++ unsigned int order; + int i, done; + xen_pfn_t extent; + @@ -517,7 +544,7 @@ + return false; + + order = SUPERPAGE_1GB_SHIFT; -+ sp->count = 1ULL << order; ++ sp->count = SUPERPAGE_1GB_NR_PFNS; + + /* Allocate only if there is room for another superpage */ + if ( ctx->restore.tot_pages + sp->count > ctx->restore.max_pages ) @@ -532,12 +559,11 @@ + if ( done == 0 ) + return false; + -+ DPRINTF("1G base_pfn %" PRI_xen_pfn "\n", sp->base_pfn); ++ DPRINTF("1G %" PRI_xen_pfn "\n", sp->base_pfn); + + /* Mark all 2MB pages as done to avoid overlapping allocation */ + bm = &ctx->x86.hvm.restore.attempted_2m; -+ shift = SUPERPAGE_1GB_SHIFT - SUPERPAGE_2MB_SHIFT; -+ for ( i = 0; i < (sp->count >> shift); i++ ) ++ for ( i = 0; i < (SUPERPAGE_1GB_NR_PFNS/SUPERPAGE_2MB_NR_PFNS); i++ ) + xc_sr_set_bit((sp->base_pfn >> SUPERPAGE_2MB_SHIFT) + i, bm); + + return true; @@ -559,7 +585,7 @@ + return false; + + order = SUPERPAGE_2MB_SHIFT; -+ sp->count = 1ULL << order; ++ sp->count = SUPERPAGE_2MB_NR_PFNS; + + /* Allocate only if there is room for another superpage */ + if ( ctx->restore.tot_pages + sp->count > ctx->restore.max_pages ) @@ -574,7 +600,7 @@ + if ( done == 0 ) + return false; + -+ DPRINTF("2M base_pfn %" PRI_xen_pfn "\n", sp->base_pfn); ++ DPRINTF("2M %" PRI_xen_pfn "\n", sp->base_pfn); + return true; +} + @@ -587,7 +613,7 @@ + xen_pfn_t extent; + + order = 0; -+ sp->count = 1ULL << order; ++ sp->count = 1UL; + + /* Allocate only if there is room for another page */ + if ( ctx->restore.tot_pages + sp->count > ctx->restore.max_pages ) { @@ -606,7 +632,7 @@ + return false; + } + -+ DPRINTF("4K base_pfn %" PRI_xen_pfn "\n", sp->base_pfn); ++ DPRINTF("4K %" PRI_xen_pfn "\n", sp->base_pfn); + return true; +} +/* @@ -651,50 +677,61 @@ + success = x86_hvm_alloc_4k(ctx, &sp); + } + -+ if ( success == true ) { -+ do { ++ if ( success == false ) ++ return -1; ++ ++ do { ++ if ( sp.count >= BITS_PER_LONG ) { ++ sp.count -= BITS_PER_LONG; ++ ctx->restore.tot_pages += BITS_PER_LONG; ++ rc = pfn_set_long_allocated(ctx, sp.base_pfn + sp.count); ++ } else { + sp.count--; + ctx->restore.tot_pages++; + rc = pfn_set_allocated(ctx, sp.base_pfn + sp.count); -+ if ( rc ) -+ break; -+ } while ( sp.count ); -+ } ++ } ++ if ( rc ) ++ break; ++ } while ( sp.count ); ++ + return rc; +} + -+static bool x86_hvm_punch_hole(struct xc_sr_context *ctx, xen_pfn_t max_pfn) ++/* ++ * Deallocate memory. ++ * There was likely an optimistic superpage allocation. ++ * This means more pages may have been allocated past gap_end. ++ * This range is not freed now. Incoming higher pfns will release it. ++ */ ++static int x86_hvm_punch_hole(struct xc_sr_context *ctx, ++ xen_pfn_t gap_start, xen_pfn_t gap_end) +{ + xc_interface *xch = ctx->xch; + struct xc_sr_bitmap *bm; -+ xen_pfn_t _pfn, pfn, min_pfn; -+ uint32_t domid, freed = 0, order; -+ int rc = -1; ++ xen_pfn_t _pfn, pfn; ++ uint32_t domid, freed = 0; ++ int rc; + -+ /* -+ * Scan the entire superpage because several batches will fit into -+ * a superpage, and it is unknown which pfn triggered the allocation. -+ */ -+ order = SUPERPAGE_1GB_SHIFT; -+ pfn = min_pfn = (max_pfn >> order) << order; ++ bm = &ctx->x86.hvm.restore.allocated_pfns; ++ if ( !xc_sr_bitmap_resize(bm, gap_end) ) ++ { ++ PERROR("Failed to realloc allocated_pfns %" PRI_xen_pfn, gap_end); ++ return -1; ++ } ++ ++ pfn = gap_start; + -+ while ( pfn <= max_pfn ) ++ while ( pfn <= gap_end ) + { -+ bm = &ctx->x86.hvm.restore.allocated_pfns; -+ if ( !xc_sr_bitmap_resize(bm, pfn) ) ++ if ( xc_sr_test_and_clear_bit(pfn, bm) ) + { -+ PERROR("Failed to realloc allocated_pfns %" PRI_xen_pfn, pfn); -+ return false; -+ } -+ if ( !pfn_is_populated(ctx, pfn) && -+ xc_sr_test_and_clear_bit(pfn, bm) ) { + domid = ctx->domid; + _pfn = pfn; + rc = xc_domain_decrease_reservation_exact(xch, domid, 1, 0, &_pfn); + if ( rc ) + { + PERROR("Failed to release pfn %" PRI_xen_pfn, pfn); -+ return false; ++ return -1; + } + ctx->restore.tot_pages--; + freed++; @@ -703,90 +740,114 @@ + } + if ( freed ) + DPRINTF("freed %u between %" PRI_xen_pfn " %" PRI_xen_pfn "\n", -+ freed, min_pfn, max_pfn); -+ return true; ++ freed, gap_start, gap_end); ++ return 0; ++} ++ ++static int x86_hvm_unpopulate_page(struct xc_sr_context *ctx, xen_pfn_t pfn) ++{ ++ xc_sr_test_and_clear_bit(pfn, &ctx->restore.populated_pfns); ++ return x86_hvm_punch_hole(ctx, pfn, pfn); ++} ++ ++static int x86_hvm_populate_page(struct xc_sr_context *ctx, xen_pfn_t pfn) ++{ ++ xen_pfn_t gap_start, gap_end; ++ bool has_gap, first_iteration; ++ int rc; ++ ++ /* ++ * Check for a gap between the previous populated pfn and this pfn. ++ * In case a gap exists, it is required to punch a hole to release memory, ++ * starting after the previous pfn and before this pfn. ++ * ++ * But: this can be done only during the first iteration, which is the ++ * only place there superpage allocations are attempted. All following ++ * iterations lack the info to properly maintain prev_populated_pfn. ++ */ ++ has_gap = ctx->x86.hvm.restore.prev_populated_pfn + 1 < pfn; ++ first_iteration = ctx->x86.hvm.restore.iteration == 0; ++ if ( has_gap && first_iteration ) ++ { ++ gap_start = ctx->x86.hvm.restore.prev_populated_pfn + 1; ++ gap_end = pfn - 1; ++ ++ rc = x86_hvm_punch_hole(ctx, gap_start, gap_end); ++ if ( rc ) ++ goto err; ++ } ++ ++ rc = x86_hvm_allocate_pfn(ctx, pfn); ++ if ( rc ) ++ goto err; ++ rc = pfn_set_populated(ctx, pfn); ++ if ( rc ) ++ goto err; ++ ctx->x86.hvm.restore.prev_populated_pfn = pfn; ++ ++ rc = 0; ++err: ++ return rc; +} + +/* + * Try to allocate superpages. -+ * This works without memory map only if the pfns arrive in incremental order. ++ * This works without memory map because the pfns arrive in incremental order. ++ * All pfn numbers and their type are submitted. ++ * Only pfns with data will have also pfn content transmitted. + */ +static int x86_hvm_populate_pfns(struct xc_sr_context *ctx, unsigned count, + const xen_pfn_t *original_pfns, + const uint32_t *types) +{ + xc_interface *xch = ctx->xch; -+ xen_pfn_t pfn, min_pfn = original_pfns[0], max_pfn = original_pfns[0]; -+ xen_pfn_t idx1G, idx2M; -+ unsigned i, order; -+ int rc = -1; ++ xen_pfn_t pfn, min_pfn, max_pfn; ++ bool has_data, populated; ++ unsigned i = count; ++ int rc = 0; + -+ /* Loop once over the array to show statistics */ -+ for ( i = 0; i < count; ++i ) -+ { -+ if ( original_pfns[i] < min_pfn ) -+ min_pfn = original_pfns[i]; -+ if ( original_pfns[i] > max_pfn ) -+ max_pfn = original_pfns[i]; -+ } ++ min_pfn = count ? original_pfns[0] : 0; ++ max_pfn = count ? original_pfns[count - 1] : 0; + DPRINTF("batch of %u pfns between %" PRI_xen_pfn " %" PRI_xen_pfn "\n", + count, min_pfn, max_pfn); + ++ /* ++ * There is no indicator for a new iteration. ++ * Simulate it by checking if a lower pfn is coming in. ++ * In the end it matters only to know if this iteration is the first one. ++ */ ++ if ( min_pfn < ctx->x86.hvm.restore.iteration_tracker_pfn ) ++ { ++ ctx->x86.hvm.restore.iteration++; ++ errno = 0; ++ ERROR("%s: iteration %lu", __func__, ctx->x86.hvm.restore.iteration + 1); ++ } ++ ctx->x86.hvm.restore.iteration_tracker_pfn = min_pfn; ++ + for ( i = 0; i < count; ++i ) + { + pfn = original_pfns[i]; -+ idx1G = pfn >> SUPERPAGE_1GB_SHIFT; -+ idx2M = pfn >> SUPERPAGE_2MB_SHIFT; ++ ++ has_data = page_type_has_stream_data(types[i]); ++ populated = pfn_is_populated(ctx, pfn); + + /* -+ * If this pfn is in another 2MB superpage it is required to punch holes -+ * to release memory, starting from the 1GB boundary up to the highest -+ * pfn within the previous 2MB superpage. ++ * page has data, pfn populated: nothing to do ++ * page has data, pfn not populated: likely never seen before ++ * page has no data, pfn populated: likely ballooned out during migration ++ * page has no data, pfn not populated: nothing to do + */ -+ if ( ctx->x86.hvm.restore.idx1G_prev == idx1G && -+ ctx->x86.hvm.restore.idx2M_prev == idx2M ) ++ if ( has_data && !populated ) + { -+ /* Same 2MB superpage, nothing to do */ -+ ; -+ } else { -+ /* -+ * If this next pfn is within another 1GB or 2MB superpage it is -+ * required to scan the entire previous superpage because there -+ * might be holes between the last pfn and the end of the superpage. -+ */ -+ if ( ctx->x86.hvm.restore.idx1G_prev != idx1G ) -+ { -+ order = SUPERPAGE_1GB_SHIFT; -+ max_pfn = ((ctx->x86.hvm.restore.idx1G_prev + 1) << order) - 1; -+ } -+ else -+ { -+ order = SUPERPAGE_2MB_SHIFT; -+ max_pfn = ((ctx->x86.hvm.restore.idx2M_prev + 1) << order) - 1; -+ } -+ -+ if ( x86_hvm_punch_hole(ctx, max_pfn) == false ) -+ goto err; -+ } -+ -+ if ( (types[i] != XEN_DOMCTL_PFINFO_XTAB && -+ types[i] != XEN_DOMCTL_PFINFO_BROKEN) && -+ !pfn_is_populated(ctx, pfn) ) ++ rc = x86_hvm_populate_page(ctx, pfn); ++ } else if ( !has_data && populated ) + { -+ rc = x86_hvm_allocate_pfn(ctx, pfn); -+ if ( rc ) -+ goto err; -+ rc = pfn_set_populated(ctx, pfn); -+ if ( rc ) -+ goto err; ++ rc = x86_hvm_unpopulate_page(ctx, pfn); + } -+ ctx->x86.hvm.restore.idx1G_prev = idx1G; -+ ctx->x86.hvm.restore.idx2M_prev = idx2M; ++ if ( rc ) ++ break; + } + -+ rc = 0; -+ -+ err: + return rc; +} + @@ -794,7 +855,7 @@ struct xc_sr_restore_ops restore_ops_x86_hvm = { .pfn_is_valid = x86_hvm_pfn_is_valid, -@@ -257,6 +601,7 @@ struct xc_sr_restore_ops restore_ops_x86 +@@ -257,6 +651,7 @@ struct xc_sr_restore_ops restore_ops_x86 .set_page_type = x86_hvm_set_page_type, .localise_page = x86_hvm_localise_page, .setup = x86_hvm_setup, ++++++ libxl.fix-libacpi-dependency.patch ++++++ From: Jan Beulich <jbeul...@suse.com> Date: Thu, 5 Nov 2020 16:48:55 +0100 Subject: libxl: fix libacpi dependency Git-commit: e006b2e3be72e502b86bd9e1405417abd87bdfed $(DSDT_FILES-y) depends on the recursive make to have run in libacpi/ such that the file(s) itself/themselves were generated before compilation gets attempted. The same, however, is also necessary for generated headers, before source files including them would get attempted to be compiled. The dependency specified in libacpi's Makefile, otoh, is entirely pointless nowadays - no compilation happens there anymore (except for tools involved in building the generated files). Together with it, the rule generating acpi.a also can go away. Reported-by: Olaf Hering <o...@aepfle.de> Fixes: 14c0d328da2b ("libxl/acpi: Build ACPI tables for HVMlite guests") Signed-off-by: Jan Beulich <jbeul...@suse.com> Acked-by: Wei Liu <w...@xen.org> --- tools/libacpi/Makefile | 5 ----- tools/libxl/Makefile | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile index c17f3924cc..2448687dbb 100644 --- a/tools/libacpi/Makefile +++ b/tools/libacpi/Makefile @@ -89,11 +89,6 @@ iasl: @echo @exit 1 -build.o: ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h ssdt_laptop_slate.h - -acpi.a: $(OBJS) - $(AR) rc $@ $(OBJS) - clean: rm -f $(C_SRC) $(H_SRC) $(MK_DSDT) $(C_SRC:=.$(TMP_SUFFIX)) rm -f $(patsubst %.c,%.hex,$(C_SRC)) $(patsubst %.c,%.aml,$(C_SRC)) $(patsubst %.c,%.asl,$(C_SRC)) diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile index 3424fdb61b..68f6fa315f 100644 --- a/tools/libxl/Makefile +++ b/tools/libxl/Makefile @@ -80,7 +80,7 @@ ACPI_PATH = $(XEN_ROOT)/tools/libacpi ACPI_PATH = $(XEN_ROOT)/tools/libacpi DSDT_FILES-$(CONFIG_X86) = dsdt_pvh.c ACPI_OBJS = $(patsubst %.c,%.o,$(DSDT_FILES-y)) build.o static_tables.o -$(DSDT_FILES-y): acpi +$(DSDT_FILES-y) build.o: acpi $(ACPI_OBJS): CFLAGS += -I. -DLIBACPI_STDUTILS=\"$(CURDIR)/libxl_x86_acpi.h\" vpath build.c $(ACPI_PATH)/ vpath static_tables.c $(ACPI_PATH)/ ++++++ reproducible.patch ++++++ --- /var/tmp/diff_new_pack.emQGk0/_old 2020-12-21 10:22:52.291951698 +0100 +++ /var/tmp/diff_new_pack.emQGk0/_new 2020-12-21 10:22:52.291951698 +0100 @@ -11,10 +11,10 @@ Signed-off-by: Bernhard M. Wiedemann <bwiedem...@suse.de> -Index: xen-4.14.0-testing/Config.mk +Index: xen-4.14.1-testing/Config.mk =================================================================== ---- xen-4.14.0-testing.orig/Config.mk -+++ xen-4.14.0-testing/Config.mk +--- xen-4.14.1-testing.orig/Config.mk ++++ xen-4.14.1-testing/Config.mk @@ -137,6 +137,14 @@ export XEN_HAS_BUILD_ID=y build_id_linker := --build-id=sha1 endif @@ -30,11 +30,11 @@ ifndef XEN_HAS_CHECKPOLICY CHECKPOLICY ?= checkpolicy XEN_HAS_CHECKPOLICY := $(shell $(CHECKPOLICY) -h 2>&1 | grep -q xen && echo y || echo n) -Index: xen-4.14.0-testing/xen/arch/x86/Makefile +Index: xen-4.14.1-testing/xen/arch/x86/Makefile =================================================================== ---- xen-4.14.0-testing.orig/xen/arch/x86/Makefile -+++ xen-4.14.0-testing/xen/arch/x86/Makefile -@@ -165,6 +165,7 @@ note.o: $(TARGET)-syms +--- xen-4.14.1-testing.orig/xen/arch/x86/Makefile ++++ xen-4.14.1-testing/xen/arch/x86/Makefile +@@ -167,6 +167,7 @@ note.o: $(TARGET)-syms EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10 EFI_LDFLAGS += --image-base=$(1) --stack=0,0 --heap=0,0 --strip-debug ++++++ xen-4.14.0-testing-src.tar.bz2 -> xen-4.14.1-testing-src.tar.bz2 ++++++ ++++ 7803 lines of diff (skipped) ++++++ xen-destdir.patch ++++++ --- /var/tmp/diff_new_pack.emQGk0/_old 2020-12-21 10:22:55.191954245 +0100 +++ /var/tmp/diff_new_pack.emQGk0/_new 2020-12-21 10:22:55.195954249 +0100 @@ -1,57 +1,27 @@ -Index: xen-4.11.0-testing/tools/xenstore/Makefile +Index: xen-4.14.0-testing/tools/xenstore/Makefile =================================================================== ---- xen-4.11.0-testing.orig/tools/xenstore/Makefile -+++ xen-4.11.0-testing/tools/xenstore/Makefile -@@ -20,6 +20,7 @@ LDFLAGS += $(LDFLAGS-y) +--- xen-4.14.0-testing.orig/tools/xenstore/Makefile ++++ xen-4.14.0-testing/tools/xenstore/Makefile +@@ -85,7 +85,7 @@ xenstored.a: $(XENSTORED_OBJS) + $(AR) cr $@ $^ - CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod - CLIENTS += xenstore-write xenstore-ls xenstore-watch -+CLIENTS_DOMU := $(patsubst xenstore-%,domu-xenstore-%,$(CLIENTS)) - - XENSTORED_OBJS = xenstored_core.o xenstored_watch.o xenstored_domain.o - XENSTORED_OBJS += xenstored_transaction.o xenstored_control.o -@@ -57,7 +58,7 @@ endif - all: $(ALL_TARGETS) - - .PHONY: clients --clients: xenstore $(CLIENTS) xenstore-control -+clients: xenstore $(CLIENTS) $(CLIENTS_DOMU) xenstore-control - - ifeq ($(CONFIG_SunOS),y) - xenstored_probes.h: xenstored_probes.d -@@ -87,6 +88,9 @@ xenstored.a: $(XENSTORED_OBJS) $(CLIENTS): xenstore - ln -f xenstore $@ +- ln -f xenstore $@ ++ ln -sf xenstore $@ -+$(CLIENTS_DOMU): xenstore -+ ln -f xenstore $@ -+ xenstore: xenstore_client.o $(LIBXENSTORE) $(CC) $< $(LDFLAGS) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcore) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS) - -@@ -139,7 +143,7 @@ clean: - rm -f *.a *.o *.opic *.so* xenstored_probes.h - rm -f xenstored xs_random xs_stress xs_crashme - rm -f xs_tdb_dump xenstore-control init-xenstore-domain -- rm -f xenstore $(CLIENTS) -+ rm -f xenstore $(CLIENTS) $(CLIENTS_DOMU) - rm -f xenstore.pc - $(RM) $(DEPS_RM) - -@@ -163,12 +167,16 @@ ifeq ($(XENSTORE_XENSTORED),y) +@@ -163,11 +163,12 @@ ifeq ($(XENSTORE_XENSTORED),y) $(INSTALL_DIR) $(DESTDIR)$(sbindir) $(INSTALL_DIR) $(DESTDIR)$(XEN_LIB_STORED) $(INSTALL_PROG) xenstored $(DESTDIR)$(sbindir) -+ $(INSTALL_DIR) $(DESTDIR)/bin ++ $(INSTALL_DIR) $(DESTDIR)$(bindir) endif $(INSTALL_PROG) xenstore-control $(DESTDIR)$(bindir) $(INSTALL_PROG) xenstore $(DESTDIR)$(bindir) set -e ; for c in $(CLIENTS) ; do \ - ln -f $(DESTDIR)$(bindir)/xenstore $(DESTDIR)$(bindir)/$${c} ; \ +- ln -f $(DESTDIR)$(bindir)/xenstore $(DESTDIR)$(bindir)/$${c} ; \ ++ ln -sf xenstore $(DESTDIR)$(bindir)/$${c} ; \ done -+ for client in $(CLIENTS_DOMU); do \ -+ $(INSTALL_PROG) $$client $(DESTDIR)$(bindir)/$${client/domu-}; \ -+ done $(INSTALL_DIR) $(DESTDIR)$(libdir) $(INSTALL_SHLIB) libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir) - ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenstore.so.$(MAJOR) ++++++ xenwatchdogd-options.patch ++++++ From: Olaf Hering <o...@aepfle.de> Date: Thu, 3 Dec 2020 07:34:36 +0100 Subject: tools/hotplug: allow tuning of xenwatchdogd arguments Git-commit: 0fb6dbfaa859aae0e51a82a8d5e213bcc64b85f1 References: bsc#1178736 Currently the arguments for xenwatchdogd are hardcoded with 15s keep-alive interval and 30s timeout. It is not possible to tweak these values via /etc/systemd/system/xen-watchdog.service.d/*.conf because ExecStart can not be replaced. The only option would be a private copy /etc/systemd/system/xen-watchdog.service, which may get out of sync with the Xen provided xen-watchdog.service. Adjust the service file to recognize XENWATCHDOGD_ARGS= in a private unit configuration file. Index: xen-4.14.0-testing/tools/hotplug/Linux/init.d/xen-watchdog.in =================================================================== --- xen-4.14.0-testing.orig/tools/hotplug/Linux/init.d/xen-watchdog.in +++ xen-4.14.0-testing/tools/hotplug/Linux/init.d/xen-watchdog.in @@ -19,6 +19,11 @@ . @XEN_SCRIPT_DIR@/hotplugpath.sh +xencommons_config=@CONFIG_DIR@/@CONFIG_LEAF_DIR@ + +test -f $xencommons_config/xencommons && . $xencommons_config/xencommons + +test -n "$XENWATCHDOGD_ARGS" || XENWATCHDOGD_ARGS='30 15' DAEMON=${sbindir}/xenwatchdogd base=$(basename $DAEMON) @@ -46,7 +51,7 @@ start() { local r echo -n $"Starting domain watchdog daemon: " - $DAEMON 30 15 + $DAEMON $XENWATCHDOGD_ARGS r=$? [ "$r" -eq 0 ] && success $"$base startup" || failure $"$base startup" echo Index: xen-4.14.0-testing/tools/hotplug/Linux/systemd/xen-watchdog.service.in =================================================================== --- xen-4.14.0-testing.orig/tools/hotplug/Linux/systemd/xen-watchdog.service.in +++ xen-4.14.0-testing/tools/hotplug/Linux/systemd/xen-watchdog.service.in @@ -6,7 +6,9 @@ ConditionPathExists=/proc/xen/capabiliti [Service] Type=forking -ExecStart=@sbindir@/xenwatchdogd 30 15 +Environment="XENWATCHDOGD_ARGS=30 15" +EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons +ExecStart=@sbindir@/xenwatchdogd $XENWATCHDOGD_ARGS KillSignal=USR1 [Install] ++++++ xenwatchdogd-restart.patch ++++++ References: bsc#1178736 Allow restart of xenwatchdogd in case it terminated unexpectetly. Index: xen-4.14.0-testing/tools/misc/xenwatchdogd.c =================================================================== --- xen-4.14.0-testing.orig/tools/misc/xenwatchdogd.c +++ xen-4.14.0-testing/tools/misc/xenwatchdogd.c @@ -9,12 +9,16 @@ #include <unistd.h> #include <signal.h> #include <stdio.h> +#include <libgen.h> +#include <syslog.h> xc_interface *h; int id = 0; +static const char id_file[] = "/run/xenwatchdog_id.txt"; -void daemonize(void) +static void daemonize(const char *str) { + const char *err_str = ""; switch (fork()) { case -1: err(1, "fork"); @@ -23,7 +27,9 @@ void daemonize(void) default: exit(0); } - umask(0); +#define err(x,s) do { err_str = (s); goto out; } while (0) + openlog(str, LOG_CONS, LOG_DAEMON); + umask(~(S_IRUSR|S_IWUSR)); if (setsid() < 0) err(1, "setsid"); if (chdir("/") < 0) @@ -34,6 +40,10 @@ void daemonize(void) err(1, "reopen stdout"); if(freopen("/dev/null", "w", stderr) == NULL) err(1, "reopen stderr"); + return; +out: + syslog(LOG_ERR, "%s: %m", err_str); + exit(1); } void catch_exit(int sig) @@ -47,18 +57,21 @@ void catch_usr1(int sig) { if (id) xc_watchdog(h, id, 0); + unlink(id_file); exit(0); } int main(int argc, char **argv) { + FILE *f; int t, s; int ret; + const char *err_str = ""; if (argc < 2) errx(1, "usage: %s <timeout> <sleep>", argv[0]); - daemonize(); + daemonize(basename(argv[0])); h = xc_interface_open(NULL, NULL, 0); if (h == NULL) @@ -86,9 +99,25 @@ int main(int argc, char **argv) if (signal(SIGUSR1, &catch_usr1) == SIG_ERR) err(1, "signal"); - id = xc_watchdog(h, 0, t); - if (id <= 0) - err(1, "xc_watchdog setup"); + f = fopen(id_file, "r"); + if (f) { + if (fscanf(f, "%d", &id) != 1) + id = -1; + if (id <= 0) + err(1, "xc_watchdog setup"); + syslog(LOG_INFO, "reusing id %d", id); + fclose(f); + } else { + id = xc_watchdog(h, 0, t); + syslog(LOG_INFO, "obtained id %d", id); + if (id <= 0) + err(1, "xc_watchdog setup"); + f = fopen(id_file, "w"); + if (f) { + fprintf(f, "%d\n", id); + fclose(f); + } + } for (;;) { sleep(s); @@ -96,4 +125,8 @@ int main(int argc, char **argv) if (ret != 0) err(1, "xc_watchdog"); } + +out: + syslog(LOG_ERR, "%s: %m", err_str); + exit(1); } _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org