diff --git a/26443-ACPI-zap-DMAR.patch b/26443-ACPI-zap-DMAR.patch index f5f3e95..fe6f386 100644 --- a/26443-ACPI-zap-DMAR.patch +++ b/26443-ACPI-zap-DMAR.patch @@ -82,7 +82,15 @@ Committed-by: Jan Beulich +} --- a/xen/drivers/passthrough/vtd/dmar.c +++ b/xen/drivers/passthrough/vtd/dmar.c -@@ -786,7 +786,18 @@ out: +@@ -776,6 +776,7 @@ out: + } + + #ifdef CONFIG_X86 ++#include + #include + /* ACPI tables may not be DMA protected by tboot, so use DMAR copy */ + /* SINIT saved in SinitMleData in TXT heap (which is DMA protected) */ +@@ -786,7 +787,32 @@ out: int __init acpi_dmar_init(void) { @@ -93,12 +101,26 @@ Committed-by: Jan Beulich + if ( ACPI_SUCCESS(acpi_get_table_phys(ACPI_SIG_DMAR, 0, + &dmar_addr, &dmar_len)) ) + { ++#ifdef CONFIG_X86_32 ++ if ( dmar_addr + dmar_len > (DIRECTMAP_MBYTES << 20) ) ++ { ++ unsigned long offset = dmar_addr & (PAGE_SIZE - 1); ++ unsigned long mapped_size = PAGE_SIZE - offset; ++ ++ set_fixmap(FIX_DMAR_ZAP_LO, dmar_addr); ++ if ( mapped_size < sizeof(*dmar_table) ) ++ set_fixmap(FIX_DMAR_ZAP_HI, dmar_addr + PAGE_SIZE); ++ dmar_table = (void *)fix_to_virt(FIX_DMAR_ZAP_LO) + offset; ++ goto exit; ++ } ++#endif + map_pages_to_xen((unsigned long)__va(dmar_addr), PFN_DOWN(dmar_addr), + PFN_UP(dmar_addr + dmar_len) - PFN_DOWN(dmar_addr), + PAGE_HYPERVISOR); + dmar_table = __va(dmar_addr); + } + ++ exit: __attribute__((__unused__)) return parse_dmar_table(acpi_parse_dmar); } @@ -114,3 +136,14 @@ Committed-by: Jan Beulich /* * Namespace and name interfaces */ +--- a/xen/include/asm-x86/fixmap.h ++++ b/xen/include/asm-x86/fixmap.h +@@ -50,6 +50,8 @@ enum fixed_addresses { + FIX_PAE_HIGHMEM_END = FIX_PAE_HIGHMEM_0 + NR_CPUS-1, + #define FIX_VGC_END FIX_PAE_HIGHMEM_0 + #define FIX_VGC_BEGIN FIX_PAE_HIGHMEM_END ++ FIX_DMAR_ZAP_HI, ++ FIX_DMAR_ZAP_LO, + #else + FIX_VGC_END, + FIX_VGC_BEGIN = FIX_VGC_END diff --git a/26549-tools-xc_turn_XCFLAGS_*_into_shifts.patch b/26549-tools-xc_turn_XCFLAGS__into_shifts.patch similarity index 100% rename from 26549-tools-xc_turn_XCFLAGS_*_into_shifts.patch rename to 26549-tools-xc_turn_XCFLAGS__into_shifts.patch diff --git a/26585-x86-mm-Take-the-p2m-lock-even-in-shadow-mode.patch b/26585-x86-mm-Take-the-p2m-lock-even-in-shadow-mode.patch new file mode 100644 index 0000000..5c8719e --- /dev/null +++ b/26585-x86-mm-Take-the-p2m-lock-even-in-shadow-mode.patch @@ -0,0 +1,50 @@ +# Commit a15d87475ed95840dba693ab0a56d0b48a215cbc +# Date 2013-02-21 15:16:20 +0000 +# Author Tim Deegan +# Committer Tim Deegan +x86/mm: Take the p2m lock even in shadow mode. + +The reworking of p2m lookups to use get_gfn()/put_gfn() left the +shadow code not taking the p2m lock, even in cases where the p2m would +be updated (i.e. PoD). + +In many cases, shadow code doesn't need the exclusion that +get_gfn()/put_gfn() provides, as it has its own interlocks against p2m +updates, but this is taking things too far, and can lead to crashes in +the PoD code. + +Now that most shadow-code p2m lookups are done with explicitly +unlocked accessors, or with the get_page_from_gfn() accessor, which is +often lock-free, we can just turn this locking on. + +The remaining locked lookups are in sh_page_fault() (in a path that's +almost always already serializing on the paging lock), and in +emulate_map_dest() (which can probably be updated to use +get_page_from_gfn()). They're not addressed here but may be in a +follow-up patch. + +Signed-off-by: Tim Deegan +Acked-by: Andres Lagar-Cavilla + +--- a/xen/arch/x86/mm/p2m.c ++++ b/xen/arch/x86/mm/p2m.c +@@ -163,8 +163,7 @@ mfn_t __get_gfn_type_access(struct p2m_d + return _mfn(gfn); + } + +- /* For now only perform locking on hap domains */ +- if ( locked && (hap_enabled(p2m->domain)) ) ++ if ( locked ) + /* Grab the lock here, don't release until put_gfn */ + gfn_lock(p2m, gfn, 0); + +@@ -197,8 +196,7 @@ mfn_t __get_gfn_type_access(struct p2m_d + + void __put_gfn(struct p2m_domain *p2m, unsigned long gfn) + { +- if ( !p2m || !paging_mode_translate(p2m->domain) +- || !hap_enabled(p2m->domain) ) ++ if ( !p2m || !paging_mode_translate(p2m->domain) ) + /* Nothing to do in this case */ + return; + diff --git a/26595-x86-nhvm-properly-clean-up-after-failure-to-set-up-all-vCPU-s.patch b/26595-x86-nhvm-properly-clean-up-after-failure-to-set-up-all-vCPU-s.patch new file mode 100644 index 0000000..4fa14a5 --- /dev/null +++ b/26595-x86-nhvm-properly-clean-up-after-failure-to-set-up-all-vCPU-s.patch @@ -0,0 +1,57 @@ +# Commit 17281aea1a9a10f1ee165c6e6a2921a67b7b1df2 +# Date 2013-02-22 11:21:38 +0100 +# Author Jan Beulich +# Committer Jan Beulich +x86/nhvm: properly clean up after failure to set up all vCPU-s + +Otherwise we may leak memory when setting up nHVM fails half way. + +This implies that the individual destroy functions will have to remain +capable (in the VMX case they first need to be made so, following +26486:7648ef657fe7 and 26489:83a3fa9c8434) of being called for a vCPU +that the corresponding init function was never run on. + +Once at it, also remove a redundant check from the corresponding +parameter validation code. + +Signed-off-by: Jan Beulich +Acked-by: Tim Deegan +Tested-by: Olaf Hering + +--- a/xen/arch/x86/hvm/hvm.c ++++ b/xen/arch/x86/hvm/hvm.c +@@ -3941,18 +3941,20 @@ long do_hvm_op(unsigned long op, XEN_GUE + #else + if ( a.value > 1 ) + rc = -EINVAL; +- if ( !is_hvm_domain(d) ) +- rc = -EINVAL; + /* Remove the check below once we have + * shadow-on-shadow. + */ + if ( cpu_has_svm && !paging_mode_hap(d) && a.value ) + rc = -EINVAL; + /* Set up NHVM state for any vcpus that are already up */ +- if ( !d->arch.hvm_domain.params[HVM_PARAM_NESTEDHVM] ) ++ if ( a.value && ++ !d->arch.hvm_domain.params[HVM_PARAM_NESTEDHVM] ) + for_each_vcpu(d, v) + if ( rc == 0 ) + rc = nestedhvm_vcpu_initialise(v); ++ if ( !a.value || rc ) ++ for_each_vcpu(d, v) ++ nestedhvm_vcpu_destroy(v); + #endif + break; + case HVM_PARAM_BUFIOREQ_EVTCHN: +--- a/xen/arch/x86/hvm/nestedhvm.c ++++ b/xen/arch/x86/hvm/nestedhvm.c +@@ -88,7 +88,7 @@ nestedhvm_vcpu_initialise(struct vcpu *v + void + nestedhvm_vcpu_destroy(struct vcpu *v) + { +- if ( nestedhvm_enabled(v->domain) && hvm_funcs.nhvm_vcpu_destroy ) ++ if ( hvm_funcs.nhvm_vcpu_destroy ) + hvm_funcs.nhvm_vcpu_destroy(v); + } + diff --git a/26601-honor-ACPI-v4-FADT-flags.patch b/26601-honor-ACPI-v4-FADT-flags.patch new file mode 100644 index 0000000..124567b --- /dev/null +++ b/26601-honor-ACPI-v4-FADT-flags.patch @@ -0,0 +1,158 @@ +# Commit 992fdf6f46252a459c6b1b8d971b2c71f01460f8 +# Date 2013-02-22 11:56:54 +0100 +# Author Jan Beulich +# Committer Jan Beulich +honor ACPI v4 FADT flags + +- force use of physical APIC mode if indicated so (as we don't support + xAPIC cluster mode, the respective flag is taken to force physical + mode too) +- don't use MSI if indicated so (implies no IOMMU) + +Both can be overridden on the command line, for the MSI case this at +once adds a new command line option allowing to turn off PCI MSI (IOMMU +and HPET are unaffected by this). + +Signed-off-by: Jan Beulich +Acked-by: Keir Fraser + +--- a/docs/misc/xen-command-line.markdown ++++ b/docs/misc/xen-command-line.markdown +@@ -602,6 +602,13 @@ limit is ignored by Xen. + + Specify if the MMConfig space should be enabled. + ++### msi ++> `= ` ++ ++> Default: `true` ++ ++Force Xen to (not) use PCI-MSI, even if ACPI FADT says otherwise. ++ + ### nmi + > `= ignore | dom0 | fatal` + +--- a/xen/arch/x86/genapic/bigsmp.c ++++ b/xen/arch/x86/genapic/bigsmp.c +@@ -40,7 +40,14 @@ static struct dmi_system_id __initdata b + + static __init int probe_bigsmp(void) + { +- if (!def_to_bigsmp) ++ /* ++ * We don't implement cluster mode, so force use of ++ * physical mode in both cases. ++ */ ++ if (acpi_gbl_FADT.flags & ++ (ACPI_FADT_APIC_CLUSTER | ACPI_FADT_APIC_PHYSICAL)) ++ def_to_bigsmp = 1; ++ else if (!def_to_bigsmp) + dmi_check_system(bigsmp_dmi_table); + return def_to_bigsmp; + } +--- a/xen/arch/x86/genapic/x2apic.c ++++ b/xen/arch/x86/genapic/x2apic.c +@@ -29,9 +29,6 @@ + #include + #include + +-static bool_t __initdata x2apic_phys; /* By default we use logical cluster mode. */ +-boolean_param("x2apic_phys", x2apic_phys); +- + static void init_apic_ldr_x2apic_phys(void) + { + } +@@ -121,8 +118,14 @@ static const struct genapic apic_x2apic_ + .send_IPI_self = send_IPI_self_x2apic + }; + ++static s8 __initdata x2apic_phys = -1; /* By default we use logical cluster mode. */ ++boolean_param("x2apic_phys", x2apic_phys); ++ + const struct genapic *__init apic_x2apic_probe(void) + { ++ if ( x2apic_phys < 0 ) ++ x2apic_phys = !!(acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL); ++ + return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster; + } + +--- a/xen/arch/x86/msi.c ++++ b/xen/arch/x86/msi.c +@@ -31,6 +31,9 @@ + #include + #include + ++static s8 __read_mostly use_msi = -1; ++boolean_param("msi", use_msi); ++ + /* bitmap indicate which fixed map is free */ + DEFINE_SPINLOCK(msix_fixmap_lock); + DECLARE_BITMAP(msix_fixmap_pages, FIX_MSIX_MAX_PAGES); +@@ -958,6 +961,9 @@ int pci_enable_msi(struct msi_info *msi, + { + ASSERT(spin_is_locked(&pcidevs_lock)); + ++ if ( !use_msi ) ++ return -EPERM; ++ + return msi->table_base ? __pci_enable_msix(msi, desc) : + __pci_enable_msi(msi, desc); + } +@@ -1003,7 +1009,10 @@ int pci_restore_msi_state(struct pci_dev + + ASSERT(spin_is_locked(&pcidevs_lock)); + +- if (!pdev) ++ if ( !use_msi ) ++ return -EOPNOTSUPP; ++ ++ if ( !pdev ) + return -EINVAL; + + ret = xsm_resource_setup_pci((pdev->seg << 16) | (pdev->bus << 8) | pdev->devfn); +@@ -1062,7 +1071,7 @@ unsigned int pci_msix_get_table_len(stru + func = PCI_FUNC(pdev->devfn); + + pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX); +- if ( !pos ) ++ if ( !pos || !use_msi ) + return 0; + + control = pci_conf_read16(seg, bus, slot, func, msix_control_reg(pos)); +@@ -1135,6 +1144,9 @@ static struct keyhandler dump_msi_keyhan + + static int __init msi_setup_keyhandler(void) + { ++ if ( use_msi < 0 ) ++ use_msi = !(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_MSI); ++ + register_keyhandler('M', &dump_msi_keyhandler); + return 0; + } +--- a/xen/drivers/passthrough/amd/iommu_acpi.c ++++ b/xen/drivers/passthrough/amd/iommu_acpi.c +@@ -1066,5 +1066,8 @@ int __init amd_iommu_get_ivrs_dev_entrie + + int __init amd_iommu_update_ivrs_mapping_acpi(void) + { ++ if ( unlikely(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_MSI) ) ++ return -EPERM; ++ + return acpi_table_parse(ACPI_SIG_IVRS, parse_ivrs_table); + } +--- a/xen/drivers/passthrough/vtd/iommu.c ++++ b/xen/drivers/passthrough/vtd/iommu.c +@@ -2119,6 +2119,12 @@ int __init intel_vtd_setup(void) + if ( list_empty(&acpi_drhd_units) ) + return -ENODEV; + ++ if ( unlikely(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_MSI) ) ++ { ++ ret = -EPERM; ++ goto error; ++ } ++ + platform_quirks_init(); + + /* We enable the following features only if they are supported by all VT-d diff --git a/26656-x86-fix-null-pointer-dereference-in-intel_get_extended_msrs.patch b/26656-x86-fix-null-pointer-dereference-in-intel_get_extended_msrs.patch new file mode 100644 index 0000000..3904b58 --- /dev/null +++ b/26656-x86-fix-null-pointer-dereference-in-intel_get_extended_msrs.patch @@ -0,0 +1,22 @@ +# Commit c40e24a8ef74f9d0ee59dd9b8ca890be08b0b874 +# Date 2013-02-25 12:44:25 +0100 +# Author Xi Wang +# Committer Jan Beulich +x86: fix null pointer dereference in intel_get_extended_msrs() + +`memset(&mc_ext, 0, ...)' leads to a buffer overflow and a subsequent +null pointer dereference. Replace `&mc_ext' with `mc_ext'. + +Signed-off-by: Xi Wang + +--- a/xen/arch/x86/cpu/mcheck/mce_intel.c ++++ b/xen/arch/x86/cpu/mcheck/mce_intel.c +@@ -534,7 +534,7 @@ intel_get_extended_msrs(struct mcinfo_gl + } + + /* this function will called when CAP(9).MCG_EXT_P = 1 */ +- memset(&mc_ext, 0, sizeof(struct mcinfo_extended)); ++ memset(mc_ext, 0, sizeof(*mc_ext)); + mc_ext->common.type = MC_TYPE_EXTENDED; + mc_ext->common.size = sizeof(struct mcinfo_extended); + diff --git a/26659-AMD-IOMMU-erratum-746-workaround.patch b/26659-AMD-IOMMU-erratum-746-workaround.patch new file mode 100644 index 0000000..877b872 --- /dev/null +++ b/26659-AMD-IOMMU-erratum-746-workaround.patch @@ -0,0 +1,73 @@ +# Commit 0f8adcb2a7183bea5063f6fffba7d7e1aa14fc84 +# Date 2013-02-26 10:14:53 +0100 +# Author Suravee Suthikulpanit +# Committer Jan Beulich +IOMMU, AMD Family15h Model10-1Fh erratum 746 Workaround + +The IOMMU may stop processing page translations due to a perceived lack +of credits for writing upstream peripheral page service request (PPR) +or event logs. If the L2B miscellaneous clock gating feature is enabled +the IOMMU does not properly register credits after the log request has +completed, leading to a potential system hang. + +BIOSes are supposed to disable L2B micellaneous clock gating by setting +L2_L2B_CK_GATE_CONTROL[CKGateL2BMiscDisable](D0F2xF4_x90[2]) = 1b. This +patch corrects that for those which do not enable this workaround. + +Signed-off-by: Suravee Suthikulpanit +Signed-off-by: Jan Beulich + +--- a/xen/drivers/passthrough/amd/iommu_init.c ++++ b/xen/drivers/passthrough/amd/iommu_init.c +@@ -795,6 +795,42 @@ static int __init set_iommu_interrupt_ha + return irq; + } + ++/* ++ * Family15h Model 10h-1fh erratum 746 (IOMMU Logging May Stall Translations) ++ * Workaround: ++ * BIOS should disable L2B micellaneous clock gating by setting ++ * L2_L2B_CK_GATE_CONTROL[CKGateL2BMiscDisable](D0F2xF4_x90[2]) = 1b ++ */ ++static void amd_iommu_erratum_746_workaround(struct amd_iommu *iommu) ++{ ++ u32 value; ++ u8 bus = PCI_BUS(iommu->bdf); ++ u8 dev = PCI_SLOT(iommu->bdf); ++ u8 func = PCI_FUNC(iommu->bdf); ++ ++ if ( (boot_cpu_data.x86 != 0x15) || ++ (boot_cpu_data.x86_model < 0x10) || ++ (boot_cpu_data.x86_model > 0x1f) ) ++ return; ++ ++ pci_conf_write32(iommu->seg, bus, dev, func, 0xf0, 0x90); ++ value = pci_conf_read32(iommu->seg, bus, dev, func, 0xf4); ++ ++ if ( value & (1 << 2) ) ++ return; ++ ++ /* Select NB indirect register 0x90 and enable writing */ ++ pci_conf_write32(iommu->seg, bus, dev, func, 0xf0, 0x90 | (1 << 8)); ++ ++ pci_conf_write32(iommu->seg, bus, dev, func, 0xf4, value | (1 << 2)); ++ printk(XENLOG_INFO ++ "AMD-Vi: Applying erratum 746 workaround for IOMMU at %04x:%02x:%02x.%u\n", ++ iommu->seg, bus, dev, func); ++ ++ /* Clear the enable writing bit */ ++ pci_conf_write32(iommu->seg, bus, dev, func, 0xf0, 0x90); ++} ++ + static void enable_iommu(struct amd_iommu *iommu) + { + unsigned long flags; +@@ -807,6 +843,8 @@ static void enable_iommu(struct amd_iomm + return; + } + ++ amd_iommu_erratum_746_workaround(iommu); ++ + register_iommu_dev_table_in_mmio_space(iommu); + register_iommu_cmd_buffer_in_mmio_space(iommu); + register_iommu_event_log_in_mmio_space(iommu); diff --git a/26660-x86-fix-CMCI-injection.patch b/26660-x86-fix-CMCI-injection.patch new file mode 100644 index 0000000..dbd9358 --- /dev/null +++ b/26660-x86-fix-CMCI-injection.patch @@ -0,0 +1,128 @@ +# Commit 2f8c55ccefe49bb526df0eaf5fa9b7b788422208 +# Date 2013-02-26 10:15:56 +0100 +# Author Jan Beulich +# Committer Jan Beulich +x86: fix CMCI injection + +This fixes the wrong use of literal vector 0xF7 with an "int" +instruction (invalidated by 25113:14609be41f36) and the fact that doing +the injection via a software interrupt was never valid anyway (because +cmci_interrupt() acks the LAPIC, which does the wrong thing if the +interrupt didn't get delivered though it). + +In order to do latter, the patch introduces send_IPI_self(), at once +removing two opend coded uses of "genapic" in the IRQ handling code. + +Reported-by: Yongjie Ren +Signed-off-by: Jan Beulich +Tested-by: Yongjie Ren +Acked-by: Keir Fraser + +--- a/xen/arch/x86/cpu/mcheck/mce.c ++++ b/xen/arch/x86/cpu/mcheck/mce.c +@@ -30,6 +30,7 @@ bool_t __read_mostly mce_broadcast = 0; + bool_t is_mc_panic; + unsigned int __read_mostly nr_mce_banks; + unsigned int __read_mostly firstbank; ++uint8_t __read_mostly cmci_apic_vector; + + static void intpose_init(void); + static void mcinfo_clear(struct mc_info *); +@@ -1277,12 +1278,6 @@ static void x86_mc_mceinject(void *data) + __asm__ __volatile__("int $0x12"); + } + +-static void x86_cmci_inject(void *data) +-{ +- printk("Simulating CMCI on cpu %d\n", smp_processor_id()); +- __asm__ __volatile__("int $0xf7"); +-} +- + #if BITS_PER_LONG == 64 + + #define ID2COOKIE(id) ((mctelem_cookie_t)(id)) +@@ -1568,11 +1563,15 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u + on_selected_cpus(cpumap, x86_mc_mceinject, NULL, 1); + break; + case XEN_MC_INJECT_TYPE_CMCI: +- if ( !cmci_support ) ++ if ( !cmci_apic_vector ) + ret = x86_mcerr( + "No CMCI supported in platform\n", -EINVAL); + else +- on_selected_cpus(cpumap, x86_cmci_inject, NULL, 1); ++ { ++ if ( cpumask_test_cpu(smp_processor_id(), cpumap) ) ++ send_IPI_self(cmci_apic_vector); ++ send_IPI_mask(cpumap, cmci_apic_vector); ++ } + break; + default: + ret = x86_mcerr("Wrong mca type\n", -EINVAL); +--- a/xen/arch/x86/cpu/mcheck/mce.h ++++ b/xen/arch/x86/cpu/mcheck/mce.h +@@ -38,6 +38,8 @@ enum mcheck_type { + mcheck_intel + }; + ++extern uint8_t cmci_apic_vector; ++ + /* Init functions */ + enum mcheck_type amd_k7_mcheck_init(struct cpuinfo_x86 *c); + enum mcheck_type amd_k8_mcheck_init(struct cpuinfo_x86 *c); +--- a/xen/arch/x86/cpu/mcheck/mce_intel.c ++++ b/xen/arch/x86/cpu/mcheck/mce_intel.c +@@ -1164,7 +1164,6 @@ static void intel_init_cmci(struct cpuin + { + u32 l, apic; + int cpu = smp_processor_id(); +- static uint8_t cmci_apic_vector; + + if (!mce_available(c) || !cmci_support) { + if (opt_cpu_info) +--- a/xen/arch/x86/irq.c ++++ b/xen/arch/x86/irq.c +@@ -646,7 +646,7 @@ void irq_move_cleanup_interrupt(struct c + * to myself. + */ + if (irr & (1 << (vector % 32))) { +- genapic->send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR); ++ send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR); + TRACE_3D(TRC_HW_IRQ_MOVE_CLEANUP_DELAY, + irq, vector, smp_processor_id()); + goto unlock; +@@ -692,7 +692,7 @@ static void send_cleanup_vector(struct i + + cpumask_and(&cleanup_mask, desc->arch.old_cpu_mask, &cpu_online_map); + desc->arch.move_cleanup_count = cpumask_weight(&cleanup_mask); +- genapic->send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR); ++ send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR); + + desc->arch.move_in_progress = 0; + } +--- a/xen/arch/x86/smp.c ++++ b/xen/arch/x86/smp.c +@@ -43,6 +43,11 @@ void send_IPI_mask(const cpumask_t *mask + genapic->send_IPI_mask(mask, vector); + } + ++void send_IPI_self(int vector) ++{ ++ genapic->send_IPI_self(vector); ++} ++ + /* + * Some notes on x86 processor bugs affecting SMP operation: + * +--- a/xen/include/asm-x86/smp.h ++++ b/xen/include/asm-x86/smp.h +@@ -29,7 +29,8 @@ DECLARE_PER_CPU(cpumask_var_t, cpu_core_ + + void smp_send_nmi_allbutself(void); + +-void send_IPI_mask(const cpumask_t *mask, int vector); ++void send_IPI_mask(const cpumask_t *, int vector); ++void send_IPI_self(int vector); + + extern void (*mtrr_hook) (void); + diff --git a/26672-vmx-fix-handling-of-NMI-VMEXIT.patch b/26672-vmx-fix-handling-of-NMI-VMEXIT.patch new file mode 100644 index 0000000..a8c5bf5 --- /dev/null +++ b/26672-vmx-fix-handling-of-NMI-VMEXIT.patch @@ -0,0 +1,107 @@ +# Commit 7dd3b06ff031c9a8c727df16c5def2afb382101c +# Date 2013-02-28 14:00:18 +0000 +# Author Tim Deegan +# Committer Tim Deegan +vmx: fix handling of NMI VMEXIT. + +Call do_nmi() directly and explicitly re-enable NMIs rather than +raising an NMI through the APIC. Since NMIs are disabled after the +VMEXIT, the raised NMI would be blocked until the next IRET +instruction (i.e. the next real interrupt, or after scheduling a PV +guest) and in the meantime the guest will spin taking NMI VMEXITS. + +Also, handle NMIs before re-enabling interrupts, since if we handle an +interrupt (and therefore IRET) before calling do_nmi(), we may end up +running the NMI handler with NMIs enabled. + +Signed-off-by: Tim Deegan +Acked-by: Andrew Cooper +Acked-by: Jan Beulich + +--- a/xen/arch/x86/hvm/vmx/vmx.c ++++ b/xen/arch/x86/hvm/vmx/vmx.c +@@ -2421,6 +2421,13 @@ void vmx_vmexit_handler(struct cpu_user_ + vector = intr_info & INTR_INFO_VECTOR_MASK; + if ( vector == TRAP_machine_check ) + do_machine_check(regs); ++ if ( vector == TRAP_nmi ++ && ((intr_info & INTR_INFO_INTR_TYPE_MASK) == ++ (X86_EVENTTYPE_NMI << 8)) ) ++ { ++ do_nmi(regs); ++ enable_nmis(); ++ } + break; + case EXIT_REASON_MCE_DURING_VMENTRY: + do_machine_check(regs); +@@ -2594,7 +2601,7 @@ void vmx_vmexit_handler(struct cpu_user_ + (X86_EVENTTYPE_NMI << 8) ) + goto exit_and_crash; + HVMTRACE_0D(NMI); +- self_nmi(); /* Real NMI, vector 2: normal processing. */ ++ /* Already handled above. */ + break; + case TRAP_machine_check: + HVMTRACE_0D(MCE); +--- a/xen/arch/x86/x86_32/entry.S ++++ b/xen/arch/x86/x86_32/entry.S +@@ -621,6 +621,14 @@ ENTRY(machine_check) + pushl $TRAP_machine_check<<16 + jmp handle_nmi_mce + ++/* Enable NMIs. No special register assumptions. All registers are preserved. */ ++ENTRY(enable_nmis) ++ /* Set up stack frame */ ++ pushf # EFLAGS ++ push %cs # CS ++ push $.Lret # EIP ++ iret # Disable the hardware NMI latch ++ + ENTRY(setup_vm86_frame) + mov %ecx,%ds + mov %ecx,%es +@@ -634,7 +642,7 @@ ENTRY(setup_vm86_frame) + .endm + copy_vm86_words + addl $16,%esp +- ret ++.Lret: ret + + .section .rodata, "a", @progbits + +--- a/xen/arch/x86/x86_64/entry.S ++++ b/xen/arch/x86/x86_64/entry.S +@@ -643,6 +643,22 @@ ENTRY(machine_check) + movl $TRAP_machine_check,4(%rsp) + jmp handle_ist_exception + ++/* Enable NMIs. No special register assumptions. Only %rax is not preserved. */ ++ENTRY(enable_nmis) ++ movq %rsp, %rax /* Grab RSP before pushing */ ++ ++ /* Set up stack frame */ ++ pushq $0 /* SS */ ++ pushq %rax /* RSP */ ++ pushfq /* RFLAGS */ ++ pushq $__HYPERVISOR_CS /* CS */ ++ leaq 1f(%rip),%rax ++ pushq %rax /* RIP */ ++ ++ iretq /* Disable the hardware NMI latch */ ++1: ++ retq ++ + .section .rodata, "a", @progbits + + ENTRY(exception_table) +--- a/xen/include/asm-x86/processor.h ++++ b/xen/include/asm-x86/processor.h +@@ -584,6 +584,8 @@ DECLARE_TRAP_HANDLER(alignment_check); + DECLARE_TRAP_HANDLER(spurious_interrupt_bug); + #undef DECLARE_TRAP_HANDLER + ++void enable_nmis(void); ++ + void syscall_enter(void); + void sysenter_entry(void); + void sysenter_eflags_saved(void); diff --git a/26673-Avoid-stale-pointer-when-moving-domain-to-another-cpupool.patch b/26673-Avoid-stale-pointer-when-moving-domain-to-another-cpupool.patch new file mode 100644 index 0000000..f11c352 --- /dev/null +++ b/26673-Avoid-stale-pointer-when-moving-domain-to-another-cpupool.patch @@ -0,0 +1,80 @@ +# Commit 482300def7d08e773ccd2a0d978bcb9469fdd810 +# Date 2013-02-28 14:56:45 +0000 +# Author Juergen Gross +# Committer Keir Fraser +Avoid stale pointer when moving domain to another cpupool + +When a domain is moved to another cpupool the scheduler private data pointers +in vcpu and domain structures must never point to an already freed memory +area. + +While at it, simplify sched_init_vcpu() by using DOM2OP instead VCPU2OP. + +Signed-off-by: Juergen Gross + +--- a/xen/common/schedule.c ++++ b/xen/common/schedule.c +@@ -220,7 +220,7 @@ int sched_init_vcpu(struct vcpu *v, unsi + if ( v->sched_priv == NULL ) + return 1; + +- SCHED_OP(VCPU2OP(v), insert_vcpu, v); ++ SCHED_OP(DOM2OP(d), insert_vcpu, v); + + return 0; + } +@@ -231,6 +231,9 @@ int sched_move_domain(struct domain *d, + unsigned int new_p; + void **vcpu_priv; + void *domdata; ++ void *vcpudata; ++ struct scheduler *old_ops; ++ void *old_domdata; + + domdata = SCHED_OP(c->sched, alloc_domdata, d); + if ( domdata == NULL ) +@@ -261,21 +264,22 @@ int sched_move_domain(struct domain *d, + + domain_pause(d); + ++ old_ops = DOM2OP(d); ++ old_domdata = d->sched_priv; ++ + for_each_vcpu ( d, v ) + { +- SCHED_OP(VCPU2OP(v), remove_vcpu, v); +- SCHED_OP(VCPU2OP(v), free_vdata, v->sched_priv); +- v->sched_priv = NULL; ++ SCHED_OP(old_ops, remove_vcpu, v); + } + +- SCHED_OP(DOM2OP(d), free_domdata, d->sched_priv); +- + d->cpupool = c; + d->sched_priv = domdata; + + new_p = cpumask_first(c->cpu_valid); + for_each_vcpu ( d, v ) + { ++ vcpudata = v->sched_priv; ++ + migrate_timer(&v->periodic_timer, new_p); + migrate_timer(&v->singleshot_timer, new_p); + migrate_timer(&v->poll_timer, new_p); +@@ -288,12 +292,16 @@ int sched_move_domain(struct domain *d, + new_p = cpumask_cycle(new_p, c->cpu_valid); + + SCHED_OP(c->sched, insert_vcpu, v); ++ ++ SCHED_OP(old_ops, free_vdata, vcpudata); + } + + domain_update_node_affinity(d); + + domain_unpause(d); + ++ SCHED_OP(old_ops, free_domdata, old_domdata); ++ + xfree(vcpu_priv); + + return 0; diff --git a/26675-tools-xentoollog_update_tty_detection_in_stdiostream_progress.patch b/26675-tools-xentoollog_update_tty_detection_in_stdiostream_progress.patch new file mode 100644 index 0000000..667fa84 --- /dev/null +++ b/26675-tools-xentoollog_update_tty_detection_in_stdiostream_progress.patch @@ -0,0 +1,43 @@ +changeset: 26675:3eb62c576a1a +user: Olaf Hering +date: Wed Feb 27 14:16:36 2013 +0000 +files: tools/libxc/xtl_logger_stdio.c +description: +tools/xentoollog: update tty detection in stdiostream_progress + +As suggested by IanJ: +Check isatty only once to preserve the errno of ->progress users, and to +reduce the noice in strace output. + +Signed-off-by: Olaf Hering +Acked-by: Ian Jackson + + +diff -r 4b25c1e6cfbb -r 3eb62c576a1a tools/libxc/xtl_logger_stdio.c +--- a/tools/libxc/xtl_logger_stdio.c Wed Feb 27 11:16:47 2013 +0000 ++++ b/tools/libxc/xtl_logger_stdio.c Wed Feb 27 14:16:36 2013 +0000 +@@ -35,6 +35,7 @@ struct xentoollog_logger_stdiostream { + xentoollog_level min_level; + unsigned flags; + int progress_erase_len, progress_last_percent; ++ int tty; + }; + + static void progress_erase(xentoollog_logger_stdiostream *lg) { +@@ -118,7 +119,7 @@ static void stdiostream_progress(struct + + lg->progress_last_percent = percent; + +- if (isatty(fileno(lg->f)) <= 0) { ++ if (!lg->tty) { + stdiostream_message(logger_in, this_level, context, + "%s: %lu/%lu %3d%%", + doing_what, done, total, percent); +@@ -166,6 +167,7 @@ xentoollog_logger_stdiostream *xtl_creat + newlogger.f = f; + newlogger.min_level = min_level; + newlogger.flags = flags; ++ newlogger.tty = isatty(fileno(newlogger.f)) > 0; + + if (newlogger.flags & XTL_STDIOSTREAM_SHOW_DATE) tzset(); + diff --git a/26676-fix-compat-memory-exchange-op-splitting.patch b/26676-fix-compat-memory-exchange-op-splitting.patch new file mode 100644 index 0000000..c65141f --- /dev/null +++ b/26676-fix-compat-memory-exchange-op-splitting.patch @@ -0,0 +1,24 @@ +# Commit 53decd322157e922cac2988e07da6d39538c8033 +# Date 2013-03-01 16:59:49 +0100 +# Author Jan Beulich +# Committer Jan Beulich +fix compat memory exchange op splitting + +A shift with a negative count was erroneously used here, yielding +undefined behavior. + +Reported-by: Xi Wang +Signed-off-by: Jan Beulich +Acked-by: Keir Fraser + +--- a/xen/common/compat/memory.c ++++ b/xen/common/compat/memory.c +@@ -172,7 +172,7 @@ int compat_memory_op(unsigned int cmd, X + if ( order_delta >= 0 ) + nat.xchg->out.nr_extents = end_extent >> order_delta; + else +- nat.xchg->out.nr_extents = end_extent << order_delta; ++ nat.xchg->out.nr_extents = end_extent << -order_delta; + ++split; + } + diff --git a/26677-x86-make-certain-memory-sub-ops-return-valid-values.patch b/26677-x86-make-certain-memory-sub-ops-return-valid-values.patch new file mode 100644 index 0000000..6a3a4df --- /dev/null +++ b/26677-x86-make-certain-memory-sub-ops-return-valid-values.patch @@ -0,0 +1,78 @@ +# Commit 7ffc9779aa5120c5098d938cb88f69a1dda9a0fe +# Date 2013-03-04 10:16:04 +0100 +# Author Jan Beulich +# Committer Jan Beulich +x86: make certain memory sub-ops return valid values + +When a domain's shared info field "max_pfn" is zero, +domain_get_maximum_gpfn() so far returned ULONG_MAX, which +do_memory_op() in turn converted to -1 (i.e. -EPERM). Make the former +always return a sensible number (i.e. zero if the field was zero) and +have the latter no longer truncate return values. + +Signed-off-by: Jan Beulich +Acked-by: Tim Deegan + +--- a/xen/arch/x86/mm.c ++++ b/xen/arch/x86/mm.c +@@ -437,7 +437,7 @@ unsigned long domain_get_maximum_gpfn(st + if ( is_hvm_domain(d) ) + return p2m_get_hostp2m(d)->max_mapped_pfn; + /* NB. PV guests specify nr_pfns rather than max_pfn so we adjust here. */ +- return arch_get_max_pfn(d) - 1; ++ return (arch_get_max_pfn(d) ?: 1) - 1; + } + + void share_xen_page_with_guest( +--- a/xen/common/compat/memory.c ++++ b/xen/common/compat/memory.c +@@ -15,7 +15,8 @@ CHECK_TYPE(domid); + + int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE(void) compat) + { +- int rc, split, op = cmd & MEMOP_CMD_MASK; ++ int split, op = cmd & MEMOP_CMD_MASK; ++ long rc; + unsigned int start_extent = cmd >> MEMOP_EXTENT_SHIFT; + + do +@@ -204,7 +205,7 @@ int compat_memory_op(unsigned int cmd, X + + rc = do_memory_op(cmd, nat.hnd); + if ( rc < 0 ) +- return rc; ++ break; + + cmd = 0; + if ( hypercall_xlat_continuation(&cmd, 0x02, nat.hnd, compat) ) +@@ -318,5 +319,11 @@ int compat_memory_op(unsigned int cmd, X + __HYPERVISOR_memory_op, "ih", cmd, compat); + } while ( split > 0 ); + ++ if ( unlikely(rc > INT_MAX) ) ++ return INT_MAX; ++ ++ if ( unlikely(rc < INT_MIN) ) ++ return INT_MIN; ++ + return rc; + } +--- a/xen/common/memory.c ++++ b/xen/common/memory.c +@@ -532,14 +532,13 @@ static long memory_exchange(XEN_GUEST_HA + long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE(void) arg) + { + struct domain *d; +- int rc, op; ++ long rc; + unsigned int address_bits; + unsigned long start_extent; + struct xen_memory_reservation reservation; + struct memop_args args; + domid_t domid; +- +- op = cmd & MEMOP_CMD_MASK; ++ int op = cmd & MEMOP_CMD_MASK; + + switch ( op ) + { diff --git a/26678-SEDF-avoid-gathering-vCPU-s-on-pCPU0.patch b/26678-SEDF-avoid-gathering-vCPU-s-on-pCPU0.patch new file mode 100644 index 0000000..6111035 --- /dev/null +++ b/26678-SEDF-avoid-gathering-vCPU-s-on-pCPU0.patch @@ -0,0 +1,58 @@ +# Commit e6a6fd63652814e5c36a0016c082032f798ced1f +# Date 2013-03-04 10:17:52 +0100 +# Author Jan Beulich +# Committer Jan Beulich +SEDF: avoid gathering vCPU-s on pCPU0 + +The introduction of vcpu_force_reschedule() in 14320:215b799fa181 was +incompatible with the SEDF scheduler: Any vCPU using +VCPUOP_stop_periodic_timer (e.g. any vCPU of half way modern PV Linux +guests) ends up on pCPU0 after that call. Obviously, running all PV +guests' (and namely Dom0's) vCPU-s on pCPU0 causes problems for those +guests rather sooner than later. + +So the main thing that was clearly wrong (and bogus from the beginning) +was the use of cpumask_first() in sedf_pick_cpu(). It is being replaced +by a construct that prefers to put back the vCPU on the pCPU that it +got launched on. + +However, there's one more glitch: When reducing the affinity of a vCPU +temporarily, and then widening it again to a set that includes the pCPU +that the vCPU was last running on, the generic scheduler code would not +force a migration of that vCPU, and hence it would forever stay on the +pCPU it last ran on. Since that can again create a load imbalance, the +SEDF scheduler wants a migration to happen regardless of it being +apparently unnecessary. + +Of course, an alternative to checking for SEDF explicitly in +vcpu_set_affinity() would be to introduce a flags field in struct +scheduler, and have SEDF set a "always-migrate-on-affinity-change" +flag. + +Signed-off-by: Jan Beulich +Acked-by: Keir Fraser + +--- a/xen/common/sched_sedf.c ++++ b/xen/common/sched_sedf.c +@@ -396,7 +396,8 @@ static int sedf_pick_cpu(const struct sc + + online = cpupool_scheduler_cpumask(v->domain->cpupool); + cpumask_and(&online_affinity, v->cpu_affinity, online); +- return cpumask_first(&online_affinity); ++ return cpumask_cycle(v->vcpu_id % cpumask_weight(&online_affinity) - 1, ++ &online_affinity); + } + + /* +--- a/xen/common/schedule.c ++++ b/xen/common/schedule.c +@@ -611,7 +611,8 @@ int vcpu_set_affinity(struct vcpu *v, co + vcpu_schedule_lock_irq(v); + + cpumask_copy(v->cpu_affinity, affinity); +- if ( !cpumask_test_cpu(v->processor, v->cpu_affinity) ) ++ if ( VCPU2OP(v)->sched_id == XEN_SCHEDULER_SEDF || ++ !cpumask_test_cpu(v->processor, v->cpu_affinity) ) + set_bit(_VPF_migrating, &v->pause_flags); + + vcpu_schedule_unlock_irq(v); diff --git a/26679-x86-defer-processing-events-on-the-NMI-exit-path.patch b/26679-x86-defer-processing-events-on-the-NMI-exit-path.patch new file mode 100644 index 0000000..f36378e --- /dev/null +++ b/26679-x86-defer-processing-events-on-the-NMI-exit-path.patch @@ -0,0 +1,134 @@ +# Commit d463b005bbd6475ed930a302821efe239e1b2cf9 +# Date 2013-03-04 10:19:34 +0100 +# Author Jan Beulich +# Committer Jan Beulich +x86: defer processing events on the NMI exit path + +Otherwise, we may end up in the scheduler, keeping NMIs masked for a +possibly unbounded period of time (until whenever the next IRET gets +executed). Enforce timely event processing by sending a self IPI. + +Of course it's open for discussion whether to always use the straight +exit path from handle_ist_exception. + +Signed-off-by: Jan Beulich +Acked-by: Keir Fraser + +--- a/xen/arch/x86/x86_32/entry.S ++++ b/xen/arch/x86/x86_32/entry.S +@@ -60,6 +60,7 @@ + #include + #include + #include ++#include + + ALIGN + restore_all_guest: +@@ -561,6 +562,8 @@ ENTRY(early_page_fault) + jmp restore_all_xen + .popsection + ++ENTRY(nmi) ++ pushl $TRAP_nmi<<16 + handle_nmi_mce: + #ifdef CONFIG_X86_SUPERVISOR_MODE_KERNEL + # NMI/MCE entry protocol is incompatible with guest kernel in ring 0. +@@ -581,7 +584,24 @@ handle_nmi_mce: + * cases we have put guest DS/ES on the guest stack frame, which will + * be detected by SAVE_ALL(), or we have rolled back restore_guest. + */ +- jmp ret_from_intr ++ cmpb $TRAP_nmi,UREGS_entry_vector(%esp) ++ jne ret_from_intr ++ /* We want to get straight to the IRET on the NMI exit path. */ ++ GET_CURRENT(%ebx) ++ movl UREGS_eflags(%esp),%eax ++ movb UREGS_cs(%esp),%al ++ testl $(3|X86_EFLAGS_VM),%eax ++ jz restore_all_xen ++ /* Send an IPI to ourselves to cover for the lack of event checking. */ ++ movl VCPU_processor(%ebx),%eax ++ shll $IRQSTAT_shift,%eax ++ cmpl $0,irq_stat(%eax) ++ je restore_all_guest ++ pushl $EVENT_CHECK_VECTOR ++ call send_IPI_self ++ addl $4,%esp ++ jmp restore_all_guest ++ + .Lnmi_mce_xen: + /* Check the outer (guest) context for %ds/%es state validity. */ + GET_CPUINFO_FIELD(CPUINFO_guest_cpu_user_regs,%ebx) +@@ -613,10 +633,6 @@ handle_nmi_mce: + jmp .Lnmi_mce_common + #endif /* !CONFIG_X86_SUPERVISOR_MODE_KERNEL */ + +-ENTRY(nmi) +- pushl $TRAP_nmi<<16 +- jmp handle_nmi_mce +- + ENTRY(machine_check) + pushl $TRAP_machine_check<<16 + jmp handle_nmi_mce +--- a/xen/arch/x86/x86_64/compat/entry.S ++++ b/xen/arch/x86/x86_64/compat/entry.S +@@ -171,7 +171,7 @@ compat_bad_hypercall: + jmp compat_test_all_events + + /* %rbx: struct vcpu, interrupts disabled */ +-compat_restore_all_guest: ++ENTRY(compat_restore_all_guest) + ASSERT_INTERRUPTS_DISABLED + RESTORE_ALL + addq $8,%rsp +--- a/xen/arch/x86/x86_64/entry.S ++++ b/xen/arch/x86/x86_64/entry.S +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + + ALIGN + /* %rbx: struct vcpu */ +@@ -617,6 +618,9 @@ ENTRY(early_page_fault) + jmp restore_all_xen + .popsection + ++ENTRY(nmi) ++ pushq $0 ++ movl $TRAP_nmi,4(%rsp) + handle_ist_exception: + SAVE_ALL + testb $3,UREGS_cs(%rsp) +@@ -631,12 +635,25 @@ handle_ist_exception: + movl UREGS_entry_vector(%rsp),%eax + leaq exception_table(%rip),%rdx + callq *(%rdx,%rax,8) +- jmp ret_from_intr ++ cmpb $TRAP_nmi,UREGS_entry_vector(%rsp) ++ jne ret_from_intr + +-ENTRY(nmi) +- pushq $0 +- movl $TRAP_nmi,4(%rsp) +- jmp handle_ist_exception ++ /* We want to get straight to the IRET on the NMI exit path. */ ++ testb $3,UREGS_cs(%rsp) ++ jz restore_all_xen ++ GET_CURRENT(%rbx) ++ /* Send an IPI to ourselves to cover for the lack of event checking. */ ++ movl VCPU_processor(%rbx),%eax ++ shll $IRQSTAT_shift,%eax ++ leaq irq_stat(%rip),%rcx ++ cmpl $0,(%rcx,%rax,1) ++ je 1f ++ movl $EVENT_CHECK_VECTOR,%edi ++ call send_IPI_self ++1: movq VCPU_domain(%rbx),%rax ++ cmpb $0,DOMAIN_is_32bit_pv(%rax) ++ je restore_all_guest ++ jmp compat_restore_all_guest + + ENTRY(machine_check) + pushq $0 diff --git a/26683-credit1-Use-atomic-bit-operations-for-the-flags-structure.patch b/26683-credit1-Use-atomic-bit-operations-for-the-flags-structure.patch new file mode 100644 index 0000000..b498cb0 --- /dev/null +++ b/26683-credit1-Use-atomic-bit-operations-for-the-flags-structure.patch @@ -0,0 +1,113 @@ +# Commit be6507509454adf3bb5a50b9406c88504e996d5a +# Date 2013-03-04 13:37:39 +0100 +# Author George Dunlap +# Committer Jan Beulich +credit1: Use atomic bit operations for the flags structure + +The flags structure is not protected by locks (or more precisely, +it is protected using an inconsistent set of locks); we therefore need +to make sure that all accesses are atomic-safe. This is particulary +important in the case of the PARKED flag, which if clobbered while +changing the YIELD bit will leave a vcpu wedged in an offline state. + +Using the atomic bitops also requires us to change the size of the "flags" +element. + +Spotted-by: Igor Pavlikevich +Signed-off-by: George Dunlap + +--- a/xen/common/sched_credit.c ++++ b/xen/common/sched_credit.c +@@ -58,8 +58,8 @@ + /* + * Flags + */ +-#define CSCHED_FLAG_VCPU_PARKED 0x0001 /* VCPU over capped credits */ +-#define CSCHED_FLAG_VCPU_YIELD 0x0002 /* VCPU yielding */ ++#define CSCHED_FLAG_VCPU_PARKED 0x0 /* VCPU over capped credits */ ++#define CSCHED_FLAG_VCPU_YIELD 0x1 /* VCPU yielding */ + + + /* +@@ -132,7 +132,7 @@ struct csched_vcpu { + struct vcpu *vcpu; + atomic_t credit; + s_time_t start_time; /* When we were scheduled (used for credit) */ +- uint16_t flags; ++ unsigned flags; + int16_t pri; + #ifdef CSCHED_STATS + struct { +@@ -214,7 +214,7 @@ __runq_insert(unsigned int cpu, struct c + /* If the vcpu yielded, try to put it behind one lower-priority + * runnable vcpu if we can. The next runq_sort will bring it forward + * within 30ms if the queue too long. */ +- if ( svc->flags & CSCHED_FLAG_VCPU_YIELD ++ if ( test_bit(CSCHED_FLAG_VCPU_YIELD, &svc->flags) + && __runq_elem(iter)->pri > CSCHED_PRI_IDLE ) + { + iter=iter->next; +@@ -776,7 +776,7 @@ csched_vcpu_wake(const struct scheduler + * those. + */ + if ( svc->pri == CSCHED_PRI_TS_UNDER && +- !(svc->flags & CSCHED_FLAG_VCPU_PARKED) ) ++ !test_bit(CSCHED_FLAG_VCPU_PARKED, &svc->flags) ) + { + svc->pri = CSCHED_PRI_TS_BOOST; + } +@@ -789,12 +789,12 @@ csched_vcpu_wake(const struct scheduler + static void + csched_vcpu_yield(const struct scheduler *ops, struct vcpu *vc) + { +- struct csched_vcpu * const sv = CSCHED_VCPU(vc); ++ struct csched_vcpu * const svc = CSCHED_VCPU(vc); + + if ( !sched_credit_default_yield ) + { + /* Let the scheduler know that this vcpu is trying to yield */ +- sv->flags |= CSCHED_FLAG_VCPU_YIELD; ++ set_bit(CSCHED_FLAG_VCPU_YIELD, &svc->flags); + } + } + +@@ -1122,11 +1122,10 @@ csched_acct(void* dummy) + /* Park running VCPUs of capped-out domains */ + if ( sdom->cap != 0U && + credit < -credit_cap && +- !(svc->flags & CSCHED_FLAG_VCPU_PARKED) ) ++ !test_and_set_bit(CSCHED_FLAG_VCPU_PARKED, &svc->flags) ) + { + CSCHED_STAT_CRANK(vcpu_park); + vcpu_pause_nosync(svc->vcpu); +- svc->flags |= CSCHED_FLAG_VCPU_PARKED; + } + + /* Lower bound on credits */ +@@ -1142,7 +1141,7 @@ csched_acct(void* dummy) + svc->pri = CSCHED_PRI_TS_UNDER; + + /* Unpark any capped domains whose credits go positive */ +- if ( svc->flags & CSCHED_FLAG_VCPU_PARKED) ++ if ( test_and_clear_bit(CSCHED_FLAG_VCPU_PARKED, &svc->flags) ) + { + /* + * It's important to unset the flag AFTER the unpause() +@@ -1151,7 +1150,6 @@ csched_acct(void* dummy) + */ + CSCHED_STAT_CRANK(vcpu_unpark); + vcpu_unpause(svc->vcpu); +- svc->flags &= ~CSCHED_FLAG_VCPU_PARKED; + } + + /* Upper bound on credits means VCPU stops earning */ +@@ -1410,8 +1408,7 @@ csched_schedule( + /* + * Clear YIELD flag before scheduling out + */ +- if ( scurr->flags & CSCHED_FLAG_VCPU_YIELD ) +- scurr->flags &= ~(CSCHED_FLAG_VCPU_YIELD); ++ clear_bit(CSCHED_FLAG_VCPU_YIELD, &scurr->flags); + + /* + * SMP Load balance: diff --git a/26686-xentrace-fix-off-by-one-in-calculate_tbuf_size.patch b/26686-xentrace-fix-off-by-one-in-calculate_tbuf_size.patch new file mode 100644 index 0000000..248c8f2 --- /dev/null +++ b/26686-xentrace-fix-off-by-one-in-calculate_tbuf_size.patch @@ -0,0 +1,36 @@ +# Commit d9fb28ae6d41c8201482948660e52889481830dd +# Date 2013-03-04 13:42:17 +0100 +# Author Olaf Hering +# Committer Jan Beulich +xentrace: fix off-by-one in calculate_tbuf_size + +Commit "xentrace: reduce trace buffer size to something mfn_offset can +reach" contains an off-by-one bug. max_mfn_offset needs to be reduced by +exactly the value of t_info_first_offset. + +If the system has two cpus and the number of requested trace pages is +very large, the final number of trace pages + the offset will not fit +into a short. As a result the variable offset in alloc_trace_bufs() will +wrap while allocating buffers for the second cpu. Later +share_xen_page_with_privileged_guests() will be called with a wrong page +and the ASSERT in this function triggers. If the ASSERT is ignored by +running a non-dbg hypervisor the asserts in xentrace itself trigger +because "cons" is not aligned because the very last trace page for the +second cpu is a random mfn. + +Thanks to Jan for the quick analysis. + +Signed-off-by: Olaf Hering +Acked-by: George Dunlap + +--- a/xen/common/trace.c ++++ b/xen/common/trace.c +@@ -133,7 +133,7 @@ static int calculate_tbuf_size(unsigned + * The array of mfns for the highest cpu can start at the maximum value + * mfn_offset can hold. So reduce the number of cpus and also the mfn_offset. + */ +- max_mfn_offset -= t_info_first_offset - 1; ++ max_mfn_offset -= t_info_first_offset; + max_cpus--; + if ( max_cpus ) + max_mfn_offset /= max_cpus; diff --git a/26689-fix-domain-unlocking-in-some-xsm-error-paths.patch b/26689-fix-domain-unlocking-in-some-xsm-error-paths.patch new file mode 100644 index 0000000..483f2fc --- /dev/null +++ b/26689-fix-domain-unlocking-in-some-xsm-error-paths.patch @@ -0,0 +1,25 @@ +# Commit 9581c4f9a55372a21e759cd449cb676d0e8feddb +# Date 2013-03-06 17:10:26 +0100 +# Author Matthew Daley +# Committer Jan Beulich +fix domain unlocking in some xsm error paths + +A couple of xsm error/access-denied code paths in hypercalls neglect to +unlock a previously locked domain. Fix by ensuring the domains are +unlocked correctly. + +Signed-off-by: Matthew Daley +Reviewed-by: Jan Beulich +Acked-by: Keir Fraser + +--- a/xen/common/grant_table.c ++++ b/xen/common/grant_table.c +@@ -2262,7 +2262,7 @@ gnttab_get_status_frames(XEN_GUEST_HANDL + rc = xsm_grant_setup(current->domain, d); + if ( rc ) { + op.status = GNTST_permission_denied; +- goto out1; ++ goto out2; + } + + gt = d->grant_table; diff --git a/32on64-extra-mem.patch b/32on64-extra-mem.patch index 9dedc09..7eaa83a 100644 --- a/32on64-extra-mem.patch +++ b/32on64-extra-mem.patch @@ -2,7 +2,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -2966,7 +2966,7 @@ class XendDomainInfo: +@@ -2982,7 +2982,7 @@ class XendDomainInfo: self.guest_bitsize = self.image.getBitSize() # Make sure there's enough RAM available for the domain diff --git a/blktap-pv-cdrom.patch b/blktap-pv-cdrom.patch index 0d5f410..f4345af 100644 --- a/blktap-pv-cdrom.patch +++ b/blktap-pv-cdrom.patch @@ -9,10 +9,10 @@ xen/include/public/io/cdromif.h | 122 ++++ 8 files changed, 726 insertions(+), 3 deletions(-) -Index: xen-4.2.0-testing/tools/blktap/drivers/Makefile +Index: xen-4.2.1-testing/tools/blktap/drivers/Makefile =================================================================== ---- xen-4.2.0-testing.orig/tools/blktap/drivers/Makefile -+++ xen-4.2.0-testing/tools/blktap/drivers/Makefile +--- xen-4.2.1-testing.orig/tools/blktap/drivers/Makefile ++++ xen-4.2.1-testing/tools/blktap/drivers/Makefile @@ -38,8 +38,9 @@ endif CFLAGS += $(PTHREAD_CFLAGS) LDFLAGS += $(PTHREAD_LDFLAGS) @@ -33,11 +33,11 @@ Index: xen-4.2.0-testing/tools/blktap/drivers/Makefile BLK-OBJS-y += aes.o BLK-OBJS-y += tapaio.o BLK-OBJS-$(CONFIG_Linux) += blk_linux.o -Index: xen-4.2.0-testing/tools/blktap/drivers/block-cdrom.c +Index: xen-4.2.1-testing/tools/blktap/drivers/block-cdrom.c =================================================================== --- /dev/null -+++ xen-4.2.0-testing/tools/blktap/drivers/block-cdrom.c -@@ -0,0 +1,565 @@ ++++ xen-4.2.1-testing/tools/blktap/drivers/block-cdrom.c +@@ -0,0 +1,568 @@ +/* block-cdrom.c + * + * simple slow synchronous cdrom disk implementation. Based off @@ -514,6 +514,9 @@ Index: xen-4.2.0-testing/tools/blktap/drivers/block-cdrom.c + unsigned int len; + + media_present = xs_read(prv->xs_handle, XBT_NULL, vec[XS_WATCH_PATH], &len); ++ if (media_present == NULL) ++ return; ++ + if (strcmp(media_present, "0") == 0) { + close(prv->fd); + prv->fd = -1; @@ -603,10 +606,10 @@ Index: xen-4.2.0-testing/tools/blktap/drivers/block-cdrom.c + .td_get_parent_id = tdcdrom_get_parent_id, + .td_validate_parent = tdcdrom_validate_parent +}; -Index: xen-4.2.0-testing/tools/blktap/drivers/tapdisk.c +Index: xen-4.2.1-testing/tools/blktap/drivers/tapdisk.c =================================================================== ---- xen-4.2.0-testing.orig/tools/blktap/drivers/tapdisk.c -+++ xen-4.2.0-testing/tools/blktap/drivers/tapdisk.c +--- xen-4.2.1-testing.orig/tools/blktap/drivers/tapdisk.c ++++ xen-4.2.1-testing/tools/blktap/drivers/tapdisk.c @@ -735,6 +735,22 @@ static void get_io_request(struct td_sta goto out; } @@ -630,10 +633,10 @@ Index: xen-4.2.0-testing/tools/blktap/drivers/tapdisk.c default: DPRINTF("Unknown block operation\n"); break; -Index: xen-4.2.0-testing/tools/blktap/drivers/tapdisk.h +Index: xen-4.2.1-testing/tools/blktap/drivers/tapdisk.h =================================================================== ---- xen-4.2.0-testing.orig/tools/blktap/drivers/tapdisk.h -+++ xen-4.2.0-testing/tools/blktap/drivers/tapdisk.h +--- xen-4.2.1-testing.orig/tools/blktap/drivers/tapdisk.h ++++ xen-4.2.1-testing/tools/blktap/drivers/tapdisk.h @@ -137,6 +137,9 @@ struct tap_disk { int (*td_get_parent_id) (struct disk_driver *dd, struct disk_id *id); int (*td_validate_parent)(struct disk_driver *dd, @@ -678,10 +681,10 @@ Index: xen-4.2.0-testing/tools/blktap/drivers/tapdisk.h }; typedef struct driver_list_entry { -Index: xen-4.2.0-testing/tools/blktap/lib/blktaplib.h +Index: xen-4.2.1-testing/tools/blktap/lib/blktaplib.h =================================================================== ---- xen-4.2.0-testing.orig/tools/blktap/lib/blktaplib.h -+++ xen-4.2.0-testing/tools/blktap/lib/blktaplib.h +--- xen-4.2.1-testing.orig/tools/blktap/lib/blktaplib.h ++++ xen-4.2.1-testing/tools/blktap/lib/blktaplib.h @@ -219,6 +219,7 @@ typedef struct msg_pid { #define DISK_TYPE_RAM 3 #define DISK_TYPE_QCOW 4 @@ -690,10 +693,10 @@ Index: xen-4.2.0-testing/tools/blktap/lib/blktaplib.h /* xenstore/xenbus: */ #define DOMNAME "Domain-0" -Index: xen-4.2.0-testing/tools/python/xen/xend/server/BlktapController.py +Index: xen-4.2.1-testing/tools/python/xen/xend/server/BlktapController.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/server/BlktapController.py -+++ xen-4.2.0-testing/tools/python/xen/xend/server/BlktapController.py +--- xen-4.2.1-testing.orig/tools/python/xen/xend/server/BlktapController.py ++++ xen-4.2.1-testing/tools/python/xen/xend/server/BlktapController.py @@ -15,6 +15,7 @@ blktap1_disk_types = [ 'ram', 'qcow', @@ -702,10 +705,10 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/server/BlktapController.py 'ioemu', ] -Index: xen-4.2.0-testing/xen/include/public/io/blkif.h +Index: xen-4.2.1-testing/xen/include/public/io/blkif.h =================================================================== ---- xen-4.2.0-testing.orig/xen/include/public/io/blkif.h -+++ xen-4.2.0-testing/xen/include/public/io/blkif.h +--- xen-4.2.1-testing.orig/xen/include/public/io/blkif.h ++++ xen-4.2.1-testing/xen/include/public/io/blkif.h @@ -379,7 +379,7 @@ * Used in SLES sources for device specific command packet * contained within the request. Reserved for that purpose. @@ -715,10 +718,10 @@ Index: xen-4.2.0-testing/xen/include/public/io/blkif.h /* * Indicate to the backend device that a region of storage is no longer in * use, and may be discarded at any time without impact to the client. If -Index: xen-4.2.0-testing/xen/include/public/io/cdromif.h +Index: xen-4.2.1-testing/xen/include/public/io/cdromif.h =================================================================== --- /dev/null -+++ xen-4.2.0-testing/xen/include/public/io/cdromif.h ++++ xen-4.2.1-testing/xen/include/public/io/cdromif.h @@ -0,0 +1,122 @@ +/****************************************************************************** + * cdromif.h diff --git a/blktap.patch b/blktap.patch index 6ab25d4..3644ec0 100644 --- a/blktap.patch +++ b/blktap.patch @@ -1,11 +1,11 @@ bug #239173 bug #242953 -Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -3301,7 +3301,7 @@ class XendDomainInfo: +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -3315,7 +3315,7 @@ class XendDomainInfo: (fn, BOOTLOADER_LOOPBACK_DEVICE)) vbd = { @@ -14,10 +14,10 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py 'device': BOOTLOADER_LOOPBACK_DEVICE, } -Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c +Index: xen-4.2.1-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c =================================================================== ---- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/xenstore.c -+++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c +--- xen-4.2.1-testing.orig/tools/qemu-xen-traditional-dir-remote/xenstore.c ++++ xen-4.2.1-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c @@ -447,9 +447,9 @@ void xenstore_parse_domain_config(int hv { char **e_danger = NULL; diff --git a/change-vnc-passwd.patch b/change-vnc-passwd.patch index 97d1f15..232b503 100644 --- a/change-vnc-passwd.patch +++ b/change-vnc-passwd.patch @@ -2,10 +2,10 @@ Add support of change-vnc-password while vm is running. Signed-off-by: Chunyan Liu -Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c +Index: xen-4.2.1-testing/tools/qemu-xen-traditional-dir-remote/vl.c =================================================================== ---- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vl.c -+++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c +--- xen-4.2.1-testing.orig/tools/qemu-xen-traditional-dir-remote/vl.c ++++ xen-4.2.1-testing/tools/qemu-xen-traditional-dir-remote/vl.c @@ -200,7 +200,7 @@ DriveInfo drives_table[MAX_DRIVES+1]; int nb_drives; enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; @@ -15,10 +15,10 @@ Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c int nographic; static int curses; static int sdl; -Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vnc.c +Index: xen-4.2.1-testing/tools/qemu-xen-traditional-dir-remote/vnc.c =================================================================== ---- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vnc.c -+++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vnc.c +--- xen-4.2.1-testing.orig/tools/qemu-xen-traditional-dir-remote/vnc.c ++++ xen-4.2.1-testing/tools/qemu-xen-traditional-dir-remote/vnc.c @@ -2627,6 +2627,7 @@ int vnc_display_password(DisplayState *d if (password && password[0]) { if (!(vs->password = qemu_strdup(password))) @@ -27,10 +27,10 @@ Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/vnc.c } return 0; -Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c +Index: xen-4.2.1-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c =================================================================== ---- xen-4.2.0-testing.orig/tools/qemu-xen-traditional-dir-remote/xenstore.c -+++ xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c +--- xen-4.2.1-testing.orig/tools/qemu-xen-traditional-dir-remote/xenstore.c ++++ xen-4.2.1-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c @@ -24,6 +24,7 @@ #include "qemu-timer.h" #include "qemu-xen.h" @@ -59,11 +59,11 @@ Index: xen-4.2.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c } else if (!strncmp(command, "usb-add", len)) { fprintf(logfile, "dm-command: usb-add a usb device\n"); if (pasprintf(&path, -Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -1490,6 +1490,20 @@ class XendDomainInfo: +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -1504,6 +1504,20 @@ class XendDomainInfo: target = max_target self.setMemoryTarget(target) @@ -84,10 +84,10 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py def setMemoryTarget(self, target): """Set the memory target of this domain. @param target: In MiB. -Index: xen-4.2.0-testing/tools/python/xen/xend/server/XMLRPCServer.py +Index: xen-4.2.1-testing/tools/python/xen/xend/server/XMLRPCServer.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/server/XMLRPCServer.py -+++ xen-4.2.0-testing/tools/python/xen/xend/server/XMLRPCServer.py +--- xen-4.2.1-testing.orig/tools/python/xen/xend/server/XMLRPCServer.py ++++ xen-4.2.1-testing/tools/python/xen/xend/server/XMLRPCServer.py @@ -95,7 +95,7 @@ methods = ['device_create', 'device_conf 'destroyDevice','getDeviceSxprs', 'setMemoryTarget', 'setName', 'setVCpuCount', 'shutdown', @@ -97,10 +97,10 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/server/XMLRPCServer.py exclude = ['domain_create', 'domain_restore'] -Index: xen-4.2.0-testing/tools/python/xen/xm/main.py +Index: xen-4.2.1-testing/tools/python/xen/xm/main.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xm/main.py -+++ xen-4.2.0-testing/tools/python/xen/xm/main.py +--- xen-4.2.1-testing.orig/tools/python/xen/xm/main.py ++++ xen-4.2.1-testing/tools/python/xen/xm/main.py @@ -21,6 +21,7 @@ """Grand unified management application for Xen. diff --git a/change_home_server.patch b/change_home_server.patch index ff4aa57..ce87435 100644 --- a/change_home_server.patch +++ b/change_home_server.patch @@ -1,8 +1,8 @@ -Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -3139,6 +3139,11 @@ class XendDomainInfo: +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -3153,6 +3153,11 @@ class XendDomainInfo: self._cleanup_phantom_devs(paths) self._cleanupVm() diff --git a/checkpoint-rename.patch b/checkpoint-rename.patch index a29d56a..239b628 100644 --- a/checkpoint-rename.patch +++ b/checkpoint-rename.patch @@ -1,8 +1,8 @@ -Index: xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendCheckpoint.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendCheckpoint.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py -@@ -172,7 +172,7 @@ def save(fd, dominfo, network, live, dst +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendCheckpoint.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendCheckpoint.py +@@ -185,7 +185,7 @@ def save(fd, dominfo, network, live, dst dominfo.destroy() dominfo.testDeviceComplete() try: diff --git a/hv_extid_compatibility.patch b/hv_extid_compatibility.patch index f9f45b9..28bfa4d 100644 --- a/hv_extid_compatibility.patch +++ b/hv_extid_compatibility.patch @@ -1,8 +1,8 @@ -Index: xen-4.2.0-testing/tools/python/xen/xend/XendConfig.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendConfig.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendConfig.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendConfig.py -@@ -159,6 +159,7 @@ XENAPI_PLATFORM_CFG_TYPES = { +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendConfig.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendConfig.py +@@ -161,6 +161,7 @@ XENAPI_PLATFORM_CFG_TYPES = { 'nographic': int, 'nomigrate': int, 'pae' : int, @@ -10,8 +10,8 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/XendConfig.py 'rtc_timeoffset': int, 'parallel': str, 'serial': str, -@@ -517,6 +518,8 @@ class XendConfig(dict): - if self.is_hvm(): +@@ -523,6 +524,8 @@ class XendConfig(dict): + self['platform']['acpi_firmware'] = "" if 'timer_mode' not in self['platform']: self['platform']['timer_mode'] = 1 + if 'extid' in self['platform'] and int(self['platform']['extid']) == 1: @@ -19,11 +19,11 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/XendConfig.py if 'viridian' not in self['platform']: self['platform']['viridian'] = 0 if 'rtc_timeoffset' not in self['platform']: -Index: xen-4.2.0-testing/tools/python/xen/xend/image.py +Index: xen-4.2.1-testing/tools/python/xen/xend/image.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/image.py -+++ xen-4.2.0-testing/tools/python/xen/xend/image.py -@@ -828,6 +828,7 @@ class HVMImageHandler(ImageHandler): +--- xen-4.2.1-testing.orig/tools/python/xen/xend/image.py ++++ xen-4.2.1-testing/tools/python/xen/xend/image.py +@@ -830,6 +830,7 @@ class HVMImageHandler(ImageHandler): self.apic = int(vmConfig['platform'].get('apic', 0)) self.acpi = int(vmConfig['platform'].get('acpi', 0)) @@ -31,10 +31,10 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/image.py self.guest_os_type = vmConfig['platform'].get('guest_os_type') self.memory_sharing = int(vmConfig['memory_sharing']) try: -Index: xen-4.2.0-testing/tools/python/xen/xm/create.py +Index: xen-4.2.1-testing/tools/python/xen/xm/create.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xm/create.py -+++ xen-4.2.0-testing/tools/python/xen/xm/create.py +--- xen-4.2.1-testing.orig/tools/python/xen/xm/create.py ++++ xen-4.2.1-testing/tools/python/xen/xm/create.py @@ -242,6 +242,10 @@ gopts.var('viridian', val='VIRIDIAN', use="""Expose Viridian interface to x86 HVM guest? (Default is 0).""") @@ -46,7 +46,7 @@ Index: xen-4.2.0-testing/tools/python/xen/xm/create.py gopts.var('acpi', val='ACPI', fn=set_int, default=1, use="Disable or enable ACPI of HVM domain.") -@@ -1111,7 +1115,7 @@ def configure_hvm(config_image, vals): +@@ -1120,7 +1124,7 @@ def configure_hvm(config_image, vals): 'timer_mode', 'usb', 'usbdevice', 'vcpus', 'vnc', 'vncconsole', 'vncdisplay', 'vnclisten', @@ -55,7 +55,7 @@ Index: xen-4.2.0-testing/tools/python/xen/xm/create.py 'watchdog', 'watchdog_action', 'xauthority', 'xen_extended_power_mgmt', 'xen_platform_pci', 'memory_sharing' ] -@@ -1121,6 +1125,10 @@ def configure_hvm(config_image, vals): +@@ -1130,6 +1134,10 @@ def configure_hvm(config_image, vals): config_image.append([a, vals.__dict__[a]]) if vals.vncpasswd is not None: config_image.append(['vncpasswd', vals.vncpasswd]) diff --git a/multi-xvdp.patch b/multi-xvdp.patch index ca615b6..d83ea8d 100644 --- a/multi-xvdp.patch +++ b/multi-xvdp.patch @@ -5,10 +5,10 @@ bootloader loopback device. This patch creates a list of bootloader loopback devices so more than one instance of bootloader can be run concurrently. -Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py @@ -74,7 +74,7 @@ from xen.xend.XendPSCSI import XendPSCSI from xen.xend.XendDSCSI import XendDSCSI, XendDSCSI_HBA @@ -18,7 +18,7 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py xc = xen.lowlevel.xc.xc() xoptions = XendOptions.instance() -@@ -3308,33 +3308,38 @@ class XendDomainInfo: +@@ -3322,33 +3322,38 @@ class XendDomainInfo: # This is a file, not a device. pygrub can cope with a # file if it's raw, but if it's QCOW or other such formats # used through blktap, then we need to mount it first. diff --git a/tmp-initscript-modprobe.patch b/tmp-initscript-modprobe.patch index 96744f0..a1617b2 100644 --- a/tmp-initscript-modprobe.patch +++ b/tmp-initscript-modprobe.patch @@ -1,8 +1,8 @@ -Index: xen-4.2.0-testing/tools/hotplug/Linux/init.d/xencommons +Index: xen-4.2.1-testing/tools/hotplug/Linux/init.d/xencommons =================================================================== ---- xen-4.2.0-testing.orig/tools/hotplug/Linux/init.d/xencommons -+++ xen-4.2.0-testing/tools/hotplug/Linux/init.d/xencommons -@@ -54,21 +54,26 @@ do_start () { +--- xen-4.2.1-testing.orig/tools/hotplug/Linux/init.d/xencommons ++++ xen-4.2.1-testing/tools/hotplug/Linux/init.d/xencommons +@@ -54,21 +54,27 @@ do_start () { local time=0 local timeout=30 @@ -36,7 +36,8 @@ Index: xen-4.2.0-testing/tools/hotplug/Linux/init.d/xencommons + modprobe usbbk 2>/dev/null || true + modprobe pciback 2>/dev/null || true + modprobe xen-acpi-processor 2>/dev/null || true -+ modprobe blktap2 2>/dev/null || modprobe blktap 2>/dev/null || true ++ modprobe blktap2 2>/dev/null || true ++ modprobe blktap 2>/dev/null || true + # xenblk (frontend module) is needed in dom0, allowing it to use vbds + modprobe xenblk 2>/dev/null || true + # support xl create pv guest with qcow/qcow2 disk image diff --git a/x86-extra-trap-info.patch b/x86-extra-trap-info.patch index bc2487d..d876dee 100644 --- a/x86-extra-trap-info.patch +++ b/x86-extra-trap-info.patch @@ -1,6 +1,19 @@ +--- a/xen/arch/x86/x86_32/entry.S ++++ b/xen/arch/x86/x86_32/entry.S +@@ -410,8 +410,10 @@ UNLIKELY_END(bounce_vm86_3) + _ASM_EXTABLE(.Lft24, domain_crash_synchronous) + _ASM_EXTABLE(.Lft25, domain_crash_synchronous) + ++.section .rodata, "a", @progbits + domain_crash_synchronous_string: + .asciz "domain_crash_sync called from entry.S (%lx)\n" ++.previous + + domain_crash_synchronous: + pushl $domain_crash_synchronous_string --- a/xen/arch/x86/x86_64/entry.S +++ b/xen/arch/x86/x86_64/entry.S -@@ -427,22 +427,35 @@ UNLIKELY_END(bounce_failsafe) +@@ -428,22 +428,35 @@ UNLIKELY_END(bounce_failsafe) jz domain_crash_synchronous movq %rax,UREGS_rip+8(%rsp) ret diff --git a/xen-domUloader.diff b/xen-domUloader.diff index b70e777..5f0d5a5 100644 --- a/xen-domUloader.diff +++ b/xen-domUloader.diff @@ -1,7 +1,7 @@ -Index: xen-4.2.0-testing/tools/python/xen/xend/server/DevController.py +Index: xen-4.2.1-testing/tools/python/xen/xend/server/DevController.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/server/DevController.py -+++ xen-4.2.0-testing/tools/python/xen/xend/server/DevController.py +--- xen-4.2.1-testing.orig/tools/python/xen/xend/server/DevController.py ++++ xen-4.2.1-testing/tools/python/xen/xend/server/DevController.py @@ -592,6 +592,31 @@ class DevController: return (Missing, None) @@ -34,10 +34,10 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/server/DevController.py def backendPath(self, backdom, devid): """Construct backend path given the backend domain and device id. -Index: xen-4.2.0-testing/tools/python/xen/xend/XendBootloader.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendBootloader.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendBootloader.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendBootloader.py +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendBootloader.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendBootloader.py @@ -12,7 +12,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # @@ -75,11 +75,11 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/XendBootloader.py log.error(msg) raise VmError(msg) -Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -2333,6 +2333,10 @@ class XendDomainInfo: +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -2347,6 +2347,10 @@ class XendDomainInfo: deviceClass, config = self.info['devices'].get(dev_uuid) self._waitForDevice(deviceClass, config['devid']) @@ -90,7 +90,7 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py def _waitForDevice_destroy(self, deviceClass, devid, backpath): return self.getDeviceController(deviceClass).waitForDevice_destroy( devid, backpath) -@@ -3283,7 +3287,8 @@ class XendDomainInfo: +@@ -3297,7 +3301,8 @@ class XendDomainInfo: from xen.xend import XendDomain dom0 = XendDomain.instance().privilegedDomain() mounted_vbd_uuid = dom0.create_vbd(vbd, disk); @@ -100,7 +100,7 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py fn = BOOTLOADER_LOOPBACK_DEVICE try: -@@ -3293,10 +3298,10 @@ class XendDomainInfo: +@@ -3307,10 +3312,10 @@ class XendDomainInfo: if mounted: log.info("Unmounting %s from %s." % (fn, BOOTLOADER_LOOPBACK_DEVICE)) diff --git a/xen-managed-pci-device.patch b/xen-managed-pci-device.patch index 2f8557c..e012fdd 100644 --- a/xen-managed-pci-device.patch +++ b/xen-managed-pci-device.patch @@ -225,7 +225,16 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py self._constructDomain() try: -@@ -851,6 +868,9 @@ class XendDomainInfo: +@@ -712,6 +729,8 @@ class XendDomainInfo: + the device. + """ + ++ if self.domid is None: ++ return + self.iommu_check_pod_mode() + + # Test whether the devices can be assigned +@@ -851,6 +870,9 @@ class XendDomainInfo: if self.domid is not None: try: @@ -235,7 +244,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py dev_config_dict['devid'] = devid = \ self._createDevice(dev_type, dev_config_dict) if dev_type == 'tap2': -@@ -864,6 +884,7 @@ class XendDomainInfo: +@@ -864,6 +886,7 @@ class XendDomainInfo: if dev_type == 'pci': for dev in dev_config_dict['devs']: XendAPIStore.deregister(dev['uuid'], 'DPCI') @@ -243,7 +252,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py elif dev_type == 'vscsi': for dev in dev_config_dict['devs']: XendAPIStore.deregister(dev['uuid'], 'DSCSI') -@@ -908,6 +929,9 @@ class XendDomainInfo: +@@ -908,6 +931,9 @@ class XendDomainInfo: dev_config = pci_convert_sxp_to_dict(dev_sxp) dev = dev_config['devs'][0] @@ -253,7 +262,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py stubdomid = self.getStubdomDomid() # Do HVM specific processing if self.info.is_hvm(): -@@ -984,6 +1008,9 @@ class XendDomainInfo: +@@ -984,6 +1010,9 @@ class XendDomainInfo: new_dev_sxp = dev_control.configuration(devid) self.info.device_update(dev_uuid, new_dev_sxp) @@ -263,7 +272,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py # If there is no device left, destroy pci and remove config. if num_devs == 0: if self.info.is_hvm(): -@@ -3154,6 +3181,7 @@ class XendDomainInfo: +@@ -3168,6 +3197,7 @@ class XendDomainInfo: log.debug("%s KiB need to add to Memory pool" %self.alloc_mem) MemoryPool.instance().increase_memory(self.alloc_mem) diff --git a/xen-max-free-mem.diff b/xen-max-free-mem.diff index 7d5a0e5..81ee8b1 100644 --- a/xen-max-free-mem.diff +++ b/xen-max-free-mem.diff @@ -1,7 +1,7 @@ -Index: xen-4.2.0-testing/tools/python/xen/xend/XendNode.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendNode.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendNode.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendNode.py +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendNode.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendNode.py @@ -949,11 +949,35 @@ class XendNode: info['cpu_mhz'] = info['cpu_khz'] / 1000 @@ -51,10 +51,10 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/XendNode.py ] if show_numa != 0: -Index: xen-4.2.0-testing/tools/python/xen/xend/balloon.py +Index: xen-4.2.1-testing/tools/python/xen/xend/balloon.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/balloon.py -+++ xen-4.2.0-testing/tools/python/xen/xend/balloon.py +--- xen-4.2.1-testing.orig/tools/python/xen/xend/balloon.py ++++ xen-4.2.1-testing/tools/python/xen/xend/balloon.py @@ -43,6 +43,8 @@ SLEEP_TIME_GROWTH = 0.1 # label actually shown in the PROC_XEN_BALLOON file. #labels = { 'current' : 'Current allocation', @@ -88,13 +88,13 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/balloon.py def free(need_mem, dominfo): """Balloon out memory from the privileged domain so that there is the specified required amount (in KiB) free. -Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -1459,6 +1459,27 @@ class XendDomainInfo: - pci_conf = self.info['devices'][dev_uuid][1] - return map(pci_dict_to_bdf_str, pci_conf['devs']) +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -1473,6 +1473,27 @@ class XendDomainInfo: + self.info['abort_if_busy'] = str(abort_if_busy) + self.info['log_save_progress'] = str(log_save_progress) + def capAndSetMemoryTarget(self, target): + """Potentially lowers the requested target to the largest possible @@ -120,10 +120,10 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py def setMemoryTarget(self, target): """Set the memory target of this domain. @param target: In MiB. -Index: xen-4.2.0-testing/tools/python/xen/xend/server/SrvDomain.py +Index: xen-4.2.1-testing/tools/python/xen/xend/server/SrvDomain.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/server/SrvDomain.py -+++ xen-4.2.0-testing/tools/python/xen/xend/server/SrvDomain.py +--- xen-4.2.1-testing.orig/tools/python/xen/xend/server/SrvDomain.py ++++ xen-4.2.1-testing/tools/python/xen/xend/server/SrvDomain.py @@ -187,7 +187,7 @@ class SrvDomain(SrvDir): @@ -133,10 +133,10 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/server/SrvDomain.py [['target', 'int']], req) -Index: xen-4.2.0-testing/tools/python/xen/xend/osdep.py +Index: xen-4.2.1-testing/tools/python/xen/xend/osdep.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/osdep.py -+++ xen-4.2.0-testing/tools/python/xen/xend/osdep.py +--- xen-4.2.1-testing.orig/tools/python/xen/xend/osdep.py ++++ xen-4.2.1-testing/tools/python/xen/xend/osdep.py @@ -42,6 +42,8 @@ def _linux_balloon_stat_proc(label): xend2linux_labels = { 'current' : 'Current allocation', diff --git a/xen.changes b/xen.changes index 47774f2..1d43161 100644 --- a/xen.changes +++ b/xen.changes @@ -1,3 +1,94 @@ +------------------------------------------------------------------- +Thu Mar 14 09:58:38 MDT 2013 - jfehlig@suse.com + +- Load blktap module in xencommons init script. blktap2 doesn't + support qcow2, so blktap is needed to support domains with + 'tap:qcow2' disk configurations. + modified tmp-initscript-modprobe.patch + +------------------------------------------------------------------- +Thu Mar 14 07:32:17 MDT 2013 - carnold@suse.com + +- bnc#809203 - xen.efi isn't signed with SUSE Secure Boot key + xen.spec + +------------------------------------------------------------------- +Mon Mar 11 21:07:21 MDT 2013 - jfehlig@suse.com + +- Fix adding managed PCI device to an inactive domain + modified xen-managed-pci-device.patch + +------------------------------------------------------------------- +Mon Mar 11 11:45:22 MDT 2013 - jfehlig@suse.com + +- bnc#805094 - xen hot plug attach/detach fails + modified blktap-pv-cdrom.patch + +------------------------------------------------------------------- +Mon Mar 11 11:17:57 MDT 2013 - jfehlig@suse.com + +- bnc# 802690 - domain locking can prevent a live migration from + completing + modified xend-domain-lock.patch + +------------------------------------------------------------------- +Fri Mar 8 15:01:15 CET 2013 - ohering@suse.de + +- bnc#797014 - no way to control live migrations + 26675-tools-xentoollog_update_tty_detection_in_stdiostream_progress.patch + xen.migrate.tools-xc_print_messages_from_xc_save_with_xc_report.patch + xen.migrate.tools-xc_document_printf_calls_in_xc_restore.patch + xen.migrate.tools-xc_rework_xc_save.cswitch_qemu_logdirty.patch + xen.migrate.tools_set_migration_constraints_from_cmdline.patch + xen.migrate.tools_add_xm_migrate_--log_progress_option.patch + +------------------------------------------------------------------- +Thu Mar 7 14:39:57 MST 2013 - carnold@suse.com + +- Upstream patches from Jan + 26585-x86-mm-Take-the-p2m-lock-even-in-shadow-mode.patch + 26595-x86-nhvm-properly-clean-up-after-failure-to-set-up-all-vCPU-s.patch + 26601-honor-ACPI-v4-FADT-flags.patch + 26656-x86-fix-null-pointer-dereference-in-intel_get_extended_msrs.patch + 26659-AMD-IOMMU-erratum-746-workaround.patch + 26660-x86-fix-CMCI-injection.patch + 26672-vmx-fix-handling-of-NMI-VMEXIT.patch + 26673-Avoid-stale-pointer-when-moving-domain-to-another-cpupool.patch + 26676-fix-compat-memory-exchange-op-splitting.patch + 26677-x86-make-certain-memory-sub-ops-return-valid-values.patch + 26678-SEDF-avoid-gathering-vCPU-s-on-pCPU0.patch + 26679-x86-defer-processing-events-on-the-NMI-exit-path.patch + 26683-credit1-Use-atomic-bit-operations-for-the-flags-structure.patch + 26689-fix-domain-unlocking-in-some-xsm-error-paths.patch + +------------------------------------------------------------------- +Tue Mar 5 13:35:40 MST 2013 - carnold@suse.com + +- fate#313584: pass bios information to XEN HVM guest + xend-hvm-firmware-passthrough.patch + +------------------------------------------------------------------- +Mon Mar 4 20:28:29 CET 2013 - ohering@suse.de + +- bnc#806736: enabling xentrace crashes hypervisor + 26686-xentrace_fix_off-by-one_in_calculate_tbuf_size.patch + +------------------------------------------------------------------- +Thu Feb 28 11:12:04 CET 2013 - ohering@suse.de + +- update xenalyze to revision 149 + Make eip_list output more useful + Use correct length when copying record into buffer + decode PV_HYPERCALL_SUBCALL events + decode PV_HYPERCALL_V2 records + Analyze populate-on-demand reclamation patterns + Handle 64-bit MMIO + Also strip write bit when processing a generic event + Make the warnigns in hvm_generic_postprocess more informative + Don't warn about switching paging levels unless verbosity>=6 + Process NPFs as generic for summary purposes + Add HVM_EVENT_VLAPIC + ------------------------------------------------------------------- Wed Feb 20 15:00:13 MST 2013 - jfehlig@suse.com diff --git a/xen.migrate.tools-xc_document_printf_calls_in_xc_restore.patch b/xen.migrate.tools-xc_document_printf_calls_in_xc_restore.patch new file mode 100644 index 0000000..544abcd --- /dev/null +++ b/xen.migrate.tools-xc_document_printf_calls_in_xc_restore.patch @@ -0,0 +1,20 @@ +user: Olaf Hering +date: Wed Mar 06 16:42:02 2013 +0100 +files: tools/xcutils/xc_restore.c +description: +tools/xc: document printf calls in xc_restore + +Signed-off-by: Olaf Hering + + +diff -r e5ae0e680b5c -r 49b90990442a tools/xcutils/xc_restore.c +--- a/tools/xcutils/xc_restore.c ++++ b/tools/xcutils/xc_restore.c +@@ -56,6 +56,7 @@ main(int argc, char **argv) + + if ( ret == 0 ) + { ++ /* xend expects this output, part of protocol */ + printf("store-mfn %li\n", store_mfn); + if ( !hvm ) + printf("console-mfn %li\n", console_mfn); diff --git a/xen.migrate.tools-xc_print_messages_from_xc_save_with_xc_report.patch b/xen.migrate.tools-xc_print_messages_from_xc_save_with_xc_report.patch new file mode 100644 index 0000000..6a900ed --- /dev/null +++ b/xen.migrate.tools-xc_print_messages_from_xc_save_with_xc_report.patch @@ -0,0 +1,178 @@ +user: Olaf Hering +date: Wed Mar 06 16:32:08 2013 +0100 +files: tools/libxc/xc_private.h tools/xcutils/xc_save.c +description: +tools/xc: print messages from xc_save with xc_report + +Make use of xc_report in xc_save to log also pid if some error occoured. + +Signed-off-by: Olaf Hering + + +diff -r 7af4246a6e1c -r e5ae0e680b5c tools/libxc/xc_private.h +--- a/tools/libxc/xc_private.h ++++ b/tools/libxc/xc_private.h +@@ -119,6 +119,7 @@ void xc_report_progress_step(xc_interfac + + /* anamorphic macros: struct xc_interface *xch must be in scope */ + ++#define WPRINTF(_f, _a...) xc_report(xch, xch->error_handler, XTL_WARN,0, _f , ## _a) + #define IPRINTF(_f, _a...) xc_report(xch, xch->error_handler, XTL_INFO,0, _f , ## _a) + #define DPRINTF(_f, _a...) xc_report(xch, xch->error_handler, XTL_DETAIL,0, _f , ## _a) + #define DBGPRINTF(_f, _a...) xc_report(xch, xch->error_handler, XTL_DEBUG,0, _f , ## _a) +diff -r 7af4246a6e1c -r e5ae0e680b5c tools/xcutils/xc_save.c +--- a/tools/xcutils/xc_save.c ++++ b/tools/xcutils/xc_save.c +@@ -7,6 +7,7 @@ + * + */ + ++#include + #include + #include + #include +@@ -19,6 +20,7 @@ + #include + #include + ++#include + #include + #include + #include +@@ -51,16 +53,17 @@ static int compat_suspend(void) + * receive the acknowledgement from the subscribe event channel. */ + static int evtchn_suspend(void) + { ++ xc_interface *xch = si.xch; + int rc; + + rc = xc_evtchn_notify(si.xce, si.suspend_evtchn); + if (rc < 0) { +- warnx("failed to notify suspend request channel: %d", rc); ++ WPRINTF("failed to notify suspend request channel: %d", rc); + return 0; + } + +- if (xc_await_suspend(si.xch, si.xce, si.suspend_evtchn) < 0) { +- warnx("suspend failed"); ++ if (xc_await_suspend(xch, si.xce, si.suspend_evtchn) < 0) { ++ WPRINTF("suspend failed"); + return 0; + } + +@@ -104,20 +107,27 @@ static int suspend(void* data) + + static int switch_qemu_logdirty(int domid, unsigned int enable, void *data) + { ++ xc_interface *xch = si.xch; + struct xs_handle *xs; + char *path, *p, *ret_str, *cmd_str, **watch; + unsigned int len; + struct timeval tv; + fd_set fdset; + +- if ((xs = xs_daemon_open()) == NULL) +- errx(1, "Couldn't contact xenstore"); +- if (!(path = strdup("/local/domain/0/device-model/"))) +- errx(1, "can't get domain path in store"); ++ if ((xs = xs_daemon_open()) == NULL) { ++ PERROR("Couldn't contact xenstore"); ++ exit(1); ++ } ++ if (!(path = strdup("/local/domain/0/device-model/"))) { ++ PERROR("can't get domain path in store"); ++ exit(1); ++ } + if (!(path = realloc(path, strlen(path) + + 10 +- + strlen("/logdirty/cmd") + 1))) +- errx(1, "no memory for constructing xenstore path"); ++ + strlen("/logdirty/cmd") + 1))) { ++ PERROR("no memory for constructing xenstore path"); ++ exit(1); ++ } + snprintf(path + strlen(path), 11, "%i", domid); + strcat(path, "/logdirty/"); + p = path + strlen(path); +@@ -126,16 +136,22 @@ static int switch_qemu_logdirty(int domi + /* Watch for qemu's return value */ + strcpy(p, "ret"); + if (!xs_watch(xs, path, "qemu-logdirty-ret")) +- errx(1, "can't set watch in store (%s)\n", path); ++ { ++ ERROR("can't set watch in store (%s)\n", path); ++ exit(1); ++ } + +- if (!(cmd_str = strdup( enable == 0 ? "disable" : "enable"))) +- errx(1, "can't get logdirty cmd path in store"); ++ if (!(cmd_str = strdup( enable == 0 ? "disable" : "enable"))) { ++ PERROR("can't get logdirty cmd path in store"); ++ exit(1); ++ } + + /* Tell qemu that we want it to start logging dirty page to Xen */ + strcpy(p, "cmd"); +- if (!xs_write(xs, XBT_NULL, path, cmd_str, strlen(cmd_str))) +- errx(1, "can't write to store path (%s)\n", +- path); ++ if (!xs_write(xs, XBT_NULL, path, cmd_str, strlen(cmd_str))) { ++ PERROR("can't write to store path (%s)\n", path); ++ exit(1); ++ } + + /* Wait a while for qemu to signal that it has service logdirty command */ + read_again: +@@ -144,8 +160,10 @@ static int switch_qemu_logdirty(int domi + FD_ZERO(&fdset); + FD_SET(xs_fileno(xs), &fdset); + +- if ((select(xs_fileno(xs) + 1, &fdset, NULL, NULL, &tv)) != 1) +- errx(1, "timed out waiting for qemu logdirty response.\n"); ++ if ((select(xs_fileno(xs) + 1, &fdset, NULL, NULL, &tv)) != 1) { ++ PERROR("timed out waiting for qemu logdirty response.\n"); ++ exit(1); ++ } + + watch = xs_read_watch(xs, &len); + free(watch); +@@ -166,6 +184,7 @@ static int switch_qemu_logdirty(int domi + int + main(int argc, char **argv) + { ++ xc_interface *xch; + unsigned int maxit, max_f, lflags; + int io_fd, ret, port; + struct save_callbacks callbacks; +@@ -186,26 +205,26 @@ main(int argc, char **argv) + lvl = si.flags & XCFLAGS_DEBUG ? XTL_DEBUG: XTL_DETAIL; + lflags = XTL_STDIOSTREAM_SHOW_PID | XTL_STDIOSTREAM_HIDE_PROGRESS; + l = (xentoollog_logger *)xtl_createlogger_stdiostream(stderr, lvl, lflags); +- si.xch = xc_interface_open(l, 0, 0); ++ xch = si.xch = xc_interface_open(l, 0, 0); + if (!si.xch) +- errx(1, "failed to open control interface"); ++ errx(1, "[%lu] failed to open control interface", (unsigned long)getpid()); + + si.xce = xc_evtchn_open(NULL, 0); + if (si.xce == NULL) +- warnx("failed to open event channel handle"); ++ WPRINTF("failed to open event channel handle"); + else + { + port = xs_suspend_evtchn_port(si.domid); + + if (port < 0) +- warnx("failed to get the suspend evtchn port\n"); ++ WPRINTF("failed to get the suspend evtchn port\n"); + else + { + si.suspend_evtchn = + xc_suspend_evtchn_init(si.xch, si.xce, si.domid, port); + + if (si.suspend_evtchn < 0) +- warnx("suspend event channel initialization failed, " ++ WPRINTF("suspend event channel initialization failed, " + "using slow path"); + } + } diff --git a/xen.migrate.tools-xc_rework_xc_save.cswitch_qemu_logdirty.patch b/xen.migrate.tools-xc_rework_xc_save.cswitch_qemu_logdirty.patch new file mode 100644 index 0000000..84da9dd --- /dev/null +++ b/xen.migrate.tools-xc_rework_xc_save.cswitch_qemu_logdirty.patch @@ -0,0 +1,136 @@ +user: Olaf Hering +date: Wed Mar 06 17:05:10 2013 +0100 +files: tools/xcutils/xc_save.c +description: +tools/xc: rework xc_save.c:switch_qemu_logdirty + +Rework code in switch_qemu_logdirty, fix also memleak. + +Signed-off-by: Olaf Hering + + +diff -r 49b90990442a -r 1ea501d60264 tools/xcutils/xc_save.c +--- a/tools/xcutils/xc_save.c ++++ b/tools/xcutils/xc_save.c +@@ -7,6 +7,7 @@ + * + */ + ++#define _GNU_SOURCE + #include + #include + #include +@@ -109,8 +110,10 @@ static int switch_qemu_logdirty(int domi + { + xc_interface *xch = si.xch; + struct xs_handle *xs; +- char *path, *p, *ret_str, *cmd_str, **watch; ++ char *path, *dir_p, *ret_str, **watch; ++ const char *cmd_str; + unsigned int len; ++ int ret, again; + struct timeval tv; + fd_set fdset; + +@@ -118,65 +121,56 @@ static int switch_qemu_logdirty(int domi + PERROR("Couldn't contact xenstore"); + exit(1); + } +- if (!(path = strdup("/local/domain/0/device-model/"))) { +- PERROR("can't get domain path in store"); ++ ++ ret = asprintf(&path, "/local/domain/0/device-model/%i/logdirty/ret", domid); ++ if (ret < 0) { ++ ERROR("Couldn't construct xenstore path"); + exit(1); + } +- if (!(path = realloc(path, strlen(path) +- + 10 +- + strlen("/logdirty/cmd") + 1))) { +- PERROR("no memory for constructing xenstore path"); +- exit(1); +- } +- snprintf(path + strlen(path), 11, "%i", domid); +- strcat(path, "/logdirty/"); +- p = path + strlen(path); +- ++ /* Pointer to directory */ ++ dir_p = path + ret - 3; + + /* Watch for qemu's return value */ +- strcpy(p, "ret"); +- if (!xs_watch(xs, path, "qemu-logdirty-ret")) +- { +- ERROR("can't set watch in store (%s)\n", path); ++ if (!xs_watch(xs, path, "qemu-logdirty-ret")) { ++ PERROR("can't set watch in store (%s)", path); + exit(1); + } + +- if (!(cmd_str = strdup( enable == 0 ? "disable" : "enable"))) { +- PERROR("can't get logdirty cmd path in store"); ++ cmd_str = enable ? "enable" : "disable"; ++ ++ /* Tell qemu that we want it to start logging dirty pages to Xen */ ++ strcpy(dir_p, "cmd"); ++ if (!xs_write(xs, XBT_NULL, path, cmd_str, strlen(cmd_str))) { ++ PERROR("can't write to store path (%s)", path); + exit(1); + } + +- /* Tell qemu that we want it to start logging dirty page to Xen */ +- strcpy(p, "cmd"); +- if (!xs_write(xs, XBT_NULL, path, cmd_str, strlen(cmd_str))) { +- PERROR("can't write to store path (%s)\n", path); +- exit(1); +- } ++ /* Restore initial path */ ++ strcpy(dir_p, "ret"); ++ /* Wait a while for qemu to signal that it has serviced logdirty command */ ++ do { ++ tv.tv_sec = 5; ++ tv.tv_usec = 0; ++ FD_ZERO(&fdset); ++ FD_SET(xs_fileno(xs), &fdset); ++ errno = 0; + +- /* Wait a while for qemu to signal that it has service logdirty command */ +- read_again: +- tv.tv_sec = 5; +- tv.tv_usec = 0; +- FD_ZERO(&fdset); +- FD_SET(xs_fileno(xs), &fdset); +- +- if ((select(xs_fileno(xs) + 1, &fdset, NULL, NULL, &tv)) != 1) { +- PERROR("timed out waiting for qemu logdirty response.\n"); +- exit(1); +- } +- +- watch = xs_read_watch(xs, &len); +- free(watch); +- +- strcpy(p, "ret"); +- ret_str = xs_read(xs, XBT_NULL, path, &len); +- if (ret_str == NULL || strcmp(ret_str, cmd_str)) ++ if ((select(xs_fileno(xs) + 1, &fdset, NULL, NULL, &tv)) != 1) { ++ PERROR("timed out waiting for qemu logdirty response."); ++ exit(1); ++ } ++ ++ watch = xs_read_watch(xs, &len); ++ free(watch); ++ ++ ret_str = xs_read(xs, XBT_NULL, path, &len); ++ again = ret_str == NULL || strcmp(ret_str, cmd_str); ++ WPRINTF("Got '%s' from logdirty%s.\n", ret_str, again ? ", retrying" : ""); ++ free(ret_str); + /* Watch fired but value is not yet right */ +- goto read_again; ++ } while (again); + + free(path); +- free(cmd_str); +- free(ret_str); + + return 0; + } diff --git a/xen.migrate.tools_add_xm_migrate_--log_progress_option.patch b/xen.migrate.tools_add_xm_migrate_--log_progress_option.patch new file mode 100644 index 0000000..d7a9426 --- /dev/null +++ b/xen.migrate.tools_add_xm_migrate_--log_progress_option.patch @@ -0,0 +1,138 @@ +user: Olaf Hering +date: Wed Mar 06 17:05:15 2013 +0100 +files: tools/libxc/xenguest.h tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/migrate.py tools/xcutils/xc_save.c +description: +tools: add xm migrate --log_progress option + +xc_domain_save does print progress messages. These verbose messages are +disabled per default to avoid flood in xend.log. Sometimes it is helpful +to see progress when migrating large and busy guests. So add a new +option to xm migrate to actually enable the printing of progress +messsages. + +xl migrate is not modified with this change because it does not use the +stdio logger. + +Signed-off-by: Olaf Hering + + +diff -r 29c66a248f5b -r d8ef4a83760f tools/libxc/xenguest.h +--- a/tools/libxc/xenguest.h ++++ b/tools/libxc/xenguest.h +@@ -29,6 +29,7 @@ + #define XCFLAGS_STDVGA (1 << 3) + #define XCFLAGS_CHECKPOINT_COMPRESS (1 << 4) + #define XCFLAGS_DOMSAVE_ABORT_IF_BUSY (1 << 5) ++#define XCFLAGS_PROGRESS (1 << 6) + + #define X86_64_B_SIZE 64 + #define X86_32_B_SIZE 32 +diff -r 29c66a248f5b -r d8ef4a83760f tools/python/xen/xend/XendCheckpoint.py +--- a/tools/python/xen/xend/XendCheckpoint.py ++++ b/tools/python/xen/xend/XendCheckpoint.py +@@ -121,16 +121,19 @@ def save(fd, dominfo, network, live, dst + max_iters = dominfo.info.get('max_iters', "0") + max_factor = dominfo.info.get('max_factor', "0") + abort_if_busy = dominfo.info.get('abort_if_busy', "0") ++ log_save_progress = dominfo.info.get('log_save_progress', "0") + if max_iters == "None": + max_iters = "0" + if max_factor == "None": + max_factor = "0" + if abort_if_busy == "None": + abort_if_busy = "0" ++ if log_save_progress == "None": ++ log_save_progress = "0" + cmd = [xen.util.auxbin.pathTo(XC_SAVE), str(fd), + str(dominfo.getDomid()), + max_iters, max_factor, +- str( int(live) | (int(hvm) << 2) | (int(abort_if_busy) << 5) ) ] ++ str( int(live) | (int(hvm) << 2) | (int(abort_if_busy) << 5) | (int(log_save_progress) << 6) ) ] + log.debug("[xc_save]: %s", string.join(cmd)) + + def saveInputHandler(line, tochild): +diff -r 29c66a248f5b -r d8ef4a83760f tools/python/xen/xend/XendDomain.py +--- a/tools/python/xen/xend/XendDomain.py ++++ b/tools/python/xen/xend/XendDomain.py +@@ -1832,17 +1832,18 @@ class XendDomain: + log.exception(ex) + raise XendError(str(ex)) + +- def domain_migrate_constraints_set(self, domid, max_iters, max_factor, abort_if_busy): ++ def domain_migrate_constraints_set(self, domid, max_iters, max_factor, abort_if_busy, log_save_progress): + """Set the Migrate Constraints of this domain. + @param domid: Domain ID or Name + @param max_iters: Number of iterations before final suspend + @param max_factor: Max amount of memory to transfer before final suspend + @param abort_if_busy: Abort migration instead of doing final suspend ++ @param log_save_progress: Log progress of migrate to xend.log + """ + dominfo = self.domain_lookup_nr(domid) + if not dominfo: + raise XendInvalidDomain(str(domid)) +- dominfo.setMigrateConstraints(max_iters, max_factor, abort_if_busy) ++ dominfo.setMigrateConstraints(max_iters, max_factor, abort_if_busy, log_save_progress) + + def domain_maxmem_set(self, domid, mem): + """Set the memory limit for a domain. +diff -r 29c66a248f5b -r d8ef4a83760f tools/python/xen/xend/XendDomainInfo.py +--- a/tools/python/xen/xend/XendDomainInfo.py ++++ b/tools/python/xen/xend/XendDomainInfo.py +@@ -1459,17 +1459,19 @@ class XendDomainInfo: + pci_conf = self.info['devices'][dev_uuid][1] + return map(pci_dict_to_bdf_str, pci_conf['devs']) + +- def setMigrateConstraints(self, max_iters, max_factor, abort_if_busy): ++ def setMigrateConstraints(self, max_iters, max_factor, abort_if_busy, log_save_progress): + """Set the Migrate Constraints of this domain. + @param max_iters: Number of iterations before final suspend + @param max_factor: Max amount of memory to transfer before final suspend + @param abort_if_busy: Abort migration instead of doing final suspend ++ @param log_save_progress: Log progress of migrate to xend.log + """ + log.debug("Setting migration constraints of domain %s (%s) to '%s' '%s' '%s'.", + self.info['name_label'], str(self.domid), max_iters, max_factor, abort_if_busy) + self.info['max_iters'] = str(max_iters) + self.info['max_factor'] = str(max_factor) + self.info['abort_if_busy'] = str(abort_if_busy) ++ self.info['log_save_progress'] = str(log_save_progress) + + def setMemoryTarget(self, target): + """Set the memory target of this domain. +diff -r 29c66a248f5b -r d8ef4a83760f tools/python/xen/xm/migrate.py +--- a/tools/python/xen/xm/migrate.py ++++ b/tools/python/xen/xm/migrate.py +@@ -67,6 +67,10 @@ gopts.opt('abort_if_busy', short='A', + fn=set_true, default=0, + use="Abort migration instead of doing final suspend.") + ++gopts.opt('log_progress', ++ fn=set_true, default=0, ++ use="Log progress of migration to xend.log") ++ + def help(): + return str(gopts) + +@@ -95,7 +99,8 @@ def main(argv): + server.xend.domain.migrate_constraints_set(dom, + opts.vals.max_iters, + opts.vals.max_factor, +- opts.vals.abort_if_busy) ++ opts.vals.abort_if_busy, ++ opts.vals.log_progress) + server.xend.domain.migrate(dom, dst, opts.vals.live, + opts.vals.port, + opts.vals.node, +diff -r 29c66a248f5b -r d8ef4a83760f tools/xcutils/xc_save.c +--- a/tools/xcutils/xc_save.c ++++ b/tools/xcutils/xc_save.c +@@ -197,7 +197,8 @@ main(int argc, char **argv) + si.suspend_evtchn = -1; + + lvl = si.flags & XCFLAGS_DEBUG ? XTL_DEBUG: XTL_DETAIL; +- lflags = XTL_STDIOSTREAM_SHOW_PID | XTL_STDIOSTREAM_HIDE_PROGRESS; ++ lflags = XTL_STDIOSTREAM_SHOW_PID; ++ lflags |= si.flags & XCFLAGS_PROGRESS ? 0 : XTL_STDIOSTREAM_HIDE_PROGRESS; + l = (xentoollog_logger *)xtl_createlogger_stdiostream(stderr, lvl, lflags); + xch = si.xch = xc_interface_open(l, 0, 0); + if (!si.xch) diff --git a/xen.migrate.tools_set_migration_constraints_from_cmdline.patch b/xen.migrate.tools_set_migration_constraints_from_cmdline.patch new file mode 100644 index 0000000..a437c28 --- /dev/null +++ b/xen.migrate.tools_set_migration_constraints_from_cmdline.patch @@ -0,0 +1,223 @@ +user: Olaf Hering +date: Wed Mar 06 17:05:14 2013 +0100 +files: docs/man/xl.pod.1 tools/libxc/xc_domain_save.c tools/libxc/xenguest.h tools/libxl/Makefile tools/libxl/libxl.c tools/libxl/libxl.h tools/libxl/libxl_dom.c tools/libxl/libxl_internal.h tools/libxl/libxl_save_callout.c tools/libxl/xl_cmdimpl.c tools/libxl/xl_cmdtable.c tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/migrate.py +description: +tools: set migration constraints from cmdline + +Add new options to xm/xl migrate to control the process of migration. +The intention is to optionally abort the migration if it takes too long +to migrate a busy guest due to the high number of dirty pages. Currently +the guest is suspended to transfer the remaining dirty pages. This +transfer can take too long, which can confuse the guest if its suspended +for too long. + +-M Number of iterations before final suspend (default: 30) +--max_iters + +-m Max amount of memory to transfer before final suspend (default: 3*RAM) +--max_factor + +-A Abort migration instead of doing final suspend. +--abort_if_busy + + + +The changes to libxl change the API, handle LIBXL_API_VERSION == 0x040200. + +TODO: + eventually add also --min_remaining (default value 50) in a seperate patch + +v6: + - update the LIBXL_API_VERSION handling for libxl_domain_suspend + change it to an inline function if LIBXL_API_VERSION is defined to 4.2.0 + - rename libxl_save_properties to libxl_domain_suspend_properties + - rename ->xlflags to ->flags within that struct + +v5: + - adjust libxl_domain_suspend prototype, move flags, max_iters, + max_factor into a new, optional struct libxl_save_properties + - rename XCFLAGS_DOMSAVE_NOSUSPEND to XCFLAGS_DOMSAVE_ABORT_IF_BUSY + - rename LIBXL_SUSPEND_NO_FINAL_SUSPEND to LIBXL_SUSPEND_ABORT_IF_BUSY + - rename variables no_suspend to abort_if_busy + - rename option -N/--no_suspend to -A/--abort_if_busy + - update xl.1, extend description of -A option + +v4: + - update default for no_suspend from None to 0 in XendCheckpoint.py:save + - update logoutput in setMigrateConstraints + - change xm migrate defaults from None to 0 + - add new options to xl.1 + - fix syntax error in XendDomain.py:domain_migrate_constraints_set + - fix xm migrate -N option name to match xl migrate + +v3: + - move logic errors in libxl__domain_suspend and fixed help text in + cmd_table to separate patches + - fix syntax error in XendCheckpoint.py + - really pass max_iters and max_factor in libxl__xc_domain_save + - make libxl_domain_suspend_0x040200 declaration globally visible + - bump libxenlight.so SONAME from 2.0 to 2.1 due to changed + libxl_domain_suspend + +v2: + - use LIBXL_API_VERSION and define libxl_domain_suspend_0x040200 + - fix logic error in min_reached check in xc_domain_save + - add longopts + - update --help text + - correct description of migrate --help text + +Signed-off-by: Olaf Hering + + +Index: xen-4.2.1-testing/tools/libxc/xc_domain_save.c +=================================================================== +--- xen-4.2.1-testing.orig/tools/libxc/xc_domain_save.c ++++ xen-4.2.1-testing/tools/libxc/xc_domain_save.c +@@ -813,6 +813,7 @@ int xc_domain_save(xc_interface *xch, in + int rc = 1, frc, i, j, last_iter = 0, iter = 0; + int live = (flags & XCFLAGS_LIVE); + int debug = (flags & XCFLAGS_DEBUG); ++ int abort_if_busy = (flags & XCFLAGS_DOMSAVE_ABORT_IF_BUSY); + int superpages = !!hvm; + int race = 0, sent_last_iter, skip_this_iter = 0; + unsigned int sent_this_iter = 0; +@@ -1525,10 +1526,20 @@ int xc_domain_save(xc_interface *xch, in + + if ( live ) + { ++ int min_reached = sent_this_iter + skip_this_iter < 50; + if ( (iter >= max_iters) || +- (sent_this_iter+skip_this_iter < 50) || ++ min_reached || + (total_sent > dinfo->p2m_size*max_factor) ) + { ++ if ( !min_reached && abort_if_busy ) ++ { ++ ERROR("Live migration aborted, as requested. (guest too busy?)" ++ " total_sent %lu iter %d, max_iters %u max_factor %u", ++ total_sent, iter, max_iters, max_factor); ++ rc = 1; ++ goto out; ++ } ++ + DPRINTF("Start last iteration\n"); + last_iter = 1; + +Index: xen-4.2.1-testing/tools/libxc/xenguest.h +=================================================================== +--- xen-4.2.1-testing.orig/tools/libxc/xenguest.h ++++ xen-4.2.1-testing/tools/libxc/xenguest.h +@@ -28,6 +28,7 @@ + #define XCFLAGS_HVM (1 << 2) + #define XCFLAGS_STDVGA (1 << 3) + #define XCFLAGS_CHECKPOINT_COMPRESS (1 << 4) ++#define XCFLAGS_DOMSAVE_ABORT_IF_BUSY (1 << 5) + + #define X86_64_B_SIZE 64 + #define X86_32_B_SIZE 32 +Index: xen-4.2.1-testing/tools/python/xen/xend/XendCheckpoint.py +=================================================================== +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendCheckpoint.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendCheckpoint.py +@@ -118,9 +118,19 @@ def save(fd, dominfo, network, live, dst + # enabled. Passing "0" simply uses the defaults compiled into + # libxenguest; see the comments and/or code in xc_linux_save() for + # more information. ++ max_iters = dominfo.info.get('max_iters', "0") ++ max_factor = dominfo.info.get('max_factor', "0") ++ abort_if_busy = dominfo.info.get('abort_if_busy', "0") ++ if max_iters == "None": ++ max_iters = "0" ++ if max_factor == "None": ++ max_factor = "0" ++ if abort_if_busy == "None": ++ abort_if_busy = "0" + cmd = [xen.util.auxbin.pathTo(XC_SAVE), str(fd), +- str(dominfo.getDomid()), "0", "0", +- str(int(live) | (int(hvm) << 2)) ] ++ str(dominfo.getDomid()), ++ max_iters, max_factor, ++ str( int(live) | (int(hvm) << 2) | (int(abort_if_busy) << 5) ) ] + log.debug("[xc_save]: %s", string.join(cmd)) + + def saveInputHandler(line, tochild): +Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomain.py +=================================================================== +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomain.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendDomain.py +@@ -1832,6 +1832,18 @@ class XendDomain: + log.exception(ex) + raise XendError(str(ex)) + ++ def domain_migrate_constraints_set(self, domid, max_iters, max_factor, abort_if_busy): ++ """Set the Migrate Constraints of this domain. ++ @param domid: Domain ID or Name ++ @param max_iters: Number of iterations before final suspend ++ @param max_factor: Max amount of memory to transfer before final suspend ++ @param abort_if_busy: Abort migration instead of doing final suspend ++ """ ++ dominfo = self.domain_lookup_nr(domid) ++ if not dominfo: ++ raise XendInvalidDomain(str(domid)) ++ dominfo.setMigrateConstraints(max_iters, max_factor, abort_if_busy) ++ + def domain_maxmem_set(self, domid, mem): + """Set the memory limit for a domain. + +Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +=================================================================== +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -1459,6 +1459,18 @@ class XendDomainInfo: + pci_conf = self.info['devices'][dev_uuid][1] + return map(pci_dict_to_bdf_str, pci_conf['devs']) + ++ def setMigrateConstraints(self, max_iters, max_factor, abort_if_busy): ++ """Set the Migrate Constraints of this domain. ++ @param max_iters: Number of iterations before final suspend ++ @param max_factor: Max amount of memory to transfer before final suspend ++ @param abort_if_busy: Abort migration instead of doing final suspend ++ """ ++ log.debug("Setting migration constraints of domain %s (%s) to '%s' '%s' '%s'.", ++ self.info['name_label'], str(self.domid), max_iters, max_factor, abort_if_busy) ++ self.info['max_iters'] = str(max_iters) ++ self.info['max_factor'] = str(max_factor) ++ self.info['abort_if_busy'] = str(abort_if_busy) ++ + def setMemoryTarget(self, target): + """Set the memory target of this domain. + @param target: In MiB. +Index: xen-4.2.1-testing/tools/python/xen/xm/migrate.py +=================================================================== +--- xen-4.2.1-testing.orig/tools/python/xen/xm/migrate.py ++++ xen-4.2.1-testing/tools/python/xen/xm/migrate.py +@@ -55,6 +55,18 @@ gopts.opt('change_home_server', short='c + fn=set_true, default=0, + use="Change home server for managed domains.") + ++gopts.opt('max_iters', short='M', val='max_iters', ++ fn=set_int, default=0, ++ use="Number of iterations before final suspend (default: 30).") ++ ++gopts.opt('max_factor', short='m', val='max_factor', ++ fn=set_int, default=0, ++ use="Max amount of memory to transfer before final suspend (default: 3*RAM).") ++ ++gopts.opt('abort_if_busy', short='A', ++ fn=set_true, default=0, ++ use="Abort migration instead of doing final suspend.") ++ + def help(): + return str(gopts) + +@@ -80,6 +92,10 @@ def main(argv): + server.xenapi.VM.migrate(vm_ref, dst, bool(opts.vals.live), + other_config) + else: ++ server.xend.domain.migrate_constraints_set(dom, ++ opts.vals.max_iters, ++ opts.vals.max_factor, ++ opts.vals.abort_if_busy) + server.xend.domain.migrate(dom, dst, opts.vals.live, + opts.vals.port, + opts.vals.node, diff --git a/xen.spec b/xen.spec index bc2357f..8a6a810 100644 --- a/xen.spec +++ b/xen.spec @@ -15,6 +15,7 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + Name: xen ExclusiveArch: %ix86 x86_64 %define xvers 4.2 @@ -114,7 +115,7 @@ BuildRequires: kernel-syms BuildRequires: module-init-tools BuildRequires: xorg-x11 %endif -Version: 4.2.1_06 +Version: 4.2.1_11 Release: 0 PreReq: %insserv_prereq %fillup_prereq Summary: Xen Virtualization: Hypervisor (aka VMM aka Microkernel) @@ -250,7 +251,7 @@ Patch26532: 26532-AMD-IOMMU-phantom-MSI.patch Patch26536: 26536-xenoprof-div-by-0.patch Patch26547: 26547-tools-xc_fix_logic_error_in_stdiostream_progress.patch Patch26548: 26548-tools-xc_handle_tty_output_differently_in_stdiostream_progress.patch -Patch26549: 26549-tools-xc_turn_XCFLAGS_*_into_shifts.patch +Patch26549: 26549-tools-xc_turn_XCFLAGS__into_shifts.patch Patch26550: 26550-tools-xc_restore_logging_in_xc_save.patch Patch26551: 26551-tools-xc_log_pid_in_xc_save-xc_restore_output.patch Patch26554: 26554-hvm-firmware-passthrough.patch @@ -259,8 +260,29 @@ Patch26556: 26556-hvm-firmware-passthrough.patch Patch26576: 26576-x86-APICV-migration.patch Patch26577: 26577-x86-APICV-x2APIC.patch Patch26578: 26578-AMD-IOMMU-replace-BUG_ON.patch +Patch26585: 26585-x86-mm-Take-the-p2m-lock-even-in-shadow-mode.patch +Patch26595: 26595-x86-nhvm-properly-clean-up-after-failure-to-set-up-all-vCPU-s.patch +Patch26601: 26601-honor-ACPI-v4-FADT-flags.patch +Patch26656: 26656-x86-fix-null-pointer-dereference-in-intel_get_extended_msrs.patch +Patch26659: 26659-AMD-IOMMU-erratum-746-workaround.patch +Patch26660: 26660-x86-fix-CMCI-injection.patch +Patch26672: 26672-vmx-fix-handling-of-NMI-VMEXIT.patch +Patch26673: 26673-Avoid-stale-pointer-when-moving-domain-to-another-cpupool.patch +Patch26675: 26675-tools-xentoollog_update_tty_detection_in_stdiostream_progress.patch +Patch26676: 26676-fix-compat-memory-exchange-op-splitting.patch +Patch26677: 26677-x86-make-certain-memory-sub-ops-return-valid-values.patch +Patch26678: 26678-SEDF-avoid-gathering-vCPU-s-on-pCPU0.patch +Patch26679: 26679-x86-defer-processing-events-on-the-NMI-exit-path.patch +Patch26683: 26683-credit1-Use-atomic-bit-operations-for-the-flags-structure.patch +Patch26686: 26686-xentrace-fix-off-by-one-in-calculate_tbuf_size.patch +Patch26689: 26689-fix-domain-unlocking-in-some-xsm-error-paths.patch Patch34: CVE-2013-0151-xsa34.patch Patch41: CVE-2012-6075-xsa41.patch +Patch88: xen.migrate.tools-xc_print_messages_from_xc_save_with_xc_report.patch +Patch89: xen.migrate.tools-xc_document_printf_calls_in_xc_restore.patch +Patch90: xen.migrate.tools-xc_rework_xc_save.cswitch_qemu_logdirty.patch +Patch91: xen.migrate.tools_set_migration_constraints_from_cmdline.patch +Patch92: xen.migrate.tools_add_xm_migrate_--log_progress_option.patch # Upstream qemu patches Patch100: VNC-Support-for-ExtendedKeyEvent-client-message.patch # Our patches @@ -357,6 +379,7 @@ Patch461: xen-glibc217.patch Patch462: xen-migration-bridge-check.patch Patch463: pygrub-netware-xnloader.patch Patch464: xen-managed-pci-device.patch +Patch465: xend-hvm-firmware-passthrough.patch # Jim's domain lock patch Patch480: xend-domain-lock.patch Patch481: xend-domain-lock-sfex.patch @@ -812,7 +835,28 @@ tar xfj %{SOURCE6} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools %patch26576 -p1 %patch26577 -p1 %patch26578 -p1 +%patch26585 -p1 +%patch26595 -p1 +%patch26601 -p1 +%patch26656 -p1 +%patch26659 -p1 +%patch26660 -p1 +%patch26672 -p1 +%patch26673 -p1 +%patch26675 -p1 +%patch26676 -p1 +%patch26677 -p1 +%patch26678 -p1 +%patch26679 -p1 +%patch26683 -p1 +%patch26686 -p1 +%patch26689 -p1 %patch41 -p1 +%patch88 -p1 +%patch89 -p1 +%patch90 -p1 +%patch91 -p1 +%patch92 -p1 # Qemu %patch100 -p1 # Our patches @@ -906,6 +950,7 @@ tar xfj %{SOURCE6} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools %patch462 -p1 %patch463 -p1 %patch464 -p1 +%patch465 -p1 %patch480 -p1 %patch481 -p1 %patch500 -p1 @@ -982,6 +1027,7 @@ export EXTRA_CFLAGS_XEN_TOOLS="$RPM_OPT_FLAGS" export EXTRA_CFLAGS_QEMU_TRADITIONAL="$RPM_OPT_FLAGS" export EXTRA_CFLAGS_QEMU_XEN="$RPM_OPT_FLAGS" %if %{?with_dom0_support}0 +export BRP_PESIGN_FILES="*.ko *.efi /lib/firmware" # EFI %ifarch x86_64 make -C xen install \ @@ -1045,7 +1091,6 @@ make -C tools/misc/serial-split install \ %if %{?with_kmp}0 export INSTALL_MOD_PATH=$RPM_BUILD_ROOT export INSTALL_MOD_DIR=updates -#export BRP_PESIGN_FILES="*.ko /lib/firmware" mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d for flavor in %flavors_to_build; do make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \ diff --git a/xenalyze.hg.tar.bz2 b/xenalyze.hg.tar.bz2 index 46732d4..2dd1142 100644 --- a/xenalyze.hg.tar.bz2 +++ b/xenalyze.hg.tar.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:006b68099906f6f0846e8a7d7ded8bc8f3abfbcc1c4daac013a4eaa9aefb344f -size 124265 +oid sha256:36aabe13da4b7ca0e0f9b61fa1442823e437585ef56b604ab077af20bb93ef67 +size 126674 diff --git a/xenapi-console-protocol.patch b/xenapi-console-protocol.patch index 341827b..a427b44 100644 --- a/xenapi-console-protocol.patch +++ b/xenapi-console-protocol.patch @@ -1,8 +1,8 @@ -Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -3940,6 +3940,14 @@ class XendDomainInfo: +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -3954,6 +3954,14 @@ class XendDomainInfo: if not config.has_key('backend'): config['backend'] = "00000000-0000-0000-0000-000000000000" diff --git a/xend-console-port-restore.patch b/xend-console-port-restore.patch index 7f371a3..04f954d 100644 --- a/xend-console-port-restore.patch +++ b/xend-console-port-restore.patch @@ -3,11 +3,11 @@ xenstore. See bnc#706574 From: Chunyan Liu -Index: xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendCheckpoint.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendCheckpoint.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py -@@ -329,8 +329,7 @@ def restore(xd, fd, dominfo = None, paus +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendCheckpoint.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendCheckpoint.py +@@ -342,8 +342,7 @@ def restore(xd, fd, dominfo = None, paus restore_image.setCpuid() # xc_restore will wait for source to close connection @@ -17,11 +17,11 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py # # We shouldn't hold the domains_lock over a waitForDevices -Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -3062,7 +3062,7 @@ class XendDomainInfo: +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -3076,7 +3076,7 @@ class XendDomainInfo: # TODO: recategorise - called from XendCheckpoint # @@ -30,7 +30,7 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py log.debug("XendDomainInfo.completeRestore") -@@ -3073,6 +3073,7 @@ class XendDomainInfo: +@@ -3087,6 +3087,7 @@ class XendDomainInfo: self.image = image.create(self, self.info) if self.image: self.image.createDeviceModel(True) diff --git a/xend-core-dump-loc.diff b/xend-core-dump-loc.diff index 6aa1939..0863a09 100644 --- a/xend-core-dump-loc.diff +++ b/xend-core-dump-loc.diff @@ -1,8 +1,8 @@ -Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -2304,7 +2304,7 @@ class XendDomainInfo: +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -2318,7 +2318,7 @@ class XendDomainInfo: # To prohibit directory traversal based_name = os.path.basename(self.info['name_label']) diff --git a/xend-domain-lock-sfex.patch b/xend-domain-lock-sfex.patch index 1e30175..6556aad 100644 --- a/xend-domain-lock-sfex.patch +++ b/xend-domain-lock-sfex.patch @@ -223,7 +223,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -4554,8 +4554,14 @@ class XendDomainInfo: +@@ -4570,8 +4570,14 @@ class XendDomainInfo: # Return name of host contained in lock file. def get_lock_host(self, path): @@ -240,7 +240,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py hostname = "unknown" try: -@@ -4577,6 +4583,16 @@ class XendDomainInfo: +@@ -4593,6 +4599,16 @@ class XendDomainInfo: path = xoptions.get_xend_domain_lock_path() path = os.path.join(path, self.get_uuid()) @@ -257,7 +257,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py try: if not os.path.exists(path): mkdir.parents(path, stat.S_IRWXU) -@@ -4584,12 +4600,7 @@ class XendDomainInfo: +@@ -4600,12 +4616,7 @@ class XendDomainInfo: log.exception("%s could not be created." % path) raise XendError("%s could not be created." % path) @@ -271,7 +271,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py if status != 0: log.debug("Failed to aqcuire lock: status = %d" % status) raise XendError("The VM is locked and appears to be running on host %s." % self.get_lock_host(path)) -@@ -4606,12 +4617,18 @@ class XendDomainInfo: +@@ -4622,12 +4633,18 @@ class XendDomainInfo: path = xoptions.get_xend_domain_lock_path() path = os.path.join(path, self.get_uuid()) diff --git a/xend-domain-lock.patch b/xend-domain-lock.patch index 1ad5126..8ad8b77 100644 --- a/xend-domain-lock.patch +++ b/xend-domain-lock.patch @@ -17,8 +17,8 @@ Index: xen-4.2.1-testing/tools/examples/xend-config.sxp #(pci-passthrough-strict-check yes) +# Domain Locking -+# In a multihost environment, domain locking prevents simultaneously -+# running a domain on more than one host. ++# In a multihost environment, domain locking provides a simple mechanism that ++# prevents simultaneously running a domain on more than one host. +# +# If enabled, xend will execute a external lock utility (defined below) +# on each domain start and stop event. Disabled by default. Set to yes @@ -71,7 +71,7 @@ Index: xen-4.2.1-testing/tools/examples/xend-config.sxp +# when HostA, running vm1, crashes. HostB could not acquire a +# lock for vm1 since the NFS server holds an exclusive lock +# acquired by HostA. The lock file must be manually removed -+# before starting vm1 on HostA. ++# before starting vm1 on HostB. +# +#(xend-domain-lock-utility domain-lock) + @@ -228,16 +228,29 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendCheckpoint.py =================================================================== --- xen-4.2.1-testing.orig/tools/python/xen/xend/XendCheckpoint.py +++ xen-4.2.1-testing/tools/python/xen/xend/XendCheckpoint.py -@@ -130,6 +130,8 @@ def save(fd, dominfo, network, live, dst - dominfo.shutdown('suspend') - dominfo.waitForSuspend() - if line in ('suspend', 'suspended'): -+ if checkpoint == False: -+ dominfo.release_running_lock(domain_name) - dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2, - domain_name) - log.info("Domain %d suspended.", dominfo.getDomid()) -@@ -353,6 +355,7 @@ def restore(xd, fd, dominfo = None, paus +@@ -136,6 +136,11 @@ def save(fd, dominfo, network, live, dst + str( int(live) | (int(hvm) << 2) | (int(abort_if_busy) << 5) | (int(log_save_progress) << 6) ) ] + log.debug("[xc_save]: %s", string.join(cmd)) + ++ # It is safe to release the domain lock at this point if not ++ # checkpointing ++ if checkpoint == False: ++ dominfo.release_running_lock(domain_name) ++ + def saveInputHandler(line, tochild): + log.debug("In saveInputHandler %s", line) + if line == "suspend": +@@ -200,6 +205,9 @@ def save(fd, dominfo, network, live, dst + log.exception("Save failed on domain %s (%s) - resuming.", domain_name, + dominfo.getDomid()) + dominfo.resumeDomain() ++ # Reacquire the domain lock ++ if checkpoint == False: ++ dominfo.acquire_running_lock() + + try: + dominfo.setName(domain_name) +@@ -366,6 +374,7 @@ def restore(xd, fd, dominfo = None, paus if not paused: dominfo.unpause() @@ -257,7 +270,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py XendTask.log_progress(0, 30, self._constructDomain) XendTask.log_progress(31, 60, self._initDomain) -@@ -3037,6 +3038,11 @@ class XendDomainInfo: +@@ -3053,6 +3054,11 @@ class XendDomainInfo: self._stateSet(DOM_STATE_HALTED) self.domid = None # Do not push into _stateSet()! @@ -269,7 +282,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py finally: self.refresh_shutdown_lock.release() -@@ -4546,6 +4552,74 @@ class XendDomainInfo: +@@ -4562,6 +4568,74 @@ class XendDomainInfo: def has_device(self, dev_class, dev_uuid): return (dev_uuid in self.info['%s_refs' % dev_class.lower()]) diff --git a/xend-hvm-firmware-passthrough.patch b/xend-hvm-firmware-passthrough.patch new file mode 100644 index 0000000..30680b7 --- /dev/null +++ b/xend-hvm-firmware-passthrough.patch @@ -0,0 +1,277 @@ +fate#313584: pass bios information to XEN HVM guest + +Index: xen-4.2.1-testing/tools/python/xen/xm/create.py +=================================================================== +--- xen-4.2.1-testing.orig/tools/python/xen/xm/create.py ++++ xen-4.2.1-testing/tools/python/xen/xm/create.py +@@ -491,6 +491,14 @@ gopts.var('nfs_root', val="PATH", + fn=set_value, default=None, + use="Set the path of the root NFS directory.") + ++gopts.var('smbios_firmware', val='FILE', ++ fn=set_value, default=None, ++ use="Path to a file that contains extra SMBIOS firmware structures.") ++ ++gopts.var('acpi_firmware', val='FILE', ++ fn=set_value, default=None, ++ use="Path to a file that contains extra ACPI firmware tables.") ++ + gopts.var('device_model', val='FILE', + fn=set_value, default=None, + use="Path to device model program.") +@@ -1097,6 +1105,7 @@ def configure_hvm(config_image, vals): + 'boot', + 'cpuid', 'cpuid_check', + 'device_model', 'display', ++ 'smbios_firmware', 'acpi_firmware', + 'fda', 'fdb', + 'gfx_passthru', 'guest_os_type', + 'hap', 'hpet', +Index: xen-4.2.1-testing/tools/python/xen/xm/xenapi_create.py +=================================================================== +--- xen-4.2.1-testing.orig/tools/python/xen/xm/xenapi_create.py ++++ xen-4.2.1-testing/tools/python/xen/xm/xenapi_create.py +@@ -1086,6 +1086,8 @@ class sxp2xml: + 'apic', + 'boot', + 'device_model', ++ 'smbios_firmware', ++ 'acpi_firmware', + 'loader', + 'fda', + 'fdb', +Index: xen-4.2.1-testing/tools/python/xen/xend/image.py +=================================================================== +--- xen-4.2.1-testing.orig/tools/python/xen/xend/image.py ++++ xen-4.2.1-testing/tools/python/xen/xend/image.py +@@ -17,7 +17,7 @@ + #============================================================================ + + +-import os, os.path, string ++import os, os.path, string, struct, stat + import re + import math + import time +@@ -123,6 +123,8 @@ class ImageHandler: + + self.device_model = vmConfig['platform'].get('device_model') + ++ self.smbios_firmware =(str(vmConfig['platform'].get('smbios_firmware'))) ++ self.acpi_firmware =(str(vmConfig['platform'].get('acpi_firmware'))) + self.display = vmConfig['platform'].get('display') + self.xauthority = vmConfig['platform'].get('xauthority') + self.vncconsole = int(vmConfig['platform'].get('vncconsole', 0)) +@@ -945,6 +947,38 @@ class HVMImageHandler(ImageHandler): + self.vm.getDomid() ]) + return args + ++ def _readFirmwareFile(self, filename): ++ # Sanity check ++ if filename is None or filename.strip() == "": ++ size = struct.pack('i', int(0)) ++ return size + "" ++ ++ log.debug("Reading firmware file %s", filename) ++ # Open ++ try: ++ fd = os.open(filename, os.O_RDONLY) ++ except Exception, e: ++ raise VmError('Unable to open firmware file %s' % filename) ++ ++ # Validate file size ++ statinfo = os.fstat(fd) ++ if statinfo.st_size == 0 or statinfo.st_size > sys.maxint: ++ os.close(fd) ++ raise VmError('Firmware file %s is an invalid size' % filename) ++ if not stat.S_ISREG(statinfo.st_mode): ++ os.close(fd) ++ raise VmError('Firmware file %s is an invalid file type' % filename) ++ size = struct.pack('i', statinfo.st_size) ++ ++ # Read entire file ++ try: ++ buf = os.read(fd, statinfo.st_size) ++ except Exception, e: ++ os.close(fd) ++ raise VmError('Failed reading firmware file %s' % filename) ++ os.close(fd) ++ return size+buf ++ + def buildDomain(self): + store_evtchn = self.vm.getStorePort() + +@@ -960,6 +994,8 @@ class HVMImageHandler(ImageHandler): + log.debug("vcpu_avail = %li", self.vm.getVCpuAvail()) + log.debug("acpi = %d", self.acpi) + log.debug("apic = %d", self.apic) ++ log.debug("smbios_firmware= %s", self.smbios_firmware) ++ log.debug("acpi_firmware = %s", self.acpi_firmware) + + rc = xc.hvm_build(domid = self.vm.getDomid(), + image = self.loader, +@@ -968,7 +1004,9 @@ class HVMImageHandler(ImageHandler): + vcpus = self.vm.getVCpuCount(), + vcpu_avail = self.vm.getVCpuAvail(), + acpi = self.acpi, +- apic = self.apic) ++ apic = self.apic, ++ smbios_firmware= self._readFirmwareFile(self.smbios_firmware), ++ acpi_firmware = self._readFirmwareFile(self.acpi_firmware)) + rc['notes'] = { 'SUSPEND_CANCEL': 1 } + + rc['store_mfn'] = xc.hvm_get_param(self.vm.getDomid(), +Index: xen-4.2.1-testing/tools/python/xen/xend/XendConfig.py +=================================================================== +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendConfig.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendConfig.py +@@ -147,6 +147,8 @@ XENAPI_PLATFORM_CFG_TYPES = { + 'apic': int, + 'boot': str, + 'device_model': str, ++ 'smbios_firmware': str, ++ 'acpi_firmware': str, + 'loader': str, + 'display' : str, + 'fda': str, +@@ -515,6 +517,10 @@ class XendConfig(dict): + self['platform']['nomigrate'] = 0 + + if self.is_hvm(): ++ if 'smbios_firmware' not in self['platform']: ++ self['platform']['smbios_firmware'] = "" ++ if 'acpi_firmware' not in self['platform']: ++ self['platform']['acpi_firmware'] = "" + if 'timer_mode' not in self['platform']: + self['platform']['timer_mode'] = 1 + if 'viridian' not in self['platform']: +Index: xen-4.2.1-testing/tools/python/xen/lowlevel/xc/xc.c +=================================================================== +--- xen-4.2.1-testing.orig/tools/python/xen/lowlevel/xc/xc.c ++++ xen-4.2.1-testing/tools/python/xen/lowlevel/xc/xc.c +@@ -942,18 +942,23 @@ static PyObject *pyxc_hvm_build(XcObject + struct hvm_info_table *va_hvm; + uint8_t *va_map, sum; + #endif +- int i; +- char *image; ++ int i, datalen; ++ char *image, *smbios_str, *acpi_str; + int memsize, target=-1, vcpus = 1, acpi = 0, apic = 1; ++ PyObject *acpi_firmware = NULL; ++ PyObject *smbios_firmware = NULL; + PyObject *vcpu_avail_handle = NULL; + uint8_t vcpu_avail[(HVM_MAX_VCPUS + 7)/8]; ++ struct xc_hvm_build_args hvm_args = {}; + + static char *kwd_list[] = { "domid", + "memsize", "image", "target", "vcpus", +- "vcpu_avail", "acpi", "apic", NULL }; +- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|iiOii", kwd_list, ++ "vcpu_avail", "acpi", "apic", ++ "smbios_firmware", "acpi_firmware", NULL }; ++ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|iiOiiOO", kwd_list, + &dom, &memsize, &image, &target, &vcpus, +- &vcpu_avail_handle, &acpi, &apic) ) ++ &vcpu_avail_handle, &acpi, ++ &apic, &smbios_firmware, &acpi_firmware) ) + return NULL; + + memset(vcpu_avail, 0, sizeof(vcpu_avail)); +@@ -984,8 +989,38 @@ static PyObject *pyxc_hvm_build(XcObject + if ( target == -1 ) + target = memsize; + +- if ( xc_hvm_build_target_mem(self->xc_handle, dom, memsize, +- target, image) != 0 ) ++ memset(&hvm_args, 0, sizeof(struct xc_hvm_build_args)); ++ hvm_args.mem_size = (uint64_t)memsize << 20; ++ hvm_args.mem_target = (uint64_t)target << 20; ++ hvm_args.image_file_name = image; ++ ++ if ( PyString_Check(smbios_firmware ) ) ++ { ++ smbios_str = PyString_AsString(smbios_firmware); ++ if ( smbios_str ) ++ { ++ datalen = *(int *)smbios_str; ++ if ( datalen ) { ++ hvm_args.smbios_module.data = &((uint8_t *)smbios_str)[4]; ++ hvm_args.smbios_module.length = (uint32_t)datalen; ++ } ++ } ++ } ++ ++ if ( PyString_Check(acpi_firmware ) ) ++ { ++ acpi_str = PyString_AsString(acpi_firmware); ++ if (acpi_str) ++ { ++ datalen = *(int *)acpi_str; ++ if ( datalen ) { ++ hvm_args.acpi_module.data = &((uint8_t *)acpi_str)[4]; ++ hvm_args.acpi_module.length = (uint32_t)datalen; ++ } ++ } ++ } ++ ++ if ( xc_hvm_build(self->xc_handle, dom, &hvm_args) != 0 ) + return pyxc_error_to_exception(self->xc_handle); + + #if !defined(__ia64__) +Index: xen-4.2.1-testing/docs/man/xmdomain.cfg.pod.5 +=================================================================== +--- xen-4.2.1-testing.orig/docs/man/xmdomain.cfg.pod.5 ++++ xen-4.2.1-testing/docs/man/xmdomain.cfg.pod.5 +@@ -243,6 +243,25 @@ this the xen kernel must be compiled wit + + This defaults to 1, meaning running the domain as a UP. + ++=item B ++ ++Specify a path to a file that contains extra ACPI firmware tables to pass in to ++a guest. The file can contain several tables in their binary AML form ++concatenated together. Each table self describes its length so no additional ++information is needed. These tables will be added to the ACPI table set in the ++guest. Note that existing tables cannot be overridden by this feature. For ++example this cannot be used to override tables like DSDT, FADT, etc. ++ ++=item B ++ ++Specify a path to a file that contains extra SMBIOS firmware structures to pass ++in to a guest. The file can contain a set DMTF predefined structures which will ++override the internal defaults. Not all predefined structures can be overridden, ++only the following types: 0, 1, 2, 3, 11, 22, 39. The file can also contain any ++number of vendor defined SMBIOS structures (type 128 - 255). Since SMBIOS ++structures do not present their overall size, each entry in the file must be ++preceded by a 32b integer indicating the size of the next structure. ++ + =back + + =head1 DOMAIN SHUTDOWN OPTIONS +Index: xen-4.2.1-testing/tools/python/README.sxpcfg +=================================================================== +--- xen-4.2.1-testing.orig/tools/python/README.sxpcfg ++++ xen-4.2.1-testing/tools/python/README.sxpcfg +@@ -51,6 +51,8 @@ image + - vncunused + (HVM) + - device_model ++ - smbios_firmware ++ - acpi_firmware + - display + - xauthority + - vncconsole +Index: xen-4.2.1-testing/tools/python/README.XendConfig +=================================================================== +--- xen-4.2.1-testing.orig/tools/python/README.XendConfig ++++ xen-4.2.1-testing/tools/python/README.XendConfig +@@ -120,6 +120,8 @@ otherConfig + image.vncdisplay + image.vncunused + image.hvm.device_model ++ image.hvm.smbios_firmware ++ image.hvm.apci_firmware + image.hvm.display + image.hvm.xauthority + image.hvm.vncconsole diff --git a/xend-migration-domname-fix.patch b/xend-migration-domname-fix.patch index 7941dfd..3a1c706 100644 --- a/xend-migration-domname-fix.patch +++ b/xend-migration-domname-fix.patch @@ -4,11 +4,11 @@ domname from xenstore (like 'virsh list') could get correct value. destroyed but there is still VM entry in xenstore. Signed-off-by: Chunyan Liu -Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -1947,6 +1947,8 @@ class XendDomainInfo: +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -1961,6 +1961,8 @@ class XendDomainInfo: self.info['name_label'] = name if to_store: self.storeVm("name", name) @@ -17,11 +17,11 @@ Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py def getName(self): return self.info['name_label'] -Index: xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendCheckpoint.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendCheckpoint.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendCheckpoint.py -@@ -172,7 +172,10 @@ def save(fd, dominfo, network, live, dst +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendCheckpoint.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendCheckpoint.py +@@ -185,7 +185,10 @@ def save(fd, dominfo, network, live, dst dominfo.destroy() dominfo.testDeviceComplete() try: diff --git a/xend-vcpu-affinity-fix.patch b/xend-vcpu-affinity-fix.patch index 4c28e92..7d63867 100644 --- a/xend-vcpu-affinity-fix.patch +++ b/xend-vcpu-affinity-fix.patch @@ -1,8 +1,8 @@ -Index: xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.2.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.2.0-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -2785,7 +2785,10 @@ class XendDomainInfo: +--- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -2799,7 +2799,10 @@ class XendDomainInfo: from xen.xend import XendDomain doms = XendDomain.instance().list('all') for dom in filter (lambda d: d.domid != self.domid, doms): diff --git a/xenpaging.autostart.patch b/xenpaging.autostart.patch index 3c236f7..da1d75a 100644 --- a/xenpaging.autostart.patch +++ b/xenpaging.autostart.patch @@ -76,9 +76,9 @@ Index: xen-4.2.1-testing/tools/python/README.XendConfig + image.hvm.actmem + image.hvm.xenpaging_file + image.hvm.xenpaging_extra + image.hvm.smbios_firmware + image.hvm.apci_firmware image.hvm.display - image.hvm.xauthority - image.hvm.vncconsole Index: xen-4.2.1-testing/tools/python/README.sxpcfg =================================================================== --- xen-4.2.1-testing.orig/tools/python/README.sxpcfg @@ -90,9 +90,9 @@ Index: xen-4.2.1-testing/tools/python/README.sxpcfg + - actmem + - xenpaging_file + - xenpaging_extra + - smbios_firmware + - acpi_firmware - display - - xauthority - - vncconsole Index: xen-4.2.1-testing/tools/python/xen/xend/XendConfig.py =================================================================== --- xen-4.2.1-testing.orig/tools/python/xen/xend/XendConfig.py @@ -104,10 +104,10 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendConfig.py + 'actmem': str, + 'xenpaging_file': str, + 'xenpaging_extra': str, + 'smbios_firmware': str, + 'acpi_firmware': str, 'loader': str, - 'display' : str, - 'fda': str, -@@ -516,6 +519,12 @@ class XendConfig(dict): +@@ -518,6 +521,12 @@ class XendConfig(dict): self['platform']['nomigrate'] = 0 if self.is_hvm(): @@ -117,16 +117,16 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendConfig.py + self['platform']['xenpaging_file'] = "" + if 'xenpaging_extra' not in self['platform']: + self['platform']['xenpaging_extra'] = [] - if 'timer_mode' not in self['platform']: - self['platform']['timer_mode'] = 1 - if 'extid' in self['platform'] and int(self['platform']['extid']) == 1: + if 'smbios_firmware' not in self['platform']: + self['platform']['smbios_firmware'] = "" + if 'acpi_firmware' not in self['platform']: Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomain.py =================================================================== --- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomain.py +++ xen-4.2.1-testing/tools/python/xen/xend/XendDomain.py -@@ -1835,6 +1835,21 @@ class XendDomain: - log.exception(ex) - raise XendError(str(ex)) +@@ -1848,6 +1848,21 @@ class XendDomain: + raise XendInvalidDomain(str(domid)) + dominfo.setMigrateConstraints(max_iters, max_factor, abort_if_busy, log_save_progress) + def domain_swaptarget_set(self, domid, mem): + """Set the memory limit for a domain. @@ -150,7 +150,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-4.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -1532,6 +1532,17 @@ class XendDomainInfo: +@@ -1548,6 +1548,17 @@ class XendDomainInfo: break xen.xend.XendDomain.instance().managed_config_save(self) @@ -168,7 +168,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py def setMemoryTarget(self, target): """Set the memory target of this domain. @param target: In MiB. -@@ -2322,6 +2333,8 @@ class XendDomainInfo: +@@ -2338,6 +2349,8 @@ class XendDomainInfo: self.info['name_label'], self.domid, self.info['uuid'], new_name, new_uuid) self._unwatchVm() @@ -177,7 +177,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py self._releaseDevices() # Remove existing vm node in xenstore self._removeVm() -@@ -3001,6 +3014,9 @@ class XendDomainInfo: +@@ -3017,6 +3030,9 @@ class XendDomainInfo: self._createDevices() @@ -187,7 +187,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py self.image.cleanupTmpImages() self.info['start_time'] = time.time() -@@ -3025,6 +3041,8 @@ class XendDomainInfo: +@@ -3041,6 +3057,8 @@ class XendDomainInfo: self.refresh_shutdown_lock.acquire() try: self.unwatchShutdown() @@ -196,7 +196,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py self._releaseDevices() bootloader_tidy(self) -@@ -3109,6 +3127,7 @@ class XendDomainInfo: +@@ -3125,6 +3143,7 @@ class XendDomainInfo: self.image = image.create(self, self.info) if self.image: self.image.createDeviceModel(True) @@ -204,7 +204,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py self.console_port = console_port self._storeDomDetails() self._registerWatches() -@@ -3251,6 +3270,8 @@ class XendDomainInfo: +@@ -3267,6 +3286,8 @@ class XendDomainInfo: # could also fetch a parsed note from xenstore fast = self.info.get_notes().get('SUSPEND_CANCEL') and 1 or 0 if not fast: @@ -213,7 +213,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/XendDomainInfo.py self._releaseDevices() self.testDeviceComplete() self.testvifsComplete() -@@ -3266,6 +3287,8 @@ class XendDomainInfo: +@@ -3282,6 +3303,8 @@ class XendDomainInfo: self._storeDomDetails() self._createDevices() @@ -235,9 +235,9 @@ Index: xen-4.2.1-testing/tools/python/xen/xend/image.py + self.xenpaging_extra = vmConfig['platform'].get('xenpaging_extra') + self.xenpaging_pid = None - self.display = vmConfig['platform'].get('display') - self.xauthority = vmConfig['platform'].get('xauthority') -@@ -392,6 +396,87 @@ class ImageHandler: + self.smbios_firmware =(str(vmConfig['platform'].get('smbios_firmware'))) + self.acpi_firmware =(str(vmConfig['platform'].get('acpi_firmware'))) +@@ -394,6 +398,87 @@ class ImageHandler: sentinel_fifos_inuse[sentinel_path_fifo] = 1 self.sentinel_path_fifo = sentinel_path_fifo @@ -329,9 +329,9 @@ Index: xen-4.2.1-testing/tools/python/xen/xm/create.py =================================================================== --- xen-4.2.1-testing.orig/tools/python/xen/xm/create.py +++ xen-4.2.1-testing/tools/python/xen/xm/create.py -@@ -495,6 +495,18 @@ gopts.var('nfs_root', val="PATH", +@@ -503,6 +503,18 @@ gopts.var('acpi_firmware', val='FILE', fn=set_value, default=None, - use="Set the path of the root NFS directory.") + use="Path to a file that contains extra ACPI firmware tables.") +gopts.var('actmem', val='NUM', + fn=set_value, default='0', @@ -348,7 +348,7 @@ Index: xen-4.2.1-testing/tools/python/xen/xm/create.py gopts.var('device_model', val='FILE', fn=set_value, default=None, use="Path to device model program.") -@@ -1100,6 +1112,9 @@ def configure_hvm(config_image, vals): +@@ -1108,6 +1120,9 @@ def configure_hvm(config_image, vals): args = [ 'acpi', 'apic', 'boot', 'cpuid', 'cpuid_check', @@ -356,8 +356,8 @@ Index: xen-4.2.1-testing/tools/python/xen/xm/create.py + 'xenpaging_file', + 'xenpaging_extra', 'device_model', 'display', + 'smbios_firmware', 'acpi_firmware', 'fda', 'fdb', - 'gfx_passthru', 'guest_os_type', Index: xen-4.2.1-testing/tools/python/xen/xm/main.py =================================================================== --- xen-4.2.1-testing.orig/tools/python/xen/xm/main.py @@ -409,5 +409,5 @@ Index: xen-4.2.1-testing/tools/python/xen/xm/xenapi_create.py + 'xenpaging_file', + 'xenpaging_extra', 'device_model', - 'loader', - 'fda', + 'smbios_firmware', + 'acpi_firmware',