OBS User unknown 2008-11-08 19:32:12 +00:00 committed by Git OBS Bridge
parent 9911a53e56
commit 09450d07be
41 changed files with 1828 additions and 680 deletions

View File

@ -1331,7 +1331,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/mm.c
process_deferred_ops();
domain_mmap_cache_destroy(&mapcache);
@@ -3617,9 +3830,8 @@ static int ptwr_emulated_update(
@@ -3621,9 +3834,8 @@ static int ptwr_emulated_update(
nl1e = l1e_from_intpte(val);
if ( unlikely(!get_page_from_l1e(nl1e, d)) )
{

View File

@ -12,7 +12,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/irq.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/irq.c
+++ xen-3.3.1-testing/xen/arch/x86/irq.c
@@ -737,9 +737,12 @@ __initcall(setup_dump_irqs);
@@ -751,9 +751,12 @@ __initcall(setup_dump_irqs);
void fixup_irqs(cpumask_t map)
{
@ -26,7 +26,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/irq.c
for ( irq = 0; irq < NR_IRQS; irq++ )
{
cpumask_t mask;
@@ -758,8 +761,24 @@ void fixup_irqs(cpumask_t map)
@@ -772,8 +775,24 @@ void fixup_irqs(cpumask_t map)
printk("Cannot set affinity for irq %i\n", irq);
}
@ -55,7 +55,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/smpboot.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/smpboot.c
+++ xen-3.3.1-testing/xen/arch/x86/smpboot.c
@@ -1225,15 +1225,6 @@ int __cpu_disable(void)
@@ -1224,15 +1224,6 @@ int __cpu_disable(void)
if (cpu == 0)
return -EBUSY;
@ -71,7 +71,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/smpboot.c
local_irq_disable();
clear_local_APIC();
/* Allow any queued timer interrupts to get serviced */
@@ -1249,6 +1240,9 @@ int __cpu_disable(void)
@@ -1248,6 +1239,9 @@ int __cpu_disable(void)
fixup_irqs(map);
/* It's now safe to remove this processor from the online map */
cpu_clear(cpu, cpu_online_map);
@ -81,7 +81,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/smpboot.c
return 0;
}
@@ -1275,28 +1269,6 @@ static int take_cpu_down(void *unused)
@@ -1274,28 +1268,6 @@ static int take_cpu_down(void *unused)
return __cpu_disable();
}
@ -110,7 +110,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/smpboot.c
int cpu_down(unsigned int cpu)
{
int err = 0;
@@ -1307,6 +1279,12 @@ int cpu_down(unsigned int cpu)
@@ -1306,6 +1278,12 @@ int cpu_down(unsigned int cpu)
goto out;
}

View File

@ -13,7 +13,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/traps.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/traps.c
+++ xen-3.3.1-testing/xen/arch/x86/traps.c
@@ -2158,6 +2158,12 @@ static int emulate_privileged_op(struct
@@ -2159,6 +2159,12 @@ static int emulate_privileged_op(struct
if ( wrmsr_safe(regs->ecx, eax, edx) != 0 )
goto fail;
break;
@ -26,7 +26,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/traps.c
default:
if ( wrmsr_hypervisor_regs(regs->ecx, eax, edx) )
break;
@@ -2234,6 +2240,12 @@ static int emulate_privileged_op(struct
@@ -2235,6 +2241,12 @@ static int emulate_privileged_op(struct
MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL |
MSR_IA32_MISC_ENABLE_XTPR_DISABLE;
break;

View File

@ -380,7 +380,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/smpboot.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/smpboot.c
+++ xen-3.3.1-testing/xen/arch/x86/smpboot.c
@@ -835,10 +835,15 @@ static int __devinit do_boot_cpu(int api
@@ -828,10 +828,15 @@ static int __devinit do_boot_cpu(int api
*/
{
unsigned long boot_error;
@ -396,7 +396,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/smpboot.c
/*
* Save current MTRR state in case it was changed since early boot
@@ -864,6 +869,37 @@ static int __devinit do_boot_cpu(int api
@@ -857,6 +862,37 @@ static int __devinit do_boot_cpu(int api
/* Debug build: detect stack overflow by setting up a guard page. */
memguard_guard_stack(stack_start.esp);
@ -438,7 +438,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/traps.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/traps.c
+++ xen-3.3.1-testing/xen/arch/x86/traps.c
@@ -2976,13 +2976,13 @@ void set_intr_gate(unsigned int n, void
@@ -2977,13 +2977,13 @@ void set_intr_gate(unsigned int n, void
void set_tss_desc(unsigned int n, void *addr)
{
_set_tssldt_desc(

View File

@ -27,7 +27,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/smpboot.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/smpboot.c
+++ xen-3.3.1-testing/xen/arch/x86/smpboot.c
@@ -900,6 +900,13 @@ static int __devinit do_boot_cpu(int api
@@ -893,6 +893,13 @@ static int __devinit do_boot_cpu(int api
= l1e_from_page(virt_to_page(gdt) + i,
__PAGE_HYPERVISOR);

View File

@ -30,7 +30,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/smpboot.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/smpboot.c
+++ xen-3.3.1-testing/xen/arch/x86/smpboot.c
@@ -1120,7 +1120,7 @@ static void __init smp_boot_cpus(unsigne
@@ -1119,7 +1119,7 @@ static void __init smp_boot_cpus(unsigne
Dprintk("CPU present map: %lx\n", physids_coerce(phys_cpu_present_map));
kicked = 1;

View File

@ -11,8 +11,10 @@ per-vector irq_desc lock.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
--- a/xen/arch/ia64/xen/irq.c
+++ b/xen/arch/ia64/xen/irq.c
Index: xen-3.3.1-testing/xen/arch/ia64/xen/irq.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/ia64/xen/irq.c
+++ xen-3.3.1-testing/xen/arch/ia64/xen/irq.c
@@ -459,20 +459,24 @@ int pirq_guest_bind(struct vcpu *v, int
return rc;
}
@ -53,8 +55,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
}
void
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
Index: xen-3.3.1-testing/xen/arch/x86/domain.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/domain.c
+++ xen-3.3.1-testing/xen/arch/x86/domain.c
@@ -414,8 +414,6 @@ int arch_domain_create(struct domain *d,
goto fail;
}
@ -64,8 +68,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
if ( is_hvm_domain(d) )
{
if ( (rc = hvm_domain_initialise(d)) != 0 )
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
Index: xen-3.3.1-testing/xen/arch/x86/io_apic.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/io_apic.c
+++ xen-3.3.1-testing/xen/arch/x86/io_apic.c
@@ -48,22 +48,6 @@ atomic_t irq_mis_count;
int msi_enable = 0;
boolean_param("msi", msi_enable);
@ -97,8 +103,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
#define IOAPIC_AUTO -1
#define IOAPIC_EDGE 0
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
Index: xen-3.3.1-testing/xen/arch/x86/irq.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/irq.c
+++ xen-3.3.1-testing/xen/arch/x86/irq.c
@@ -277,6 +277,35 @@ static void __do_IRQ_guest(int vector)
}
}
@ -201,29 +209,61 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
spin_unlock_irqrestore(&desc->lock, flags);
return shared;
@@ -491,16 +512,15 @@ int pirq_guest_bind(struct vcpu *v, int
@@ -489,20 +510,17 @@ int pirq_guest_bind(struct vcpu *v, int
irq_guest_action_t *action, *newaction = NULL;
int rc = 0;
cpumask_t cpumask = CPU_MASK_NONE;
+ unsigned long flags;
+ WARN_ON(!spin_is_locked(&v->domain->evtchn_lock));
+
retry:
- retry:
- vector = domain_irq_to_vector(v->domain, irq);
- if ( vector == 0 )
- {
- rc = -EINVAL;
- goto out;
- }
-
- desc = &irq_desc[vector];
+ WARN_ON(!spin_is_locked(&v->domain->evtchn_lock));
- spin_lock_irq(&desc->lock);
+ retry:
+ desc = domain_spin_lock_irq_desc(v->domain, irq, &flags);
+ if ( desc == NULL )
return -EINVAL;
+ return -EINVAL;
- desc = &irq_desc[vector];
-
- spin_lock_irqsave(&desc->lock, flags);
-
action = (irq_guest_action_t *)desc->action;
+ vector = desc - irq_desc;
if ( !(desc->status & IRQ_GUEST) )
{
@@ -575,26 +595,39 @@ int pirq_guest_bind(struct vcpu *v, int
@@ -517,7 +535,7 @@ int pirq_guest_bind(struct vcpu *v, int
if ( newaction == NULL )
{
- spin_unlock_irq(&desc->lock);
+ spin_unlock_irqrestore(&desc->lock, flags);
if ( (newaction = xmalloc(irq_guest_action_t)) != NULL )
goto retry;
gdprintk(XENLOG_INFO,
@@ -563,7 +581,7 @@ int pirq_guest_bind(struct vcpu *v, int
*/
ASSERT(action->ack_type == ACKTYPE_EOI);
ASSERT(desc->status & IRQ_DISABLED);
- spin_unlock_irq(&desc->lock);
+ spin_unlock_irqrestore(&desc->lock, flags);
cpu_relax();
goto retry;
}
@@ -579,32 +597,45 @@ int pirq_guest_bind(struct vcpu *v, int
action->guest[action->nr_guests++] = v->domain;
unlock_out:
- spin_unlock_irq(&desc->lock);
+ spin_unlock_irqrestore(&desc->lock, flags);
out:
if ( newaction != NULL )
xfree(newaction);
return rc;
}
@ -235,7 +275,6 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
irq_desc_t *desc;
irq_guest_action_t *action;
cpumask_t cpu_eoi_map;
unsigned long flags;
- int i;
+ int i, rc = 0;
@ -244,7 +283,7 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
- BUG_ON(vector == 0);
+ WARN_ON(!spin_is_locked(&d->evtchn_lock));
- spin_lock_irqsave(&desc->lock, flags);
- spin_lock_irq(&desc->lock);
+ desc = domain_spin_lock_irq_desc(d, irq, &flags);
+ if ( unlikely(desc == NULL) )
+ {
@ -273,19 +312,41 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
memmove(&action->guest[i], &action->guest[i+1], IRQ_MAX_GUESTS-i-1);
action->nr_guests--;
@@ -661,7 +694,8 @@ void pirq_guest_unbind(struct domain *d,
@@ -622,7 +653,7 @@ void pirq_guest_unbind(struct domain *d,
(action->nr_guests != 0) )
{
cpu_eoi_map = action->cpu_eoi_map;
- spin_unlock_irq(&desc->lock);
+ spin_unlock_irqrestore(&desc->lock, flags);
on_selected_cpus(cpu_eoi_map, set_eoi_ready, desc, 1, 0);
spin_lock_irq(&desc->lock);
}
@@ -659,7 +690,7 @@ void pirq_guest_unbind(struct domain *d,
if ( !cpus_empty(cpu_eoi_map) )
{
BUG_ON(action->ack_type != ACKTYPE_EOI);
- spin_unlock_irq(&desc->lock);
+ spin_unlock_irqrestore(&desc->lock, flags);
on_selected_cpus(cpu_eoi_map, set_eoi_ready, desc, 1, 1);
spin_lock_irq(&desc->lock);
}
@@ -673,9 +704,8 @@ void pirq_guest_unbind(struct domain *d,
desc->handler->shutdown(vector);
out:
- spin_unlock_irqrestore(&desc->lock, flags);
- spin_unlock_irq(&desc->lock);
- if ( action != NULL )
- xfree(action);
+ spin_unlock_irqrestore(&desc->lock, flags);
+ return rc;
}
extern void dump_ioapic_irq_info(void);
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -727,7 +727,6 @@ void pci_disable_msi(int vector)
Index: xen-3.3.1-testing/xen/arch/x86/msi.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/msi.c
+++ xen-3.3.1-testing/xen/arch/x86/msi.c
@@ -728,7 +728,6 @@ void pci_disable_msi(int vector)
__pci_disable_msix(vector);
}
@ -293,8 +354,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
static void msi_free_vectors(struct pci_dev* dev)
{
struct msi_desc *entry, *tmp;
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
Index: xen-3.3.1-testing/xen/arch/x86/physdev.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/physdev.c
+++ xen-3.3.1-testing/xen/arch/x86/physdev.c
@@ -26,17 +26,11 @@ int
ioapic_guest_write(
unsigned long physbase, unsigned int reg, u32 pval);
@ -514,8 +577,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
}
if ( copy_to_guest(arg, &irq_op, 1) != 0 )
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
Index: xen-3.3.1-testing/xen/common/event_channel.c
===================================================================
--- xen-3.3.1-testing.orig/xen/common/event_channel.c
+++ xen-3.3.1-testing/xen/common/event_channel.c
@@ -376,7 +376,8 @@ static long __evtchn_close(struct domain
break;
@ -526,8 +591,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
d1->pirq_to_evtchn[chn1->u.pirq] = 0;
break;
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
Index: xen-3.3.1-testing/xen/include/asm-x86/domain.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/domain.h
+++ xen-3.3.1-testing/xen/include/asm-x86/domain.h
@@ -235,7 +235,7 @@ struct arch_domain
/* Shadow translated domain: P2M mapping */
pagetable_t phys_table;
@ -537,8 +604,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
int vector_pirq[NR_VECTORS];
int pirq_vector[NR_PIRQS];
--- a/xen/include/asm-x86/irq.h
+++ b/xen/include/asm-x86/irq.h
Index: xen-3.3.1-testing/xen/include/asm-x86/irq.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/irq.h
+++ xen-3.3.1-testing/xen/include/asm-x86/irq.h
@@ -52,6 +52,7 @@ extern atomic_t irq_mis_count;
int pirq_acktype(struct domain *d, int irq);
int pirq_shared(struct domain *d , int irq);
@ -549,9 +618,11 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
+#define domain_vector_to_irq(d, vec) (msi_enable ? (d)->arch.vector_pirq[vec] : vector_to_irq(vec))
+
#endif /* _ASM_HW_IRQ_H */
--- a/xen/include/asm-x86/msi.h
+++ b/xen/include/asm-x86/msi.h
@@ -106,7 +106,7 @@ struct msi_desc {
Index: xen-3.3.1-testing/xen/include/asm-x86/msi.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/msi.h
+++ xen-3.3.1-testing/xen/include/asm-x86/msi.h
@@ -107,7 +107,7 @@ struct msi_desc {
*/
#define NR_HP_RESERVED_VECTORS 20
@ -560,8 +631,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
/*
* MSI-X Address Register
--- a/xen/include/xen/irq.h
+++ b/xen/include/xen/irq.h
Index: xen-3.3.1-testing/xen/include/xen/irq.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/xen/irq.h
+++ xen-3.3.1-testing/xen/include/xen/irq.h
@@ -22,7 +22,6 @@ struct irqaction
#define IRQ_PENDING 4 /* IRQ pending - replay on enable */
#define IRQ_REPLAY 8 /* IRQ has been replayed but not acked yet */

View File

@ -1,52 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1222333937 -3600
# Node ID d4a093819310b70f24dfdc986755588ed5581a6e
# Parent 50170dc8649cb43630f067eb9b2db3ce3f9c6db4
x86 pmstat: Fix get_pm_info hypercall argument checking.
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
--- a/xen/arch/x86/acpi/pmstat.c
+++ b/xen/arch/x86/acpi/pmstat.c
@@ -36,6 +36,7 @@
#include <xen/cpumask.h>
#include <asm/processor.h>
#include <xen/percpu.h>
+#include <xen/domain.h>
#include <public/sysctl.h>
#include <acpi/cpufreq/cpufreq.h>
@@ -53,14 +54,26 @@ int do_get_pm_info(struct xen_sysctl_get
struct processor_pminfo *pmpt = &processor_pminfo[op->cpuid];
/* to protect the case when Px was not controlled by xen */
- if ( (!(pmpt->perf.init & XEN_PX_INIT)) &&
- (op->type & PMSTAT_CATEGORY_MASK) == PMSTAT_PX )
+ if ( (op->cpuid >= NR_CPUS) || !cpu_online(op->cpuid) )
return -EINVAL;
- if ( !cpu_online(op->cpuid) )
- return -EINVAL;
+ switch ( op->type & PMSTAT_CATEGORY_MASK )
+ {
+ case PMSTAT_CX:
+ if ( !(xen_processor_pmbits & XEN_PROCESSOR_PM_CX) )
+ return -ENODEV;
+ break;
+ case PMSTAT_PX:
+ if ( !(xen_processor_pmbits & XEN_PROCESSOR_PM_PX) )
+ return -ENODEV;
+ if ( !(pmpt->perf.init & XEN_PX_INIT) )
+ return -EINVAL;
+ break;
+ default:
+ return -ENODEV;
+ }
- switch( op->type )
+ switch ( op->type )
{
case PMSTAT_get_max_px:
{

View File

@ -6,8 +6,10 @@
x86: Clean up and fix 18539:31f09a5e24cf8
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
--- a/xen/arch/ia64/xen/irq.c
+++ b/xen/arch/ia64/xen/irq.c
Index: xen-3.3.1-testing/xen/arch/ia64/xen/irq.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/ia64/xen/irq.c
+++ xen-3.3.1-testing/xen/arch/ia64/xen/irq.c
@@ -459,12 +459,12 @@ int pirq_guest_bind(struct vcpu *v, int
return rc;
}
@ -46,15 +48,15 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
}
void
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -508,14 +508,14 @@ int pirq_guest_bind(struct vcpu *v, int
unsigned int vector;
irq_desc_t *desc;
irq_guest_action_t *action;
- unsigned long flags;
Index: xen-3.3.1-testing/xen/arch/x86/irq.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/irq.c
+++ xen-3.3.1-testing/xen/arch/x86/irq.c
@@ -510,12 +510,12 @@ int pirq_guest_bind(struct vcpu *v, int
irq_guest_action_t *action, *newaction = NULL;
int rc = 0;
cpumask_t cpumask = CPU_MASK_NONE;
- unsigned long flags;
WARN_ON(!spin_is_locked(&v->domain->evtchn_lock));
+ BUG_ON(!local_irq_is_enabled());
@ -63,9 +65,18 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
- desc = domain_spin_lock_irq_desc(v->domain, irq, &flags);
+ desc = domain_spin_lock_irq_desc(v->domain, irq, NULL);
if ( desc == NULL )
return -EINVAL;
return -EINVAL;
@@ -575,7 +575,7 @@ int pirq_guest_bind(struct vcpu *v, int
@@ -535,7 +535,7 @@ int pirq_guest_bind(struct vcpu *v, int
if ( newaction == NULL )
{
- spin_unlock_irqrestore(&desc->lock, flags);
+ spin_unlock_irq(&desc->lock);
if ( (newaction = xmalloc(irq_guest_action_t)) != NULL )
goto retry;
gdprintk(XENLOG_INFO,
@@ -581,7 +581,7 @@ int pirq_guest_bind(struct vcpu *v, int
*/
ASSERT(action->ack_type == ACKTYPE_EOI);
ASSERT(desc->status & IRQ_DISABLED);
@ -74,12 +85,15 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
cpu_relax();
goto retry;
}
@@ -591,43 +591,25 @@ int pirq_guest_bind(struct vcpu *v, int
@@ -597,45 +597,26 @@ int pirq_guest_bind(struct vcpu *v, int
action->guest[action->nr_guests++] = v->domain;
out:
unlock_out:
- spin_unlock_irqrestore(&desc->lock, flags);
+ spin_unlock_irq(&desc->lock);
out:
- if ( newaction != NULL )
- xfree(newaction);
return rc;
}
@ -91,12 +105,11 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
+ unsigned int vector;
irq_guest_action_t *action;
cpumask_t cpu_eoi_map;
- unsigned long flags;
- int i, rc = 0;
-
- WARN_ON(!spin_is_locked(&d->evtchn_lock));
+ int i;
- WARN_ON(!spin_is_locked(&d->evtchn_lock));
-
- desc = domain_spin_lock_irq_desc(d, irq, &flags);
- if ( unlikely(desc == NULL) )
- {
@ -124,40 +137,34 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
memmove(&action->guest[i], &action->guest[i+1], IRQ_MAX_GUESTS-i-1);
action->nr_guests--;
@@ -645,9 +627,9 @@ int pirq_guest_unbind(struct domain *d,
@@ -653,7 +634,7 @@ int pirq_guest_unbind(struct domain *d,
(action->nr_guests != 0) )
{
cpu_eoi_map = action->cpu_eoi_map;
- spin_unlock_irqrestore(&desc->lock, flags);
- spin_unlock_irqrestore(&desc->lock, flags);
+ spin_unlock_irq(&desc->lock);
on_selected_cpus(cpu_eoi_map, set_eoi_ready, desc, 1, 0);
- spin_lock_irqsave(&desc->lock, flags);
+ spin_lock_irq(&desc->lock);
spin_lock_irq(&desc->lock);
}
break;
}
@@ -659,7 +641,7 @@ int pirq_guest_unbind(struct domain *d,
BUG_ON(test_bit(irq, d->pirq_mask));
@@ -669,7 +650,7 @@ int pirq_guest_unbind(struct domain *d,
if ( action->nr_guests != 0 )
{
action = NULL;
- goto out;
+ return;
}
BUG_ON(action->in_flight != 0);
@@ -679,9 +661,9 @@ int pirq_guest_unbind(struct domain *d,
@@ -690,7 +671,7 @@ int pirq_guest_unbind(struct domain *d,
if ( !cpus_empty(cpu_eoi_map) )
{
BUG_ON(action->ack_type != ACKTYPE_EOI);
- spin_unlock_irqrestore(&desc->lock, flags);
+ spin_unlock_irq(&desc->lock);
on_selected_cpus(cpu_eoi_map, set_eoi_ready, desc, 1, 1);
- spin_lock_irqsave(&desc->lock, flags);
+ spin_lock_irq(&desc->lock);
spin_lock_irq(&desc->lock);
}
BUG_ON(!cpus_empty(action->cpu_eoi_map));
@@ -692,10 +674,63 @@ int pirq_guest_unbind(struct domain *d,
@@ -702,10 +683,63 @@ int pirq_guest_unbind(struct domain *d,
desc->status &= ~IRQ_INPROGRESS;
kill_timer(&irq_guest_eoi_timer[vector]);
desc->handler->shutdown(vector);
@ -223,8 +230,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
}
extern void dump_ioapic_irq_info(void);
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
Index: xen-3.3.1-testing/xen/arch/x86/physdev.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/physdev.c
+++ xen-3.3.1-testing/xen/arch/x86/physdev.c
@@ -147,7 +147,7 @@ static int unmap_domain_pirq(struct doma
{
unsigned long flags;
@ -234,8 +243,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
if ( forced_unbind )
dprintk(XENLOG_G_WARNING, "dom%d: forcing unbind of pirq %d\n",
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
Index: xen-3.3.1-testing/xen/common/event_channel.c
===================================================================
--- xen-3.3.1-testing.orig/xen/common/event_channel.c
+++ xen-3.3.1-testing/xen/common/event_channel.c
@@ -376,8 +376,7 @@ static long __evtchn_close(struct domain
break;
@ -246,8 +257,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
d1->pirq_to_evtchn[chn1->u.pirq] = 0;
break;
--- a/xen/include/asm-x86/irq.h
+++ b/xen/include/asm-x86/irq.h
Index: xen-3.3.1-testing/xen/include/asm-x86/irq.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/irq.h
+++ xen-3.3.1-testing/xen/include/asm-x86/irq.h
@@ -55,4 +55,6 @@ int pirq_shared(struct domain *d , int i
#define domain_irq_to_vector(d, irq) (msi_enable ? (d)->arch.pirq_vector[irq] : irq_to_vector(irq))
#define domain_vector_to_irq(d, vec) (msi_enable ? (d)->arch.vector_pirq[vec] : vector_to_irq(vec))
@ -255,8 +268,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
+int pirq_guest_force_unbind(struct domain *d, int irq);
+
#endif /* _ASM_HW_IRQ_H */
--- a/xen/include/xen/irq.h
+++ b/xen/include/xen/irq.h
Index: xen-3.3.1-testing/xen/include/xen/irq.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/xen/irq.h
+++ xen-3.3.1-testing/xen/include/xen/irq.h
@@ -77,7 +77,7 @@ struct vcpu;
extern int pirq_guest_eoi(struct domain *d, int irq);
extern int pirq_guest_unmask(struct domain *d);

View File

@ -8,8 +8,10 @@ x86: Move pirq logic to irq.c.
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
Index: xen-3.3.1-testing/xen/arch/x86/irq.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/irq.c
+++ xen-3.3.1-testing/xen/arch/x86/irq.c
@@ -14,8 +14,11 @@
#include <xen/sched.h>
#include <xen/keyhandler.h>
@ -23,7 +25,7 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
/* opt_noirqbalance: If true, software IRQ balancing/affinity is disabled. */
int opt_noirqbalance = 0;
@@ -733,6 +736,157 @@ int pirq_guest_force_unbind(struct domai
@@ -742,6 +745,157 @@ int pirq_guest_force_unbind(struct domai
return bound;
}
@ -181,8 +183,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
extern void dump_ioapic_irq_info(void);
static void dump_irqs(unsigned char key)
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
Index: xen-3.3.1-testing/xen/arch/x86/physdev.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/physdev.c
+++ xen-3.3.1-testing/xen/arch/x86/physdev.c
@@ -26,171 +26,12 @@ int
ioapic_guest_write(
unsigned long physbase, unsigned int reg, u32 pval);
@ -433,8 +437,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
spin_unlock(&dom0->evtchn_lock);
}
--- a/xen/include/asm-x86/irq.h
+++ b/xen/include/asm-x86/irq.h
Index: xen-3.3.1-testing/xen/include/asm-x86/irq.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/irq.h
+++ xen-3.3.1-testing/xen/include/asm-x86/irq.h
@@ -52,6 +52,11 @@ extern atomic_t irq_mis_count;
int pirq_acktype(struct domain *d, int irq);
int pirq_shared(struct domain *d , int irq);

View File

@ -8,8 +8,10 @@ x86: Free MSI vector when a pirq is unmapped.
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
Index: xen-3.3.1-testing/xen/arch/x86/domain.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/domain.c
+++ xen-3.3.1-testing/xen/arch/x86/domain.c
@@ -459,6 +459,7 @@ void arch_domain_destroy(struct domain *
hvm_domain_destroy(d);
@ -18,8 +20,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
if ( !is_idle_domain(d) )
iommu_domain_destroy(d);
--- a/xen/arch/x86/i8259.c
+++ b/xen/arch/x86/i8259.c
Index: xen-3.3.1-testing/xen/arch/x86/i8259.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/i8259.c
+++ xen-3.3.1-testing/xen/arch/x86/i8259.c
@@ -408,6 +408,10 @@ void __init init_IRQ(void)
irq_desc[LEGACY_VECTOR(i)].handler = &i8259A_irq_type;
}
@ -31,8 +35,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
apic_intr_init();
/* Set the clock to HZ Hz */
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
Index: xen-3.3.1-testing/xen/arch/x86/io_apic.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/io_apic.c
+++ xen-3.3.1-testing/xen/arch/x86/io_apic.c
@@ -90,7 +90,8 @@ static struct irq_pin_list {
} irq_2_pin[PIN_MAP_SIZE];
static int irq_2_pin_free_entry = NR_IRQS;
@ -107,9 +113,11 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
vector_irq[vector] = irq;
if (irq != AUTO_ASSIGN)
IO_APIC_VECTOR(irq) = vector;
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -863,7 +863,10 @@ int unmap_domain_pirq(struct domain *d,
Index: xen-3.3.1-testing/xen/arch/x86/irq.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/irq.c
+++ xen-3.3.1-testing/xen/arch/x86/irq.c
@@ -872,7 +872,10 @@ int unmap_domain_pirq(struct domain *d,
pci_disable_msi(vector);
if ( desc->handler == &pci_msi_type )
@ -120,7 +128,7 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
if ( !forced_unbind )
{
@@ -887,6 +890,24 @@ int unmap_domain_pirq(struct domain *d,
@@ -896,6 +899,24 @@ int unmap_domain_pirq(struct domain *d,
return ret;
}
@ -145,8 +153,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
extern void dump_ioapic_irq_info(void);
static void dump_irqs(unsigned char key)
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
Index: xen-3.3.1-testing/xen/arch/x86/physdev.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/physdev.c
+++ xen-3.3.1-testing/xen/arch/x86/physdev.c
@@ -83,7 +83,7 @@ static int physdev_map_pirq(struct physd
if ( vector < 0 || vector >= NR_VECTORS )
{
@ -173,8 +183,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
free_domain:
rcu_unlock_domain(d);
return ret;
--- a/xen/include/asm-x86/io_apic.h
+++ b/xen/include/asm-x86/io_apic.h
Index: xen-3.3.1-testing/xen/include/asm-x86/io_apic.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/io_apic.h
+++ xen-3.3.1-testing/xen/include/asm-x86/io_apic.h
@@ -192,5 +192,6 @@ static inline int ioapic_resume(void) {r
#endif
@ -182,8 +194,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
+extern int free_irq_vector(int vector);
#endif
--- a/xen/include/asm-x86/irq.h
+++ b/xen/include/asm-x86/irq.h
Index: xen-3.3.1-testing/xen/include/asm-x86/irq.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/irq.h
+++ xen-3.3.1-testing/xen/include/asm-x86/irq.h
@@ -19,7 +19,9 @@
extern int vector_irq[NR_VECTORS];

View File

@ -6,9 +6,11 @@
x86: Remove bogus assertion from free_domain_pirqs().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -894,8 +894,6 @@ void free_domain_pirqs(struct domain *d)
Index: xen-3.3.1-testing/xen/arch/x86/irq.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/irq.c
+++ xen-3.3.1-testing/xen/arch/x86/irq.c
@@ -903,8 +903,6 @@ void free_domain_pirqs(struct domain *d)
{
int i;

View File

@ -10,9 +10,10 @@ the access to domain's pirq_vector mapping is also protected.
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
diff -r b8f329d2c074 -r a11ad61bdb5b xen/arch/x86/hvm/svm/intr.c
--- a/xen/arch/x86/hvm/svm/intr.c Thu Oct 09 11:08:13 2008 +0100
+++ b/xen/arch/x86/hvm/svm/intr.c Thu Oct 09 11:14:52 2008 +0100
Index: xen-3.3.1-testing/xen/arch/x86/hvm/svm/intr.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/hvm/svm/intr.c
+++ xen-3.3.1-testing/xen/arch/x86/hvm/svm/intr.c
@@ -124,9 +124,11 @@ static void svm_dirq_assist(struct vcpu
if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) )
continue;
@ -43,9 +44,10 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/arch/x86/hvm/svm/intr.c
}
}
diff -r b8f329d2c074 -r a11ad61bdb5b xen/arch/x86/hvm/vmsi.c
--- a/xen/arch/x86/hvm/vmsi.c Thu Oct 09 11:08:13 2008 +0100
+++ b/xen/arch/x86/hvm/vmsi.c Thu Oct 09 11:14:52 2008 +0100
Index: xen-3.3.1-testing/xen/arch/x86/hvm/vmsi.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/hvm/vmsi.c
+++ xen-3.3.1-testing/xen/arch/x86/hvm/vmsi.c
@@ -134,7 +134,7 @@ int vmsi_deliver(struct domain *d, int p
"vector=%x trig_mode=%x\n",
dest, dest_mode, delivery_mode, vector, trig_mode);
@ -55,9 +57,10 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/arch/x86/hvm/vmsi.c
{
gdprintk(XENLOG_WARNING, "pirq %x not msi \n", pirq);
return 0;
diff -r b8f329d2c074 -r a11ad61bdb5b xen/arch/x86/hvm/vmx/intr.c
--- a/xen/arch/x86/hvm/vmx/intr.c Thu Oct 09 11:08:13 2008 +0100
+++ b/xen/arch/x86/hvm/vmx/intr.c Thu Oct 09 11:14:52 2008 +0100
Index: xen-3.3.1-testing/xen/arch/x86/hvm/vmx/intr.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/hvm/vmx/intr.c
+++ xen-3.3.1-testing/xen/arch/x86/hvm/vmx/intr.c
@@ -127,11 +127,13 @@ static void vmx_dirq_assist(struct vcpu
if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) )
continue;
@ -95,9 +98,10 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/arch/x86/hvm/vmx/intr.c
}
}
diff -r b8f329d2c074 -r a11ad61bdb5b xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c Thu Oct 09 11:08:13 2008 +0100
+++ b/xen/arch/x86/irq.c Thu Oct 09 11:14:52 2008 +0100
Index: xen-3.3.1-testing/xen/arch/x86/irq.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/irq.c
+++ xen-3.3.1-testing/xen/arch/x86/irq.c
@@ -285,7 +285,7 @@ static void __do_IRQ_guest(int vector)
* The descriptor is returned locked. This function is safe against changes
* to the per-domain irq-to-vector mapping.
@ -107,9 +111,10 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/arch/x86/irq.c
struct domain *d, int irq, unsigned long *pflags)
{
unsigned int vector;
diff -r b8f329d2c074 -r a11ad61bdb5b xen/drivers/passthrough/io.c
--- a/xen/drivers/passthrough/io.c Thu Oct 09 11:08:13 2008 +0100
+++ b/xen/drivers/passthrough/io.c Thu Oct 09 11:14:52 2008 +0100
Index: xen-3.3.1-testing/xen/drivers/passthrough/io.c
===================================================================
--- xen-3.3.1-testing.orig/xen/drivers/passthrough/io.c
+++ xen-3.3.1-testing/xen/drivers/passthrough/io.c
@@ -26,10 +26,14 @@ static void pt_irq_time_out(void *data)
struct hvm_mirq_dpci_mapping *irq_map = data;
unsigned int guest_gsi, machine_gsi = 0;
@ -147,12 +152,12 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/drivers/passthrough/io.c
uint32_t device, intx, link;
struct dev_intx_gsi_link *digl;
+ int pirq = pt_irq_bind->machine_irq;
+
+ if ( pirq < 0 || pirq >= NR_PIRQS )
+ return -EINVAL;
+
+ spin_lock(&d->evtchn_lock);
+
+ hvm_irq_dpci = domain_get_irq_dpci(d);
if ( hvm_irq_dpci == NULL )
{
@ -181,10 +186,10 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/drivers/passthrough/io.c
if ( pt_irq_bind->irq_type == PT_IRQ_TYPE_MSI )
{
- int pirq = pt_irq_bind->machine_irq;
-
- if ( pirq < 0 || pirq >= NR_IRQS )
- return -EINVAL;
-
- if ( !(hvm_irq_dpci->mirq[pirq].flags & HVM_IRQ_DPCI_VALID ) )
+ if ( !test_and_set_bit(pirq, hvm_irq_dpci->mapping))
{
@ -254,10 +259,10 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/drivers/passthrough/io.c
uint32_t device, intx, link;
struct list_head *digl_list, *tmp;
struct dev_intx_gsi_link *digl;
-
- if ( hvm_irq_dpci == NULL )
- return 0;
-
machine_gsi = pt_irq_bind->machine_irq;
device = pt_irq_bind->u.pci.device;
intx = pt_irq_bind->u.pci.intx;
@ -320,10 +325,10 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/drivers/passthrough/io.c
void hvm_dpci_msi_eoi(struct domain *d, int vector)
{
struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci;
+ irq_desc_t *desc;
int pirq;
- int pirq;
- unsigned long flags;
- irq_desc_t *desc;
irq_desc_t *desc;
+ int pirq;
if ( !iommu_enabled || (hvm_irq_dpci == NULL) )
return;
@ -338,6 +343,10 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/drivers/passthrough/io.c
- int vec;
- vec = domain_irq_to_vector(d, pirq);
- desc = &irq_desc[vec];
-
- spin_lock_irqsave(&desc->lock, flags);
- desc->status &= ~IRQ_INPROGRESS;
- spin_unlock_irqrestore(&desc->lock, flags);
+ test_bit(pirq, hvm_irq_dpci->mapping) &&
+ (test_bit(_HVM_IRQ_DPCI_MSI, &hvm_irq_dpci->mirq[pirq].flags)))
+ {
@ -349,14 +358,11 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/drivers/passthrough/io.c
+ return;
+ }
- spin_lock_irqsave(&desc->lock, flags);
- desc->status &= ~IRQ_INPROGRESS;
- spin_unlock_irqrestore(&desc->lock, flags);
+ desc->status &= ~IRQ_INPROGRESS;
+ spin_unlock_irq(&desc->lock);
- pirq_guest_eoi(d, pirq);
- }
+ desc->status &= ~IRQ_INPROGRESS;
+ spin_unlock_irq(&desc->lock);
+
+ pirq_guest_eoi(d, pirq);
+ }
+
@ -418,9 +424,10 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/drivers/passthrough/io.c
- spin_unlock(&hvm_irq_dpci->dirq_lock);
+ spin_unlock(&d->evtchn_lock);
}
diff -r b8f329d2c074 -r a11ad61bdb5b xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c Thu Oct 09 11:08:13 2008 +0100
+++ b/xen/drivers/passthrough/pci.c Thu Oct 09 11:14:52 2008 +0100
Index: xen-3.3.1-testing/xen/drivers/passthrough/pci.c
===================================================================
--- xen-3.3.1-testing.orig/xen/drivers/passthrough/pci.c
+++ xen-3.3.1-testing/xen/drivers/passthrough/pci.c
@@ -154,7 +154,7 @@ int pci_remove_device(u8 bus, u8 devfn)
static void pci_clean_dpci_irqs(struct domain *d)
@ -457,10 +464,11 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/drivers/passthrough/pci.c
}
void pci_release_devices(struct domain *d)
diff -r b8f329d2c074 -r a11ad61bdb5b xen/drivers/passthrough/vtd/x86/vtd.c
--- a/xen/drivers/passthrough/vtd/x86/vtd.c Thu Oct 09 11:08:13 2008 +0100
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c Thu Oct 09 11:14:52 2008 +0100
@@ -85,37 +85,41 @@ void hvm_dpci_isairq_eoi(struct domain *
Index: xen-3.3.1-testing/xen/drivers/passthrough/vtd/x86/vtd.c
===================================================================
--- xen-3.3.1-testing.orig/xen/drivers/passthrough/vtd/x86/vtd.c
+++ xen-3.3.1-testing/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -85,37 +85,41 @@ int domain_set_irq_dpci(struct domain *d
void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq)
{
struct hvm_irq *hvm_irq = &d->arch.hvm_domain.irq;
@ -513,9 +521,10 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/drivers/passthrough/vtd/x86/vtd.c
}
+ spin_unlock(&d->evtchn_lock);
}
diff -r b8f329d2c074 -r a11ad61bdb5b xen/include/asm-x86/hvm/irq.h
--- a/xen/include/asm-x86/hvm/irq.h Thu Oct 09 11:08:13 2008 +0100
+++ b/xen/include/asm-x86/hvm/irq.h Thu Oct 09 11:14:52 2008 +0100
Index: xen-3.3.1-testing/xen/include/asm-x86/hvm/irq.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/hvm/irq.h
+++ xen-3.3.1-testing/xen/include/asm-x86/hvm/irq.h
@@ -25,6 +25,7 @@
#include <xen/types.h>
#include <xen/spinlock.h>
@ -545,10 +554,11 @@ diff -r b8f329d2c074 -r a11ad61bdb5b xen/include/asm-x86/hvm/irq.h
struct hvm_mirq_dpci_mapping mirq[NR_IRQS];
/* Guest IRQ to guest device/intx mapping. */
struct hvm_girq_dpci_mapping girq[NR_IRQS];
diff -r b8f329d2c074 -r a11ad61bdb5b xen/include/xen/irq.h
--- a/xen/include/xen/irq.h Thu Oct 09 11:08:13 2008 +0100
+++ b/xen/include/xen/irq.h Thu Oct 09 11:14:52 2008 +0100
@@ -78,6 +78,8 @@ extern int pirq_guest_unmask(struct doma
Index: xen-3.3.1-testing/xen/include/xen/irq.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/xen/irq.h
+++ xen-3.3.1-testing/xen/include/xen/irq.h
@@ -78,6 +78,8 @@ extern int pirq_guest_eoi(struct domain
extern int pirq_guest_unmask(struct domain *d);
extern int pirq_guest_bind(struct vcpu *v, int irq, int will_share);
extern void pirq_guest_unbind(struct domain *d, int irq);

View File

@ -8,8 +8,10 @@ event-channel state now.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
--- a/xen/arch/x86/hvm/svm/intr.c
+++ b/xen/arch/x86/hvm/svm/intr.c
Index: xen-3.3.1-testing/xen/arch/x86/hvm/svm/intr.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/hvm/svm/intr.c
+++ xen-3.3.1-testing/xen/arch/x86/hvm/svm/intr.c
@@ -124,11 +124,11 @@ static void svm_dirq_assist(struct vcpu
if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) )
continue;
@ -33,8 +35,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
}
}
--- a/xen/arch/x86/hvm/vmx/intr.c
+++ b/xen/arch/x86/hvm/vmx/intr.c
Index: xen-3.3.1-testing/xen/arch/x86/hvm/vmx/intr.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/hvm/vmx/intr.c
+++ xen-3.3.1-testing/xen/arch/x86/hvm/vmx/intr.c
@@ -127,11 +127,11 @@ static void vmx_dirq_assist(struct vcpu
if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) )
continue;
@ -58,8 +62,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
}
}
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
Index: xen-3.3.1-testing/xen/arch/x86/irq.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/irq.c
+++ xen-3.3.1-testing/xen/arch/x86/irq.c
@@ -514,7 +514,7 @@ int pirq_guest_bind(struct vcpu *v, int
int rc = 0;
cpumask_t cpumask = CPU_MASK_NONE;
@ -69,7 +75,7 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
BUG_ON(!local_irq_is_enabled());
retry:
@@ -684,7 +684,7 @@ void pirq_guest_unbind(struct domain *d,
@@ -693,7 +693,7 @@ void pirq_guest_unbind(struct domain *d,
irq_desc_t *desc;
int vector;
@ -78,7 +84,7 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
BUG_ON(!local_irq_is_enabled());
desc = domain_spin_lock_irq_desc(d, irq, NULL);
@@ -713,7 +713,7 @@ int pirq_guest_force_unbind(struct domai
@@ -722,7 +722,7 @@ int pirq_guest_force_unbind(struct domai
irq_guest_action_t *action;
int i, bound = 0;
@ -87,7 +93,7 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
BUG_ON(!local_irq_is_enabled());
desc = domain_spin_lock_irq_desc(d, irq, NULL);
@@ -740,7 +740,7 @@ int get_free_pirq(struct domain *d, int
@@ -749,7 +749,7 @@ int get_free_pirq(struct domain *d, int
{
int i;
@ -96,7 +102,7 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
if ( type == MAP_PIRQ_TYPE_GSI )
{
@@ -770,7 +770,7 @@ int map_domain_pirq(
@@ -779,7 +779,7 @@ int map_domain_pirq(
irq_desc_t *desc;
unsigned long flags;
@ -105,7 +111,7 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
if ( !IS_PRIV(current->domain) )
return -EPERM;
@@ -838,7 +838,7 @@ int unmap_domain_pirq(struct domain *d,
@@ -847,7 +847,7 @@ int unmap_domain_pirq(struct domain *d,
if ( !IS_PRIV(current->domain) )
return -EINVAL;
@ -114,7 +120,7 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
vector = d->arch.pirq_vector[pirq];
if ( vector <= 0 )
@@ -897,13 +897,13 @@ void free_domain_pirqs(struct domain *d)
@@ -906,13 +906,13 @@ void free_domain_pirqs(struct domain *d)
if ( !msi_enable )
return;
@ -130,8 +136,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
}
extern void dump_ioapic_irq_info(void);
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
Index: xen-3.3.1-testing/xen/arch/x86/physdev.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/physdev.c
+++ xen-3.3.1-testing/xen/arch/x86/physdev.c
@@ -104,7 +104,7 @@ static int physdev_map_pirq(struct physd
}
@ -175,8 +183,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
}
if ( copy_to_guest(arg, &irq_op, 1) != 0 )
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
Index: xen-3.3.1-testing/xen/common/event_channel.c
===================================================================
--- xen-3.3.1-testing.orig/xen/common/event_channel.c
+++ xen-3.3.1-testing/xen/common/event_channel.c
@@ -133,7 +133,7 @@ static long evtchn_alloc_unbound(evtchn_
if ( rc )
return rc;
@ -520,8 +530,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
}
static void dump_evtchn_info(unsigned char key)
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
Index: xen-3.3.1-testing/xen/drivers/passthrough/io.c
===================================================================
--- xen-3.3.1-testing.orig/xen/drivers/passthrough/io.c
+++ xen-3.3.1-testing/xen/drivers/passthrough/io.c
@@ -30,7 +30,7 @@ static void pt_irq_time_out(void *data)
struct dev_intx_gsi_link *digl;
uint32_t device, intx;
@ -670,8 +682,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
- spin_unlock(&d->evtchn_lock);
+ spin_unlock(&d->event_lock);
}
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
Index: xen-3.3.1-testing/xen/drivers/passthrough/pci.c
===================================================================
--- xen-3.3.1-testing.orig/xen/drivers/passthrough/pci.c
+++ xen-3.3.1-testing/xen/drivers/passthrough/pci.c
@@ -165,7 +165,7 @@ static void pci_clean_dpci_irqs(struct d
if ( !is_hvm_domain(d) && !need_iommu(d) )
return;
@ -690,8 +704,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
}
void pci_release_devices(struct domain *d)
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
Index: xen-3.3.1-testing/xen/drivers/passthrough/vtd/x86/vtd.c
===================================================================
--- xen-3.3.1-testing.orig/xen/drivers/passthrough/vtd/x86/vtd.c
+++ xen-3.3.1-testing/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -93,13 +93,13 @@ void hvm_dpci_isairq_eoi(struct domain *
if ( !vtd_enabled)
return;
@ -715,8 +731,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
- spin_unlock(&d->evtchn_lock);
+ spin_unlock(&d->event_lock);
}
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
Index: xen-3.3.1-testing/xen/include/asm-x86/domain.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/domain.h
+++ xen-3.3.1-testing/xen/include/asm-x86/domain.h
@@ -235,7 +235,7 @@ struct arch_domain
/* Shadow translated domain: P2M mapping */
pagetable_t phys_table;
@ -726,8 +744,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
int vector_pirq[NR_VECTORS];
int pirq_vector[NR_PIRQS];
--- a/xen/include/asm-x86/hvm/irq.h
+++ b/xen/include/asm-x86/hvm/irq.h
Index: xen-3.3.1-testing/xen/include/asm-x86/hvm/irq.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/hvm/irq.h
+++ xen-3.3.1-testing/xen/include/asm-x86/hvm/irq.h
@@ -63,7 +63,7 @@ struct hvm_girq_dpci_mapping {
#define NR_ISAIRQS 16
@ -737,8 +757,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
struct hvm_irq_dpci {
/* Machine IRQ to guest device/intx mapping. */
DECLARE_BITMAP(mapping, NR_PIRQS);
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
Index: xen-3.3.1-testing/xen/include/xen/sched.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/xen/sched.h
+++ xen-3.3.1-testing/xen/include/xen/sched.h
@@ -188,7 +188,7 @@ struct domain
/* Event channel information. */
@ -748,8 +770,10 @@ Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
struct grant_table *grant_table;
--- a/xen/xsm/acm/acm_simple_type_enforcement_hooks.c
+++ b/xen/xsm/acm/acm_simple_type_enforcement_hooks.c
Index: xen-3.3.1-testing/xen/xsm/acm/acm_simple_type_enforcement_hooks.c
===================================================================
--- xen-3.3.1-testing.orig/xen/xsm/acm/acm_simple_type_enforcement_hooks.c
+++ xen-3.3.1-testing/xen/xsm/acm/acm_simple_type_enforcement_hooks.c
@@ -248,11 +248,11 @@ ste_init_state(struct acm_sized_buffer *
/* a) check for event channel conflicts */
for ( bucket = 0; bucket < NR_EVTCHN_BUCKETS; bucket++ )

View File

@ -1,117 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1224068295 -3600
# Node ID 61218a1763da340e6fbf5a153255ad723c254661
# Parent 8c3144b1ff631fd33489dbc1e7ee0e2cc3594ecd
vt-d: Fix MSI-x interrupt remapping
MSI-x may have multiple vectors, however in current interrupt
remapping code, one device only has one entry in interrupt remapping
table.
This patch adds 'remap_index' in msi_desc structure to track its index
in interrupt remapping table.
Signed-off-by: Haitao Shan <haitao.shan@intel.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -364,6 +364,7 @@ static struct msi_desc* alloc_msi_entry(
INIT_LIST_HEAD(&entry->list);
entry->dev = NULL;
+ entry->remap_index = -1;
return entry;
}
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -328,7 +328,8 @@ static int remap_entry_to_msi_msg(
}
static int msi_msg_to_remap_entry(
- struct iommu *iommu, struct pci_dev *pdev, struct msi_msg *msg)
+ struct iommu *iommu, struct pci_dev *pdev,
+ struct msi_desc *msi_desc, struct msi_msg *msg)
{
struct iremap_entry *iremap_entry = NULL, *iremap_entries;
struct iremap_entry new_ire;
@@ -336,32 +337,18 @@ static int msi_msg_to_remap_entry(
unsigned int index;
unsigned long flags;
struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu);
- int i = 0;
remap_rte = (struct msi_msg_remap_entry *) msg;
spin_lock_irqsave(&ir_ctrl->iremap_lock, flags);
- iremap_entries =
- (struct iremap_entry *)map_vtd_domain_page(ir_ctrl->iremap_maddr);
-
- /* If the entry for a PCI device has been there, use the old entry,
- * Or, assign a new entry for it.
- */
- for ( i = 0; i <= ir_ctrl->iremap_index; i++ )
+ if ( msi_desc->remap_index < 0 )
{
- iremap_entry = &iremap_entries[i];
- if ( iremap_entry->hi.sid ==
- ((pdev->bus << 8) | pdev->devfn) )
- break;
- }
-
- if ( i > ir_ctrl->iremap_index )
- {
- ir_ctrl->iremap_index++;
+ ir_ctrl->iremap_index++;
index = ir_ctrl->iremap_index;
+ msi_desc->remap_index = index;
}
else
- index = i;
+ index = msi_desc->remap_index;
if ( index > IREMAP_ENTRY_NR - 1 )
{
@@ -369,11 +356,13 @@ static int msi_msg_to_remap_entry(
"%s: intremap index (%d) is larger than"
" the maximum index (%ld)!\n",
__func__, index, IREMAP_ENTRY_NR - 1);
- unmap_vtd_domain_page(iremap_entries);
+ msi_desc->remap_index = -1;
spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags);
return -EFAULT;
}
+ iremap_entries =
+ (struct iremap_entry *)map_vtd_domain_page(ir_ctrl->iremap_maddr);
iremap_entry = &iremap_entries[index];
memcpy(&new_ire, iremap_entry, sizeof(struct iremap_entry));
@@ -450,7 +439,7 @@ void msi_msg_write_remap_rte(
if ( !iommu || !ir_ctrl || ir_ctrl->iremap_maddr == 0 )
return;
- msi_msg_to_remap_entry(iommu, pdev, msg);
+ msi_msg_to_remap_entry(iommu, pdev, msi_desc, msg);
}
int intremap_setup(struct iommu *iommu)
--- a/xen/include/asm-x86/msi.h
+++ b/xen/include/asm-x86/msi.h
@@ -90,10 +90,11 @@ struct msi_desc {
void __iomem *mask_base;
struct pci_dev *dev;
- int vector;
+ int vector;
- /* Last set MSI message */
- struct msi_msg msg;
+ struct msi_msg msg; /* Last set MSI message */
+
+ int remap_index; /* index in interrupt remapping table */
};
/*

72
18637-vmx-set-dr7.patch Normal file
View File

@ -0,0 +1,72 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1224147160 -3600
# Node ID 98ff908a91b7e12d7ddc609853fa1237d1714dec
# Parent 819ab49deef1da3042d2c111d6c99c3de535dae0
vmx: set DR7 via DOMCTL_setvcpucontext
This patch is needed for a guest domain debugger
to support hardware watchpoint.
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -575,7 +575,10 @@ int arch_set_info_guest(
v->arch.guest_context.user_regs.eflags |= 2;
if ( is_hvm_vcpu(v) )
+ {
+ hvm_set_info_guest(v);
goto out;
+ }
/* Only CR0.TS is modifiable by guest or admin. */
v->arch.guest_context.ctrlreg[0] &= X86_CR0_TS;
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1184,6 +1184,13 @@ static void vmx_set_uc_mode(struct vcpu
vpid_sync_all();
}
+static void vmx_set_info_guest(struct vcpu *v)
+{
+ vmx_vmcs_enter(v);
+ __vmwrite(GUEST_DR7, v->arch.guest_context.debugreg[7]);
+ vmx_vmcs_exit(v);
+}
+
static struct hvm_function_table vmx_function_table = {
.name = "VMX",
.domain_initialise = vmx_domain_initialise,
@@ -1214,7 +1221,8 @@ static struct hvm_function_table vmx_fun
.msr_read_intercept = vmx_msr_read_intercept,
.msr_write_intercept = vmx_msr_write_intercept,
.invlpg_intercept = vmx_invlpg_intercept,
- .set_uc_mode = vmx_set_uc_mode
+ .set_uc_mode = vmx_set_uc_mode,
+ .set_info_guest = vmx_set_info_guest
};
static unsigned long *vpid_bitmap;
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -128,6 +128,7 @@ struct hvm_function_table {
int (*msr_write_intercept)(struct cpu_user_regs *regs);
void (*invlpg_intercept)(unsigned long vaddr);
void (*set_uc_mode)(struct vcpu *v);
+ void (*set_info_guest)(struct vcpu *v);
};
extern struct hvm_function_table hvm_funcs;
@@ -311,4 +312,10 @@ int hvm_virtual_to_linear_addr(
unsigned int addr_size,
unsigned long *linear_addr);
+static inline void hvm_set_info_guest(struct vcpu *v)
+{
+ if ( hvm_funcs.set_info_guest )
+ return hvm_funcs.set_info_guest(v);
+}
+
#endif /* __ASM_X86_HVM_HVM_H__ */

View File

@ -1,3 +1,17 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1224512379 -3600
# Node ID 2a25fd94c6f207d5b9066a1d765697a5a680fc42
# Parent bf84c03c38eebc527786e96af4178f114a5bea41
VT-d: correct allocation failure checks
Checking the return value of map_domain_page() (and hence
map_vtd_domain_page()) against NULL is pointless, checking the return
value of alloc_domheap_page() (and thus alloc_pgtable_maddr()) is
mandatory, however.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -458,7 +458,7 @@ int intremap_setup(struct iommu *iommu)

View File

@ -0,0 +1,50 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1224519405 -3600
# Node ID 54d74fc0037ce688e79759ca632d3918f7aaa399
# Parent f4dab783b58b41f2c67a66d6d095887faec3c296
spinlock: Modify recursive spinlock definitions to support up to 4095 CPUs.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
--- a/xen/include/asm-x86/spinlock.h
+++ b/xen/include/asm-x86/spinlock.h
@@ -8,11 +8,11 @@
typedef struct {
volatile s16 lock;
- s8 recurse_cpu;
- u8 recurse_cnt;
+ u16 recurse_cpu:12;
+ u16 recurse_cnt:4;
} spinlock_t;
-#define SPIN_LOCK_UNLOCKED /*(spinlock_t)*/ { 1, -1, 0 }
+#define SPIN_LOCK_UNLOCKED { 1, 0xfffu, 0 }
#define spin_lock_init(x) do { *(x) = (spinlock_t) SPIN_LOCK_UNLOCKED; } while(0)
#define spin_is_locked(x) (*(volatile char *)(&(x)->lock) <= 0)
@@ -59,11 +59,15 @@ static inline int _raw_spin_trylock(spin
#define _raw_spin_lock_recursive(_lock) \
do { \
int cpu = smp_processor_id(); \
+ /* Don't allow overflow of recurse_cpu field. */ \
+ BUILD_BUG_ON(NR_CPUS > 0xfffu); \
if ( likely((_lock)->recurse_cpu != cpu) ) \
{ \
spin_lock(_lock); \
(_lock)->recurse_cpu = cpu; \
} \
+ /* We support only fairly shallow recursion, else the counter overflows. */ \
+ ASSERT((_lock)->recurse_cnt < 0xfu); \
(_lock)->recurse_cnt++; \
} while ( 0 )
@@ -71,7 +75,7 @@ static inline int _raw_spin_trylock(spin
do { \
if ( likely(--(_lock)->recurse_cnt == 0) ) \
{ \
- (_lock)->recurse_cpu = -1; \
+ (_lock)->recurse_cpu = 0xfffu; \
spin_unlock(_lock); \
} \
} while ( 0 )

View File

@ -0,0 +1,99 @@
Index: xen-3.3.1-testing/tools/python/xen/xend/server/iopif.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xend/server/iopif.py
+++ xen-3.3.1-testing/tools/python/xen/xend/server/iopif.py
@@ -45,9 +45,22 @@ def parse_ioport(val):
class IOPortsController(DevController):
+ valid_cfg = ['to', 'from', 'uuid']
+
def __init__(self, vm):
DevController.__init__(self, vm)
+ def getDeviceConfiguration(self, devid, transaction = None):
+ result = DevController.getDeviceConfiguration(self, devid, transaction)
+ if transaction is None:
+ devinfo = self.readBackend(devid, *self.valid_cfg)
+ else:
+ devinfo = self.readBackendTxn(transaction, devid, *self.valid_cfg)
+ config = dict(zip(self.valid_cfg, devinfo))
+ config = dict([(key, val) for key, val in config.items()
+ if val != None])
+ return config
+
def getDeviceDetails(self, config):
"""@see DevController.getDeviceDetails"""
@@ -81,4 +94,9 @@ class IOPortsController(DevController):
'ioports: Failed to configure legacy i/o range: %s - %s' %
(io_from, io_to))
- return (None, {}, {})
+ back = dict([(k, config[k]) for k in self.valid_cfg if k in config])
+ return (self.allocateDeviceID(), back, {})
+
+ def waitForDevice(self, devid):
+ # don't wait for hotplug
+ return
Index: xen-3.3.1-testing/tools/python/xen/xend/server/irqif.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xend/server/irqif.py
+++ xen-3.3.1-testing/tools/python/xen/xend/server/irqif.py
@@ -39,6 +39,18 @@ class IRQController(DevController):
def __init__(self, vm):
DevController.__init__(self, vm)
+ valid_cfg = ['irq', 'uuid']
+
+ def getDeviceConfiguration(self, devid, transaction = None):
+ result = DevController.getDeviceConfiguration(self, devid, transaction)
+ if transaction is None:
+ devinfo = self.readBackend(devid, *self.valid_cfg)
+ else:
+ devinfo = self.readBackendTxn(transaction, devid, *self.valid_cfg)
+ config = dict(zip(self.valid_cfg, devinfo))
+ config = dict([(key, val) for key, val in config.items()
+ if val != None])
+ return config
def getDeviceDetails(self, config):
"""@see DevController.getDeviceDetails"""
@@ -75,4 +87,9 @@ class IRQController(DevController):
if rc < 0:
raise VmError(
'irq: Failed to map irq %x' % (pirq))
- return (None, {}, {})
+ back = dict([(k, config[k]) for k in self.valid_cfg if k in config])
+ return (self.allocateDeviceID(), back, {})
+
+ def waitForDevice(self, devid):
+ # don't wait for hotplug
+ return
Index: xen-3.3.1-testing/tools/python/xen/xm/create.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xm/create.py
+++ xen-3.3.1-testing/tools/python/xen/xm/create.py
@@ -1032,6 +1032,14 @@ def preprocess_ioports(vals):
ioports.append(hexd)
vals.ioports = ioports
+def preprocess_irq(vals):
+ if not vals.irq: return
+ irq = []
+ for v in vals.irq:
+ d = repr(v)
+ irq.append(d)
+ vals.irq = irq
+
def preprocess_vtpm(vals):
if not vals.vtpm: return
vtpms = []
@@ -1162,6 +1170,7 @@ def preprocess(vals):
preprocess_vscsi(vals)
preprocess_ioports(vals)
preprocess_ip(vals)
+ preprocess_irq(vals)
preprocess_nfs(vals)
preprocess_vnc(vals)
preprocess_vtpm(vals)

View File

@ -2,19 +2,52 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/blktapctrl.c
===================================================================
--- xen-3.3.1-testing.orig/tools/blktap/drivers/blktapctrl.c
+++ xen-3.3.1-testing/tools/blktap/drivers/blktapctrl.c
@@ -245,8 +245,15 @@ static int del_disktype(blkif_t *blkif)
@@ -221,6 +221,28 @@ static void add_disktype(blkif_t *blkif,
entry->pprev = pprev;
}
+static int qemu_instance_has_disks(int domid)
+{
+ int i;
+ int count = 0;
+ driver_list_entry_t *entry;
+
+ for (i = 0; i < MAX_DISK_TYPES; i++) {
+ entry = active_disks[i];
+ while (entry) {
+#ifdef ALWAYS_USE_IOEMU
+ if (entry->blkif->domid == domid)
+#else
+ if ((entry->blkif->domid == domid) && dtypes[i]->use_ioemu)
+#endif
+ count++;
+ entry = entry->next;
+ }
+ }
+
+ return (count != 0);
+}
+
static int del_disktype(blkif_t *blkif)
{
driver_list_entry_t *entry, **pprev;
@@ -245,8 +267,20 @@ static int del_disktype(blkif_t *blkif)
DPRINTF("DEL_DISKTYPE: Freeing entry\n");
free(entry);
+#ifdef ALWAYS_USE_IOEMU
+ return 0;
+ return !qemu_instance_has_disks(blkif->domid);
+#else
+ /*
+ * When using ioemu, all disks of one VM are connected to the same
+ * qemu-dm instance. We may close the file handle only if there is
+ * no other disk left for this domain.
+ */
+ if (dtypes[type]->use_ioemu)
+ return !qemu_instance_has_disks(blkif->domid);
+
/* Caller should close() if no single controller, or list is empty. */
- return (!dtypes[type]->single_handler || (active_disks[type] == NULL));
+ /* tapdisk-ioemu is a single controller regardless of single_hander
+ (TODO: This needs to be per-domain in fact) */
+ return ((!dtypes[type]->single_handler && !dtypes[type]->use_ioemu)
+ || (active_disks[type] == NULL));
return (!dtypes[type]->single_handler || (active_disks[type] == NULL));
+#endif
}

25
dom-print.patch Normal file
View File

@ -0,0 +1,25 @@
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -135,7 +135,7 @@ void dump_pageframe_info(struct domain *
printk("Memory pages belonging to domain %u:\n", d->domain_id);
- if ( d->tot_pages >= 10 )
+ if ( d->tot_pages >= 10 && d->is_dying < DOMDYING_dead )
{
printk(" DomPage list too long to display\n");
}
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -192,9 +192,9 @@ static void dump_domains(unsigned char k
{
printk("General information for domain %u:\n", d->domain_id);
cpuset_print(tmpstr, sizeof(tmpstr), d->domain_dirty_cpumask);
- printk(" refcnt=%d nr_pages=%d xenheap_pages=%d "
+ printk(" refcnt=%d dying=%d nr_pages=%d xenheap_pages=%d "
"dirty_cpus=%s\n",
- atomic_read(&d->refcnt),
+ atomic_read(&d->refcnt), d->is_dying,
d->tot_pages, d->xenheap_pages, tmpstr);
printk(" handle=%02x%02x%02x%02x-%02x%02x-%02x%02x-"
"%02x%02x-%02x%02x%02x%02x%02x%02x vm_assist=%08lx\n",

View File

@ -42,7 +42,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
hvm_funcs.domain_destroy(d);
rtc_deinit(d);
stdvga_deinit(d);
@@ -645,8 +647,14 @@ int hvm_vcpu_initialise(struct vcpu *v)
@@ -644,8 +646,14 @@ int hvm_vcpu_initialise(struct vcpu *v)
{
int rc;
@ -57,7 +57,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
if ( (rc = hvm_funcs.vcpu_initialise(v)) != 0 )
goto fail2;
@@ -693,12 +701,14 @@ int hvm_vcpu_initialise(struct vcpu *v)
@@ -692,12 +700,14 @@ int hvm_vcpu_initialise(struct vcpu *v)
hvm_funcs.vcpu_destroy(v);
fail2:
vlapic_destroy(v);
@ -72,7 +72,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
hvm_vcpu_cacheattr_destroy(v);
vlapic_destroy(v);
hvm_funcs.vcpu_destroy(v);
@@ -1647,7 +1657,7 @@ void hvm_cpuid(unsigned int input, unsig
@@ -1645,7 +1655,7 @@ void hvm_cpuid(unsigned int input, unsig
struct vcpu *v = current;
if ( cpuid_hypervisor_leaves(input, eax, ebx, ecx, edx) )
@ -81,7 +81,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
domain_cpuid(v->domain, input, *ecx, eax, ebx, ecx, edx);
@@ -1659,6 +1669,8 @@ void hvm_cpuid(unsigned int input, unsig
@@ -1657,6 +1667,8 @@ void hvm_cpuid(unsigned int input, unsig
if ( vlapic_hw_disabled(vcpu_vlapic(v)) )
__clear_bit(X86_FEATURE_APIC & 31, edx);
}
@ -90,7 +90,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
}
void hvm_rdtsc_intercept(struct cpu_user_regs *regs)
@@ -1749,6 +1761,8 @@ int hvm_msr_read_intercept(struct cpu_us
@@ -1747,6 +1759,8 @@ int hvm_msr_read_intercept(struct cpu_us
break;
default:
@ -99,7 +99,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
return hvm_funcs.msr_read_intercept(regs);
}
@@ -1837,6 +1851,8 @@ int hvm_msr_write_intercept(struct cpu_u
@@ -1835,6 +1849,8 @@ int hvm_msr_write_intercept(struct cpu_u
break;
default:
@ -108,7 +108,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
return hvm_funcs.msr_write_intercept(regs);
}
@@ -1963,6 +1979,10 @@ int hvm_do_hypercall(struct cpu_user_reg
@@ -1961,6 +1977,10 @@ int hvm_do_hypercall(struct cpu_user_reg
case 0:
break;
}
@ -119,7 +119,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
if ( (eax >= NR_hypercalls) || !hvm_hypercall32_table[eax] )
{
@@ -2464,6 +2484,15 @@ long do_hvm_op(unsigned long op, XEN_GUE
@@ -2462,6 +2482,15 @@ long do_hvm_op(unsigned long op, XEN_GUE
rc = -EINVAL;
break;

View File

@ -1,5 +1,9 @@
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
-unstable staging c/s 18724
Index: xen-3.3.1-testing/xen/arch/x86/mm.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/mm.c
+++ xen-3.3.1-testing/xen/arch/x86/mm.c
@@ -2431,6 +2431,29 @@ static inline cpumask_t vcpumask_to_pcpu
return pmask;
}
@ -97,8 +101,10 @@
default:
MEM_LOG("Invalid extended pt command 0x%x", op.cmd);
rc = -ENOSYS;
--- a/xen/arch/x86/x86_32/domain_page.c
+++ b/xen/arch/x86/x86_32/domain_page.c
Index: xen-3.3.1-testing/xen/arch/x86/x86_32/domain_page.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/x86_32/domain_page.c
+++ xen-3.3.1-testing/xen/arch/x86/x86_32/domain_page.c
@@ -114,7 +114,7 @@ void *map_domain_page(unsigned long mfn)
return (void *)va;
}
@ -117,8 +123,10 @@
{
unsigned long __va = (unsigned long)va;
l2_pgentry_t *pl2e;
--- a/xen/arch/x86/x86_64/compat/mm.c
+++ b/xen/arch/x86/x86_64/compat/mm.c
Index: xen-3.3.1-testing/xen/arch/x86/x86_64/compat/mm.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/x86_64/compat/mm.c
+++ xen-3.3.1-testing/xen/arch/x86/x86_64/compat/mm.c
@@ -217,6 +217,8 @@ int compat_mmuext_op(XEN_GUEST_HANDLE(mm
case MMUEXT_PIN_L4_TABLE:
case MMUEXT_UNPIN_TABLE:
@ -138,8 +146,10 @@
default:
arg2 = -1;
break;
--- a/xen/include/asm-x86/fixmap.h
+++ b/xen/include/asm-x86/fixmap.h
Index: xen-3.3.1-testing/xen/include/asm-x86/fixmap.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/fixmap.h
+++ xen-3.3.1-testing/xen/include/asm-x86/fixmap.h
@@ -29,6 +29,7 @@
* from the end of virtual memory backwards.
*/
@ -148,8 +158,24 @@
#ifdef __i386__
FIX_PAE_HIGHMEM_0,
FIX_PAE_HIGHMEM_END = FIX_PAE_HIGHMEM_0 + NR_CPUS-1,
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
Index: xen-3.3.1-testing/xen/include/public/features.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/public/features.h
+++ xen-3.3.1-testing/xen/include/public/features.h
@@ -65,6 +65,9 @@
*/
#define XENFEAT_gnttab_map_avail_bits 7
+/* x86: Does this Xen host support the MMU_{CLEAR,COPY}_PAGE hypercall? */
+#define XENFEAT_highmem_assist 6
+
#define XENFEAT_NR_SUBMAPS 1
#endif /* __XEN_PUBLIC_FEATURES_H__ */
Index: xen-3.3.1-testing/xen/include/public/xen.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/public/xen.h
+++ xen-3.3.1-testing/xen/include/public/xen.h
@@ -231,6 +231,13 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
* cmd: MMUEXT_SET_LDT
* linear_addr: Linear address of LDT base (NB. must be page-aligned).
@ -190,8 +216,10 @@
} arg2;
};
typedef struct mmuext_op mmuext_op_t;
--- a/xen/include/xen/domain_page.h
+++ b/xen/include/xen/domain_page.h
Index: xen-3.3.1-testing/xen/include/xen/domain_page.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/xen/domain_page.h
+++ xen-3.3.1-testing/xen/include/xen/domain_page.h
@@ -24,7 +24,7 @@ void *map_domain_page(unsigned long mfn)
* Pass a VA within a page previously mapped in the context of the
* currently-executing VCPU via a call to map_domain_page().

View File

@ -0,0 +1,109 @@
Index: xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.c
===================================================================
--- xen-3.3.1-testing.orig/tools/ioemu-remote/hw/xen_blktap.c
+++ xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.c
@@ -67,6 +67,7 @@ int read_fd;
int write_fd;
static pid_t process;
+int connected_disks = 0;
fd_list_entry_t *fd_start = NULL;
extern char* get_snapshot_name(int devid);
@@ -260,6 +261,12 @@ static int open_disk(struct td_state *s,
s->size = bs->total_sectors;
s->sector_size = 512;
+ if (s->size == 0) {
+ fprintf(stderr, "Error: Disk image %s is too small\n",
+ path);
+ return -ENOMEM;
+ }
+
s->info = ((s->flags & TD_RDONLY) ? VDISK_READONLY : 0);
#ifndef QEMU_TOOL
@@ -563,6 +570,7 @@ static void handle_blktap_ctrlmsg(void*
/* Allocate the disk structs */
s = state_init();
+ connected_disks++;
/*Open file*/
if (s == NULL || open_disk(s, path, msg->drivertype, msg->readonly)) {
@@ -624,7 +632,8 @@ static void handle_blktap_ctrlmsg(void*
case CTLMSG_CLOSE:
s = get_state(msg->cookie);
if (s) unmap_disk(s);
- break;
+ connected_disks--;
+ break;
case CTLMSG_PID:
memset(buf, 0x00, MSG_SIZE);
Index: xen-3.3.1-testing/tools/ioemu-remote/tapdisk-ioemu.c
===================================================================
--- xen-3.3.1-testing.orig/tools/ioemu-remote/tapdisk-ioemu.c
+++ xen-3.3.1-testing/tools/ioemu-remote/tapdisk-ioemu.c
@@ -18,6 +18,7 @@ extern void *qemu_mallocz(size_t size);
extern void qemu_free(void *ptr);
extern void *fd_start;
+extern int connected_disks;
int domid = 0;
FILE* logfile;
@@ -98,7 +99,7 @@ int main(void)
int max_fd;
fd_set rfds;
struct timeval tv;
- void *old_fd_start = NULL;
+ int old_connected_disks = 0;
/* Daemonize */
if (fork() != 0)
@@ -153,11 +154,17 @@ int main(void)
pioh = &ioh->next;
}
+ if (old_connected_disks != connected_disks)
+ fprintf(stderr, "connected disks: %d => %d\n",
+ old_connected_disks, connected_disks);
+
/* Exit when the last image has been closed */
- if (old_fd_start != NULL && fd_start == NULL)
+ if (old_connected_disks != 0 && connected_disks == 0) {
+ fprintf(stderr, "Last image is closed, exiting.\n");
exit(0);
+ }
- old_fd_start = fd_start;
+ old_connected_disks = connected_disks;
}
return 0;
}
Index: xen-3.3.1-testing/tools/examples/blktap
===================================================================
--- xen-3.3.1-testing.orig/tools/examples/blktap
+++ xen-3.3.1-testing/tools/examples/blktap
@@ -75,6 +75,7 @@ fi
if [ "$command" = 'add' ]
then
[ -e "$file" ] || { fatal $file does not exist; }
+ [ $(stat --format="%s" "$file") -ge 512 ] || { fatal $file is too small; }
FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id")
FRONTEND_UUID=$(xenstore_read "/local/domain/$FRONTEND_ID/vm")
Index: xen-3.3.1-testing/tools/python/xen/xend/server/DevController.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xend/server/DevController.py
+++ xen-3.3.1-testing/tools/python/xen/xend/server/DevController.py
@@ -182,7 +182,7 @@ class DevController:
(devid, self.deviceClass))
elif status == Error:
- self.destroyDevice(devid, False)
+ self.destroyDevice(devid, True)
if err is None:
raise VmError("Device %s (%s) could not be connected. "
"Backend device not found." %

View File

@ -1,8 +1,8 @@
Index: xen-3.3.1-testing/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c
===================================================================
--- xen-3.3.1-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c 2008-10-15 11:38:53.000000000 -0600
+++ xen-3.3.1-testing/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c 2008-10-15 11:49:33.000000000 -0600
@@ -14,7 +14,11 @@
--- xen-3.3.1-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c
+++ xen-3.3.1-testing/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c
@@ -14,7 +14,11 @@ EXPORT_SYMBOL(system_state);
void ctrl_alt_del(void)
{
@ -17,9 +17,9 @@ Index: xen-3.3.1-testing/unmodified_drivers/linux-2.6/platform-pci/platform-comp
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)
Index: xen-3.3.1-testing/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c
===================================================================
--- xen-3.3.1-testing.orig/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c 2008-10-15 11:38:53.000000000 -0600
+++ xen-3.3.1-testing/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c 2008-10-15 11:39:04.000000000 -0600
@@ -44,7 +44,11 @@
--- xen-3.3.1-testing.orig/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c
+++ xen-3.3.1-testing/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c
@@ -34,7 +34,11 @@ static void ap_suspend(void *_info)
atomic_dec(&info->nr_spinning);
}

View File

@ -2,12 +2,15 @@ Index: xen-3.3.1-testing/tools/python/xen/util/acmpolicy.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/util/acmpolicy.py
+++ xen-3.3.1-testing/tools/python/xen/util/acmpolicy.py
@@ -17,7 +17,7 @@
@@ -17,7 +17,10 @@
#============================================================================
import os
-import sha
+import hashlib
+try:
+ import hashlib # python v2.6 or newer
+except ImportError:
+ import sha # python v2.5 or older
import stat
import array
import struct

View File

@ -90,7 +90,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendCheckpoint.py
if node > -1:
insert_after(sxprep,'vcpus',['node', str(node)])
@@ -91,52 +93,58 @@ def save(fd, dominfo, network, live, dst
@@ -91,52 +93,60 @@ def save(fd, dominfo, network, live, dst
image_cfg = dominfo.info.get('image', {})
hvm = dominfo.info.is_hvm()
@ -164,6 +164,8 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendCheckpoint.py
+ log.info("Domain %d suspended.", dominfo.getDomid())
+ dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP3,
+ domain_name)
+ if name:
+ dominfo.image.snapshotDeviceModel(name)
+ if hvm:
+ dominfo.image.saveDeviceModel()
+
@ -195,20 +197,24 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendCheckpoint.py
if checkpoint:
dominfo.resumeDomain()
@@ -193,6 +201,59 @@ def restore(xd, fd, dominfo = None, paus
@@ -193,6 +203,63 @@ def restore(xd, fd, dominfo = None, paus
if othervm is not None and othervm.domid is not None:
raise VmError("Domain '%s' already exists with ID '%d'" % (domconfig["name_label"], othervm.domid))
+ def contains_state(fd):
+ cur = os.lseek(fd, 0, 1)
+ end = os.lseek(fd, 0, 2)
+ try:
+ cur = os.lseek(fd, 0, 1)
+ end = os.lseek(fd, 0, 2)
+
+ ret = False
+ if cur < end:
+ ret = True
+ ret = False
+ if cur < end:
+ ret = True
+
+ os.lseek(fd, cur, 0)
+ return ret
+ os.lseek(fd, cur, 0)
+ return ret
+ except OSError, (errno, strerr):
+ # lseek failed <==> socket <==> state
+ return True
+
+ #
+ # We shouldn't hold the domains_lock over a waitForDevices
@ -255,7 +261,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendCheckpoint.py
if dominfo:
dominfo.resume()
else:
@@ -308,27 +369,8 @@ def restore(xd, fd, dominfo = None, paus
@@ -308,27 +375,8 @@ def restore(xd, fd, dominfo = None, paus
dominfo.completeRestore(handler.store_mfn, handler.console_mfn)

View File

@ -1,87 +0,0 @@
Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/hvm/hvm.c
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
@@ -525,11 +525,12 @@ static int hvm_load_cpu_ctxt(struct doma
return -EINVAL;
}
- if ( (ctxt.msr_efer & ~(EFER_FFXSE | EFER_LME | EFER_LMA |
+ if ( (ctxt.msr_efer & ~(EFER_FFXSE | EFER_LMSLE | EFER_LME | EFER_LMA |
EFER_NX | EFER_SCE)) ||
((sizeof(long) != 8) && (ctxt.msr_efer & EFER_LME)) ||
(!cpu_has_nx && (ctxt.msr_efer & EFER_NX)) ||
(!cpu_has_syscall && (ctxt.msr_efer & EFER_SCE)) ||
+ (!cpu_has_lmsl && (ctxt.msr_efer & EFER_LMSLE)) ||
(!cpu_has_ffxsr && (ctxt.msr_efer & EFER_FFXSE)) ||
((ctxt.msr_efer & (EFER_LME|EFER_LMA)) == EFER_LMA) )
{
@@ -790,10 +791,11 @@ int hvm_set_efer(uint64_t value)
value &= ~EFER_LMA;
- if ( (value & ~(EFER_FFXSE | EFER_LME | EFER_NX | EFER_SCE)) ||
+ if ( (value & ~(EFER_FFXSE | EFER_LMSLE | EFER_LME | EFER_NX | EFER_SCE)) ||
((sizeof(long) != 8) && (value & EFER_LME)) ||
(!cpu_has_nx && (value & EFER_NX)) ||
(!cpu_has_syscall && (value & EFER_SCE)) ||
+ (!cpu_has_lmsl && (value & EFER_LMSLE)) ||
(!cpu_has_ffxsr && (value & EFER_FFXSE)) )
{
gdprintk(XENLOG_WARNING, "Trying to set reserved bit in "
Index: xen-3.3.1-testing/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/hvm/svm/svm.c
+++ xen-3.3.1-testing/xen/arch/x86/hvm/svm/svm.c
@@ -53,6 +53,11 @@
u32 svm_feature_flags;
+#ifdef __x86_64__
+/* indicate whether guest may use EFER.LMSLE */
+unsigned char cpu_has_lmsl = 0;
+#endif
+
#define set_segment_register(name, value) \
asm volatile ( "movw %%ax ,%%" STR(name) "" : : "a" (value) )
@@ -853,6 +858,22 @@ int start_svm(struct cpuinfo_x86 *c)
/* Initialize core's ASID handling. */
svm_asid_init(c);
+#ifdef __x86_64__
+ /*
+ * Check whether EFER.LMSLE can be written.
+ * Unfortunately there's no feature bit defined for this.
+ */
+ eax = read_efer();
+ edx = read_efer() >> 32;
+ if ( wrmsr_safe(MSR_EFER, eax | EFER_LMSLE, edx) == 0 )
+ rdmsr(MSR_EFER, eax, edx);
+ if ( eax & EFER_LMSLE )
+ {
+ cpu_has_lmsl = 1;
+ wrmsr(MSR_EFER, eax ^ EFER_LMSLE, edx);
+ }
+#endif
+
if ( cpu != 0 )
return 1;
Index: xen-3.3.1-testing/xen/include/asm-x86/hvm/hvm.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/hvm/hvm.h
+++ xen-3.3.1-testing/xen/include/asm-x86/hvm/hvm.h
@@ -133,6 +133,12 @@ struct hvm_function_table {
extern struct hvm_function_table hvm_funcs;
extern int hvm_enabled;
+#ifdef __i386__
+# define cpu_has_lmsl 0
+#else
+extern unsigned char cpu_has_lmsl;
+#endif
+
int hvm_domain_initialise(struct domain *d);
void hvm_domain_relinquish_resources(struct domain *d);
void hvm_domain_destroy(struct domain *d);

View File

@ -72,7 +72,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/powernow.c
perf = data->acpi_data;
policy->shared_type = perf->shared_type;
@@ -257,8 +254,8 @@ int powernow_cpufreq_init(void)
@@ -271,8 +268,8 @@ int powernow_cpufreq_init(void)
}
if (ret)
return ret;
@ -83,7 +83,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/powernow.c
}
max_dom++;
@@ -274,13 +271,13 @@ int powernow_cpufreq_init(void)
@@ -288,13 +285,13 @@ int powernow_cpufreq_init(void)
/* get cpumask of each psd domain */
for_each_online_cpu(i) {
@ -114,7 +114,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/utility.c
uint64_t total_idle_ns;
uint64_t tmp_idle_ns;
+ if ( !pxpt )
+ if ( !pxpt || !pxpt->u.pt )
+ continue;
total_idle_ns = get_cpu_idle_time(cpu);
tmp_idle_ns = total_idle_ns - pxpt->prev_idle_wall;
@ -142,7 +142,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/utility.c
uint64_t total_idle_ns;
uint64_t tmp_idle_ns;
+ if ( !pxpt || !pmpt )
+ if ( !pxpt || !pxpt->u.pt || !pxpt->u.trans_pt || !pmpt )
+ continue;
+
total_idle_ns = get_cpu_idle_time(i);
@ -165,12 +165,12 @@ Index: xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/utility.c
- struct processor_pminfo *pmpt = &processor_pminfo[cpuid];
+ struct pm_px *pxpt = px_statistic_data[cpuid];
+ const struct processor_pminfo *pmpt = processor_pminfo[cpuid];
+
+ if ( !pmpt )
+ return -EINVAL;
count = pmpt->perf.state_count;
+ if ( !pmpt )
+ return -EINVAL;
+
+ if ( !pxpt )
+ {
+ pxpt = xmalloc(struct pm_px);
@ -192,7 +192,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/utility.c
+ const struct processor_pminfo *pmpt = processor_pminfo[cpuid];
- count = processor_pminfo[cpuid].perf.state_count;
+ if ( !pxpt || !pmpt )
+ if ( !pxpt || !pxpt->u.pt || !pxpt->u.trans_pt || !pmpt )
+ return;
+
+ count = pmpt->perf.state_count;
@ -336,43 +336,24 @@ Index: xen-3.3.1-testing/xen/arch/x86/acpi/pmstat.c
extern uint32_t pmstat_get_cx_nr(uint32_t cpuid);
extern int pmstat_get_cx_stat(uint32_t cpuid, struct pm_cx_stat *stat);
@@ -50,13 +50,14 @@ extern int pmstat_reset_cx_stat(uint32_t
int do_get_pm_info(struct xen_sysctl_get_pmstat *op)
{
int ret = 0;
- struct pm_px *pxpt = &px_statistic_data[op->cpuid];
- struct processor_pminfo *pmpt = &processor_pminfo[op->cpuid];
+ struct processor_pminfo *pmpt;
/* to protect the case when Px was not controlled by xen */
if ( (op->cpuid >= NR_CPUS) || !cpu_online(op->cpuid) )
@@ -55,7 +55,7 @@ int do_get_pm_info(struct xen_sysctl_get
if ( !op || (op->cpuid >= NR_CPUS) || !cpu_online(op->cpuid) )
return -EINVAL;
- pmpt = &processor_pminfo[op->cpuid];
+ pmpt = processor_pminfo[op->cpuid];
+
switch ( op->type & PMSTAT_CATEGORY_MASK )
{
case PMSTAT_CX:
@@ -66,7 +67,7 @@ int do_get_pm_info(struct xen_sysctl_get
case PMSTAT_PX:
if ( !(xen_processor_pmbits & XEN_PROCESSOR_PM_PX) )
return -ENODEV;
- if ( !(pmpt->perf.init & XEN_PX_INIT) )
+ if ( !pmpt || !(pmpt->perf.init & XEN_PX_INIT) )
return -EINVAL;
break;
default:
@@ -86,6 +87,10 @@ int do_get_pm_info(struct xen_sysctl_get
@@ -86,7 +86,7 @@ int do_get_pm_info(struct xen_sysctl_get
uint64_t now, ct;
uint64_t total_idle_ns;
uint64_t tmp_idle_ns;
- struct pm_px *pxpt = &px_statistic_data[op->cpuid];
+ struct pm_px *pxpt = px_statistic_data[op->cpuid];
+
+ if ( !pxpt )
+ return -ENODATA;
total_idle_ns = get_cpu_idle_time(op->cpuid);
tmp_idle_ns = total_idle_ns - pxpt->prev_idle_wall;
if ( !pxpt || !pxpt->u.pt || !pxpt->u.trans_pt )
return -ENODATA;
Index: xen-3.3.1-testing/xen/arch/x86/platform_hypercall.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/platform_hypercall.c

View File

@ -0,0 +1,137 @@
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1639,32 +1639,23 @@ static int relinquish_memory(
}
if ( test_and_clear_bit(_PGT_pinned, &page->u.inuse.type_info) )
- put_page_and_type(page);
+ ret = put_page_and_type_preemptible(page, 1);
+ switch ( ret )
+ {
+ case 0:
+ break;
+ case -EAGAIN:
+ case -EINTR:
+ set_bit(_PGT_pinned, &page->u.inuse.type_info);
+ put_page(page);
+ goto out;
+ default:
+ BUG();
+ }
if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
put_page(page);
-#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION
- /*
- * Forcibly drop reference counts of page tables above top most (which
- * were skipped to prevent long latencies due to deep recursion - see
- * the special treatment in free_lX_table()).
- */
- y = page->u.inuse.type_info;
- if ( (type < PGT_root_page_table) &&
- unlikely(((y + PGT_type_mask) &
- (PGT_type_mask|PGT_validated)) == type) )
- {
- BUG_ON((y & PGT_count_mask) >=
- (page->count_info & PGC_count_mask));
- while ( y & PGT_count_mask )
- {
- put_page_and_type(page);
- y = page->u.inuse.type_info;
- }
- }
-#endif
-
/*
* Forcibly invalidate top-most, still valid page tables at this point
* to break circular 'linear page table' references as well as clean up
@@ -1685,8 +1676,23 @@ static int relinquish_memory(
x & ~(PGT_validated|PGT_partial));
if ( likely(y == x) )
{
- if ( free_page_type(page, x, 0) != 0 )
+ /* No need for atomic update of type_info here: noone else updates it. */
+ switch ( ret = free_page_type(page, x, 1) )
+ {
+ case 0:
+ break;
+ case -EINTR:
+ page->u.inuse.type_info |= PGT_validated;
+ put_page(page);
+ ret = -EAGAIN;
+ goto out;
+ case -EAGAIN:
+ page->u.inuse.type_info |= PGT_partial;
+ put_page(page);
+ goto out;
+ default:
BUG();
+ }
if ( x & PGT_partial )
page->u.inuse.type_info--;
break;
@@ -1833,11 +1839,6 @@ int domain_relinquish_resources(struct d
/* fallthrough */
case RELMEM_done:
-#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION
- ret = relinquish_memory(d, &d->page_list, PGT_l1_page_table);
- if ( ret )
- return ret;
-#endif
break;
default:
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1343,7 +1343,7 @@ static void free_l1_table(struct page_in
static int free_l2_table(struct page_info *page, int preemptible)
{
-#if defined(CONFIG_COMPAT) || defined(DOMAIN_DESTRUCT_AVOID_RECURSION)
+#ifdef CONFIG_COMPAT
struct domain *d = page_get_owner(page);
#endif
unsigned long pfn = page_to_mfn(page);
@@ -1351,11 +1351,6 @@ static int free_l2_table(struct page_inf
unsigned int i = page->nr_validated_ptes - 1;
int err = 0;
-#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION
- if ( d->arch.relmem == RELMEM_l3 )
- return 0;
-#endif
-
pl2e = map_domain_page(pfn);
ASSERT(page->nr_validated_ptes);
@@ -1385,11 +1380,6 @@ static int free_l3_table(struct page_inf
unsigned int i = page->nr_validated_ptes - !page->partial_pte;
int rc = 0;
-#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION
- if ( d->arch.relmem == RELMEM_l4 )
- return 0;
-#endif
-
pl3e = map_domain_page(pfn);
do {
--- a/xen/include/asm-x86/config.h
+++ b/xen/include/asm-x86/config.h
@@ -41,14 +41,6 @@
#define CONFIG_HOTPLUG 1
#define CONFIG_HOTPLUG_CPU 1
-/*
- * Avoid deep recursion when tearing down pagetables during domain destruction,
- * causing dom0 to become unresponsive and Xen to miss time-critical softirq
- * deadlines. This will ultimately be replaced by built-in preemptibility of
- * get_page_type().
- */
-#define DOMAIN_DESTRUCT_AVOID_RECURSION 1
-
#define HZ 100
#define OPT_CONSOLE_STR "vga"

157
x86-dom-cleanup.patch Normal file
View File

@ -0,0 +1,157 @@
Equivalent of -unstable c/s 18720, 18731, and 18735.
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1687,6 +1687,8 @@ static int relinquish_memory(
{
if ( free_page_type(page, x, 0) != 0 )
BUG();
+ if ( x & PGT_partial )
+ page->u.inuse.type_info--;
break;
}
}
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1343,7 +1343,7 @@ static void free_l1_table(struct page_in
static int free_l2_table(struct page_info *page, int preemptible)
{
-#ifdef CONFIG_COMPAT
+#if defined(CONFIG_COMPAT) || defined(DOMAIN_DESTRUCT_AVOID_RECURSION)
struct domain *d = page_get_owner(page);
#endif
unsigned long pfn = page_to_mfn(page);
@@ -1351,6 +1351,11 @@ static int free_l2_table(struct page_inf
unsigned int i = page->nr_validated_ptes - 1;
int err = 0;
+#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION
+ if ( d->arch.relmem == RELMEM_l3 )
+ return 0;
+#endif
+
pl2e = map_domain_page(pfn);
ASSERT(page->nr_validated_ptes);
@@ -1381,7 +1386,7 @@ static int free_l3_table(struct page_inf
int rc = 0;
#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION
- if ( d->arch.relmem == RELMEM_l3 )
+ if ( d->arch.relmem == RELMEM_l4 )
return 0;
#endif
@@ -1424,11 +1429,6 @@ static int free_l4_table(struct page_inf
unsigned int i = page->nr_validated_ptes - !page->partial_pte;
int rc = 0;
-#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION
- if ( d->arch.relmem == RELMEM_l4 )
- return 0;
-#endif
-
do {
if ( is_guest_l4_slot(d, i) )
rc = put_page_from_l4e(pl4e[i], pfn, preemptible);
@@ -1940,7 +1940,6 @@ int free_page_type(struct page_info *pag
{
struct domain *owner = page_get_owner(page);
unsigned long gmfn;
- int rc;
if ( likely(owner != NULL) )
{
@@ -1973,34 +1972,39 @@ int free_page_type(struct page_info *pag
page->nr_validated_ptes = 1U << PAGETABLE_ORDER;
page->partial_pte = 0;
}
+
switch ( type & PGT_type_mask )
{
case PGT_l1_page_table:
free_l1_table(page);
- rc = 0;
- break;
+ return 0;
case PGT_l2_page_table:
- rc = free_l2_table(page, preemptible);
- break;
+ return free_l2_table(page, preemptible);
case PGT_l3_page_table:
#if CONFIG_PAGING_LEVELS == 3
if ( !(type & PGT_partial) )
page->nr_validated_ptes = L3_PAGETABLE_ENTRIES;
#endif
- rc = free_l3_table(page, preemptible);
- break;
+ return free_l3_table(page, preemptible);
case PGT_l4_page_table:
- rc = free_l4_table(page, preemptible);
- break;
- default:
- MEM_LOG("type %lx pfn %lx\n", type, page_to_mfn(page));
- rc = -EINVAL;
- BUG();
+ return free_l4_table(page, preemptible);
}
+ MEM_LOG("type %lx pfn %lx\n", type, page_to_mfn(page));
+ BUG();
+ return -EINVAL;
+}
+
+
+static int __put_page_type_final(struct page_info *page, unsigned long type,
+ int preemptible)
+{
+ int rc = free_page_type(page, type, preemptible);
+
/* No need for atomic update of type_info here: noone else updates it. */
- if ( rc == 0 )
+ switch ( rc )
{
+ case 0:
/*
* Record TLB information for flush later. We do not stamp page tables
* when running in shadow mode:
@@ -2013,9 +2017,8 @@ int free_page_type(struct page_info *pag
page->tlbflush_timestamp = tlbflush_current_time();
wmb();
page->u.inuse.type_info--;
- }
- else if ( rc == -EINTR )
- {
+ break;
+ case -EINTR:
ASSERT(!(page->u.inuse.type_info &
(PGT_count_mask|PGT_validated|PGT_partial)));
if ( !(shadow_mode_enabled(page_get_owner(page)) &&
@@ -2023,12 +2026,13 @@ int free_page_type(struct page_info *pag
page->tlbflush_timestamp = tlbflush_current_time();
wmb();
page->u.inuse.type_info |= PGT_validated;
- }
- else
- {
- BUG_ON(rc != -EAGAIN);
+ break;
+ case -EAGAIN:
wmb();
page->u.inuse.type_info |= PGT_partial;
+ break;
+ default:
+ BUG();
}
return rc;
@@ -2062,7 +2066,7 @@ static int __put_page_type(struct page_i
x, nx)) != x) )
continue;
/* We cleared the 'valid bit' so we do the clean up. */
- return free_page_type(page, x, preemptible);
+ return __put_page_type_final(page, x, preemptible);
}
/*

View File

@ -1,25 +0,0 @@
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -232,7 +232,8 @@ static uint8_t twobyte_table[256] = {
DstReg|SrcMem|ModRM, DstReg|SrcMem|ModRM,
ByteOp|DstReg|SrcMem|ModRM|Mov, DstReg|SrcMem16|ModRM|Mov,
/* 0xC0 - 0xC7 */
- ByteOp|DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM, 0, 0,
+ ByteOp|DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM,
+ 0, DstMem|SrcReg|ModRM|Mov,
0, 0, 0, ImplicitOps|ModRM,
/* 0xC8 - 0xCF */
ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
@@ -3656,6 +3657,12 @@ x86_emulate(
case 8: *src.reg = dst.val; break;
}
goto add;
+
+ case 0xc3: /* movnti */
+ /* Ignore the non-temporal hint for now. */
+ generate_exception_if(dst.bytes <= 2, EXC_UD, -1);
+ dst.val = src.val;
+ break;
}
goto writeback;

532
x86-partial-page-ref.patch Normal file
View File

@ -0,0 +1,532 @@
-unstable staging c/s 18742+18747
- retain a page reference when PGT_partial is set on a page (and drop
it when clearing that flag)
- don't drop a page reference never acquired when freeing the page type
of a page where the allocation of the type got preempted (and never
completed)
- don't acquire a page reference when allocating the page type of a
page where freeing the type got preempted (and never completed, and
hence didn't drop the respective reference)
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1683,18 +1683,24 @@ static int relinquish_memory(
break;
case -EINTR:
page->u.inuse.type_info |= PGT_validated;
+ if ( x & PGT_partial )
+ put_page(page);
put_page(page);
ret = -EAGAIN;
goto out;
case -EAGAIN:
page->u.inuse.type_info |= PGT_partial;
- put_page(page);
+ if ( x & PGT_partial )
+ put_page(page);
goto out;
default:
BUG();
}
if ( x & PGT_partial )
+ {
page->u.inuse.type_info--;
+ put_page(page);
+ }
break;
}
}
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -566,19 +566,21 @@ static int get_page_from_pagenr(unsigned
static int get_page_and_type_from_pagenr(unsigned long page_nr,
unsigned long type,
struct domain *d,
+ int partial,
int preemptible)
{
struct page_info *page = mfn_to_page(page_nr);
int rc;
- if ( unlikely(!get_page_from_pagenr(page_nr, d)) )
+ if ( likely(partial >= 0) &&
+ unlikely(!get_page_from_pagenr(page_nr, d)) )
return -EINVAL;
rc = (preemptible ?
get_page_type_preemptible(page, type) :
(get_page_type(page, type) ? 0 : -EINVAL));
- if ( rc )
+ if ( unlikely(rc) && partial >= 0 )
put_page(page);
return rc;
@@ -761,7 +763,7 @@ get_page_from_l2e(
}
rc = get_page_and_type_from_pagenr(
- l2e_get_pfn(l2e), PGT_l1_page_table, d, 0);
+ l2e_get_pfn(l2e), PGT_l1_page_table, d, 0, 0);
if ( unlikely(rc == -EINVAL) && get_l2_linear_pagetable(l2e, pfn, d) )
rc = 0;
@@ -772,7 +774,7 @@ get_page_from_l2e(
define_get_linear_pagetable(l3);
static int
get_page_from_l3e(
- l3_pgentry_t l3e, unsigned long pfn, struct domain *d, int preemptible)
+ l3_pgentry_t l3e, unsigned long pfn, struct domain *d, int partial, int preemptible)
{
int rc;
@@ -786,7 +788,7 @@ get_page_from_l3e(
}
rc = get_page_and_type_from_pagenr(
- l3e_get_pfn(l3e), PGT_l2_page_table, d, preemptible);
+ l3e_get_pfn(l3e), PGT_l2_page_table, d, partial, preemptible);
if ( unlikely(rc == -EINVAL) && get_l3_linear_pagetable(l3e, pfn, d) )
rc = 0;
@@ -797,7 +799,7 @@ get_page_from_l3e(
define_get_linear_pagetable(l4);
static int
get_page_from_l4e(
- l4_pgentry_t l4e, unsigned long pfn, struct domain *d, int preemptible)
+ l4_pgentry_t l4e, unsigned long pfn, struct domain *d, int partial, int preemptible)
{
int rc;
@@ -811,7 +813,7 @@ get_page_from_l4e(
}
rc = get_page_and_type_from_pagenr(
- l4e_get_pfn(l4e), PGT_l3_page_table, d, preemptible);
+ l4e_get_pfn(l4e), PGT_l3_page_table, d, partial, preemptible);
if ( unlikely(rc == -EINVAL) && get_l4_linear_pagetable(l4e, pfn, d) )
rc = 0;
@@ -961,23 +963,32 @@ static int put_page_from_l2e(l2_pgentry_
return 1;
}
+static int __put_page_type(struct page_info *, int preemptible);
static int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn,
- int preemptible)
+ int partial, int preemptible)
{
if ( (l3e_get_flags(l3e) & _PAGE_PRESENT) &&
(l3e_get_pfn(l3e) != pfn) )
+ {
+ if ( unlikely(partial > 0) )
+ return __put_page_type(l3e_get_page(l3e), preemptible);
return put_page_and_type_preemptible(l3e_get_page(l3e), preemptible);
+ }
return 1;
}
#if CONFIG_PAGING_LEVELS >= 4
static int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn,
- int preemptible)
+ int partial, int preemptible)
{
if ( (l4e_get_flags(l4e) & _PAGE_PRESENT) &&
(l4e_get_pfn(l4e) != pfn) )
+ {
+ if ( unlikely(partial > 0) )
+ return __put_page_type(l4e_get_page(l4e), preemptible);
return put_page_and_type_preemptible(l4e_get_page(l4e), preemptible);
+ }
return 1;
}
#endif
@@ -1184,7 +1195,7 @@ static int alloc_l3_table(struct page_in
unsigned long pfn = page_to_mfn(page);
l3_pgentry_t *pl3e;
unsigned int i;
- int rc = 0;
+ int rc = 0, partial = page->partial_pte;
#if CONFIG_PAGING_LEVELS == 3
/*
@@ -1213,7 +1224,8 @@ static int alloc_l3_table(struct page_in
if ( is_pv_32on64_domain(d) )
memset(pl3e + 4, 0, (L3_PAGETABLE_ENTRIES - 4) * sizeof(*pl3e));
- for ( i = page->nr_validated_ptes; i < L3_PAGETABLE_ENTRIES; i++ )
+ for ( i = page->nr_validated_ptes; i < L3_PAGETABLE_ENTRIES;
+ i++, partial = 0 )
{
if ( is_pv_32bit_domain(d) && (i == 3) )
{
@@ -1224,16 +1236,17 @@ static int alloc_l3_table(struct page_in
rc = get_page_and_type_from_pagenr(l3e_get_pfn(pl3e[i]),
PGT_l2_page_table |
PGT_pae_xen_l2,
- d, preemptible);
+ d, partial, preemptible);
}
else if ( !is_guest_l3_slot(i) ||
- (rc = get_page_from_l3e(pl3e[i], pfn, d, preemptible)) > 0 )
+ (rc = get_page_from_l3e(pl3e[i], pfn, d,
+ partial, preemptible)) > 0 )
continue;
if ( rc == -EAGAIN )
{
page->nr_validated_ptes = i;
- page->partial_pte = 1;
+ page->partial_pte = partial ?: 1;
}
else if ( rc == -EINTR && i )
{
@@ -1257,7 +1270,7 @@ static int alloc_l3_table(struct page_in
if ( !is_guest_l3_slot(i) )
continue;
unadjust_guest_l3e(pl3e[i], d);
- put_page_from_l3e(pl3e[i], pfn, 0);
+ put_page_from_l3e(pl3e[i], pfn, 0, 0);
}
}
@@ -1272,18 +1285,20 @@ static int alloc_l4_table(struct page_in
unsigned long pfn = page_to_mfn(page);
l4_pgentry_t *pl4e = page_to_virt(page);
unsigned int i;
- int rc = 0;
+ int rc = 0, partial = page->partial_pte;
- for ( i = page->nr_validated_ptes; i < L4_PAGETABLE_ENTRIES; i++ )
+ for ( i = page->nr_validated_ptes; i < L4_PAGETABLE_ENTRIES;
+ i++, partial = 0 )
{
if ( !is_guest_l4_slot(d, i) ||
- (rc = get_page_from_l4e(pl4e[i], pfn, d, preemptible)) > 0 )
+ (rc = get_page_from_l4e(pl4e[i], pfn, d,
+ partial, preemptible)) > 0 )
continue;
if ( rc == -EAGAIN )
{
page->nr_validated_ptes = i;
- page->partial_pte = 1;
+ page->partial_pte = partial ?: 1;
}
else if ( rc == -EINTR )
{
@@ -1299,7 +1314,7 @@ static int alloc_l4_table(struct page_in
MEM_LOG("Failure in alloc_l4_table: entry %d", i);
while ( i-- > 0 )
if ( is_guest_l4_slot(d, i) )
- put_page_from_l4e(pl4e[i], pfn, 0);
+ put_page_from_l4e(pl4e[i], pfn, 0, 0);
}
if ( rc < 0 )
return rc;
@@ -1377,19 +1392,20 @@ static int free_l3_table(struct page_inf
struct domain *d = page_get_owner(page);
unsigned long pfn = page_to_mfn(page);
l3_pgentry_t *pl3e;
- unsigned int i = page->nr_validated_ptes - !page->partial_pte;
- int rc = 0;
+ int rc = 0, partial = page->partial_pte;
+ unsigned int i = page->nr_validated_ptes - !partial;
pl3e = map_domain_page(pfn);
do {
if ( is_guest_l3_slot(i) )
{
- rc = put_page_from_l3e(pl3e[i], pfn, preemptible);
+ rc = put_page_from_l3e(pl3e[i], pfn, partial, preemptible);
+ if ( rc < 0 )
+ break;
+ partial = 0;
if ( rc > 0 )
continue;
- if ( rc )
- break;
unadjust_guest_l3e(pl3e[i], d);
}
} while ( i-- );
@@ -1399,7 +1415,7 @@ static int free_l3_table(struct page_inf
if ( rc == -EAGAIN )
{
page->nr_validated_ptes = i;
- page->partial_pte = 1;
+ page->partial_pte = partial ?: -1;
}
else if ( rc == -EINTR && i < L3_PAGETABLE_ENTRIES - 1 )
{
@@ -1416,18 +1432,21 @@ static int free_l4_table(struct page_inf
struct domain *d = page_get_owner(page);
unsigned long pfn = page_to_mfn(page);
l4_pgentry_t *pl4e = page_to_virt(page);
- unsigned int i = page->nr_validated_ptes - !page->partial_pte;
- int rc = 0;
+ int rc = 0, partial = page->partial_pte;
+ unsigned int i = page->nr_validated_ptes - !partial;
do {
if ( is_guest_l4_slot(d, i) )
- rc = put_page_from_l4e(pl4e[i], pfn, preemptible);
- } while ( rc >= 0 && i-- );
+ rc = put_page_from_l4e(pl4e[i], pfn, partial, preemptible);
+ if ( rc < 0 )
+ break;
+ partial = 0;
+ } while ( i-- );
if ( rc == -EAGAIN )
{
page->nr_validated_ptes = i;
- page->partial_pte = 1;
+ page->partial_pte = partial ?: -1;
}
else if ( rc == -EINTR && i < L4_PAGETABLE_ENTRIES - 1 )
{
@@ -1703,7 +1722,7 @@ static int mod_l3_entry(l3_pgentry_t *pl
return rc ? 0 : -EFAULT;
}
- rc = get_page_from_l3e(nl3e, pfn, d, preemptible);
+ rc = get_page_from_l3e(nl3e, pfn, d, 0, preemptible);
if ( unlikely(rc < 0) )
return page_unlock(l3pg), rc;
rc = 0;
@@ -1732,7 +1751,7 @@ static int mod_l3_entry(l3_pgentry_t *pl
}
page_unlock(l3pg);
- put_page_from_l3e(ol3e, pfn, 0);
+ put_page_from_l3e(ol3e, pfn, 0, 0);
return rc;
}
@@ -1781,7 +1800,7 @@ static int mod_l4_entry(l4_pgentry_t *pl
return rc ? 0 : -EFAULT;
}
- rc = get_page_from_l4e(nl4e, pfn, d, preemptible);
+ rc = get_page_from_l4e(nl4e, pfn, d, 0, preemptible);
if ( unlikely(rc < 0) )
return page_unlock(l4pg), rc;
rc = 0;
@@ -1802,7 +1821,7 @@ static int mod_l4_entry(l4_pgentry_t *pl
}
page_unlock(l4pg);
- put_page_from_l4e(ol4e, pfn, 0);
+ put_page_from_l4e(ol4e, pfn, 0, 0);
return rc;
}
@@ -1837,7 +1856,8 @@ int get_page(struct page_info *page, str
nx = x + 1;
d = nd;
if ( unlikely((x & PGC_count_mask) == 0) || /* Not allocated? */
- unlikely((nx & PGC_count_mask) == 0) || /* Count overflow? */
+ /* Keep one spare reference to be acquired by get_page_light(). */
+ unlikely(((nx + 1) & PGC_count_mask) <= 1) || /* Overflow? */
unlikely(d != _domain) ) /* Wrong owner? */
{
if ( !_shadow_mode_refcounts(domain) && !domain->is_dying )
@@ -1859,6 +1879,28 @@ int get_page(struct page_info *page, str
return 1;
}
+/*
+ * Special version of get_page() to be used exclusively when
+ * - a page is known to already have a non-zero reference count
+ * - the page does not need its owner to be checked
+ * - it will not be called more than once without dropping the thus
+ * acquired reference again.
+ * Due to get_page() reserving one reference, this call cannot fail.
+ */
+static void get_page_light(struct page_info *page)
+{
+ u32 x, nx, y = page->count_info;
+
+ do {
+ x = y;
+ nx = x + 1;
+ BUG_ON(!(x & PGC_count_mask)); /* Not allocated? */
+ BUG_ON(!(nx & PGC_count_mask)); /* Overflow? */
+ y = cmpxchg(&page->count_info, x, nx);
+ }
+ while ( unlikely(y != x) );
+}
+
static int alloc_page_type(struct page_info *page, unsigned long type,
int preemptible)
@@ -1899,6 +1941,7 @@ static int alloc_page_type(struct page_i
wmb();
if ( rc == -EAGAIN )
{
+ get_page_light(page);
page->u.inuse.type_info |= PGT_partial;
}
else if ( rc == -EINTR )
@@ -2009,8 +2052,8 @@ static int __put_page_type_final(struct
page->u.inuse.type_info--;
break;
case -EINTR:
- ASSERT(!(page->u.inuse.type_info &
- (PGT_count_mask|PGT_validated|PGT_partial)));
+ ASSERT((page->u.inuse.type_info &
+ (PGT_count_mask|PGT_validated|PGT_partial)) == 1);
if ( !(shadow_mode_enabled(page_get_owner(page)) &&
(page->count_info & PGC_page_table)) )
page->tlbflush_timestamp = tlbflush_current_time();
@@ -2019,6 +2062,7 @@ static int __put_page_type_final(struct
break;
case -EAGAIN:
wmb();
+ get_page_light(page);
page->u.inuse.type_info |= PGT_partial;
break;
default:
@@ -2033,6 +2077,7 @@ static int __put_page_type(struct page_i
int preemptible)
{
unsigned long nx, x, y = page->u.inuse.type_info;
+ int rc = 0;
for ( ; ; )
{
@@ -2056,7 +2101,10 @@ static int __put_page_type(struct page_i
x, nx)) != x) )
continue;
/* We cleared the 'valid bit' so we do the clean up. */
- return __put_page_type_final(page, x, preemptible);
+ rc = __put_page_type_final(page, x, preemptible);
+ if ( x & PGT_partial )
+ put_page(page);
+ break;
}
/*
@@ -2078,7 +2126,7 @@ static int __put_page_type(struct page_i
return -EINTR;
}
- return 0;
+ return rc;
}
@@ -2086,6 +2134,7 @@ static int __get_page_type(struct page_i
int preemptible)
{
unsigned long nx, x, y = page->u.inuse.type_info;
+ int rc = 0;
ASSERT(!(type & ~(PGT_type_mask | PGT_pae_xen_l2)));
@@ -2208,10 +2257,13 @@ static int __get_page_type(struct page_i
page->nr_validated_ptes = 0;
page->partial_pte = 0;
}
- return alloc_page_type(page, type, preemptible);
+ rc = alloc_page_type(page, type, preemptible);
}
- return 0;
+ if ( (x & PGT_partial) && !(nx & PGT_partial) )
+ put_page(page);
+
+ return rc;
}
void put_page_type(struct page_info *page)
@@ -2290,7 +2342,7 @@ int new_guest_cr3(unsigned long mfn)
#endif
okay = paging_mode_refcounts(d)
? get_page_from_pagenr(mfn, d)
- : !get_page_and_type_from_pagenr(mfn, PGT_root_page_table, d, 0);
+ : !get_page_and_type_from_pagenr(mfn, PGT_root_page_table, d, 0, 0);
if ( unlikely(!okay) )
{
MEM_LOG("Error while installing new baseptr %lx", mfn);
@@ -2534,7 +2586,7 @@ int do_mmuext_op(
if ( paging_mode_refcounts(FOREIGNDOM) )
break;
- rc = get_page_and_type_from_pagenr(mfn, type, FOREIGNDOM, 1);
+ rc = get_page_and_type_from_pagenr(mfn, type, FOREIGNDOM, 0, 1);
okay = !rc;
if ( unlikely(!okay) )
{
@@ -2615,7 +2667,7 @@ int do_mmuext_op(
okay = get_page_from_pagenr(mfn, d);
else
okay = !get_page_and_type_from_pagenr(
- mfn, PGT_root_page_table, d, 0);
+ mfn, PGT_root_page_table, d, 0, 0);
if ( unlikely(!okay) )
{
MEM_LOG("Error while installing new mfn %lx", mfn);
@@ -2722,7 +2774,7 @@ int do_mmuext_op(
unsigned char *ptr;
okay = !get_page_and_type_from_pagenr(mfn, PGT_writable_page,
- FOREIGNDOM, 0);
+ FOREIGNDOM, 0, 0);
if ( unlikely(!okay) )
{
MEM_LOG("Error while clearing mfn %lx", mfn);
@@ -2755,7 +2807,7 @@ int do_mmuext_op(
}
okay = !get_page_and_type_from_pagenr(mfn, PGT_writable_page,
- FOREIGNDOM, 0);
+ FOREIGNDOM, 0, 0);
if ( unlikely(!okay) )
{
put_page(mfn_to_page(src_mfn));
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -61,12 +61,36 @@ struct page_info
/*
* When PGT_partial is true then this field is valid and indicates
* that PTEs in the range [0, @nr_validated_ptes) have been validated.
- * If @partial_pte is true then PTE at @nr_validated_ptes+1 has been
- * partially validated.
+ * An extra page reference must be acquired (or not dropped) whenever
+ * PGT_partial gets set, and it must be dropped when the flag gets
+ * cleared. This is so that a get() leaving a page in partially
+ * validated state (where the caller would drop the reference acquired
+ * due to the getting of the type [apparently] failing [-EAGAIN])
+ * would not accidentally result in a page left with zero general
+ * reference count, but non-zero type reference count (possible when
+ * the partial get() is followed immediately by domain destruction).
+ * Likewise, the ownership of the single type reference for partially
+ * (in-)validated pages is tied to this flag, i.e. the instance
+ * setting the flag must not drop that reference, whereas the instance
+ * clearing it will have to.
+ *
+ * If @partial_pte is positive then PTE at @nr_validated_ptes+1 has
+ * been partially validated. This implies that the general reference
+ * to the page (acquired from get_page_from_lNe()) would be dropped
+ * (again due to the apparent failure) and hence must be re-acquired
+ * when resuming the validation, but must not be dropped when picking
+ * up the page for invalidation.
+ *
+ * If @partial_pte is negative then PTE at @nr_validated_ptes+1 has
+ * been partially invalidated. This is basically the opposite case of
+ * above, i.e. the general reference to the page was not dropped in
+ * put_page_from_lNe() (due to the apparent failure), and hence it
+ * must be dropped when the put operation is resumed (and completes),
+ * but it must not be acquired if picking up the page for validation.
*/
struct {
u16 nr_validated_ptes;
- bool_t partial_pte;
+ s8 partial_pte;
};
/*

View File

@ -2,7 +2,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/traps.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/traps.c
+++ xen-3.3.1-testing/xen/arch/x86/traps.c
@@ -1265,6 +1265,7 @@ asmlinkage void do_early_page_fault(stru
@@ -1266,6 +1266,7 @@ asmlinkage void do_early_page_fault(stru
unsigned long *stk = (unsigned long *)regs;
printk("Early fatal page fault at %04x:%p (cr2=%p, ec=%04x)\n",
regs->cs, _p(regs->eip), _p(cr2), regs->error_code);

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:84362b1ccb7f06991e6a8350ae29df89c82e7d9461eef2cce560fcdd8cc88242
size 22692829
oid sha256:3ce2034661e3f994e29c466829910cfd89dba75ba71c4235d66a7940cf3956f5
size 22695411

View File

@ -177,16 +177,3 @@ Index: xen-3.3.1-testing/tools/xenstore/Makefile
$(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
$(INSTALL_PROG) libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenstore.so.$(MAJOR)
Index: xen-3.3.1-testing/tools/misc/Makefile
===================================================================
--- xen-3.3.1-testing.orig/tools/misc/Makefile
+++ xen-3.3.1-testing/tools/misc/Makefile
@@ -19,7 +19,7 @@ SUBDIRS-$(CONFIG_MINITERM) += miniterm
SUBDIRS := $(SUBDIRS-y)
INSTALL_BIN = $(TARGETS) xencons
-INSTALL_SBIN = netfix xm xen-bugtool xen-python-path xend xenperf xsview
+INSTALL_SBIN = netfix xm xen-bugtool xen-python-path xend xsview
DEFAULT_PYTHON_PATH := $(shell $(XEN_ROOT)/tools/python/get-path)
PYTHON_PATH ?= $(DEFAULT_PYTHON_PATH)

View File

@ -2,7 +2,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xm/create.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xm/create.py
+++ xen-3.3.1-testing/tools/python/xen/xm/create.py
@@ -1073,9 +1073,8 @@ def preprocess_access_control(vals):
@@ -1081,9 +1081,8 @@ def preprocess_access_control(vals):
def preprocess_ip(vals):
if vals.ip or vals.dhcp != 'off':

View File

@ -2,7 +2,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xm/create.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xm/create.py
+++ xen-3.3.1-testing/tools/python/xen/xm/create.py
@@ -1129,8 +1129,7 @@ def spawn_vnc(display):
@@ -1137,8 +1137,7 @@ def spawn_vnc(display):
returns the port that the vncviewer is listening on and sets the global
vncpid. On failure, returns 0. Note that vncviewer is daemonized.
"""

View File

@ -1,3 +1,34 @@
-------------------------------------------------------------------
Fri Nov 7 13:49:09 CET 2008 - kwolf@suse.de
- Fix merge damage which prevented disks to be snapshotted when
not in disk-only snapshot mode
-------------------------------------------------------------------
Wed Nov 5 17:22:30 CET 2008 - kwolf@suse.de
- bnc#435195 - Fix error handling for blktap devices and ioemu;
check for images smaller than a sector and abort (causes hangs
of the complete blktap stack otherwise)
ioemu-blktap-zero-size.patch
-------------------------------------------------------------------
Mon Nov 3 10:30:49 MST 2008 - plc@novell.com
- bnc#436572 - L3: vm serial port configuration and access is not
persistent across dom0 reboot
-------------------------------------------------------------------
Wed Oct 29 11:50:45 MDT 2008 - carnold@novell.com
- bnc#436926 - Xen hypervisor crash
-------------------------------------------------------------------
Tue Oct 28 21:17:12 MDT 2008 - jfehlig@novell.com
- bnc#438927 - Fix migration bug in xend
-------------------------------------------------------------------
Tue Oct 28 18:19:52 CET 2008 - carnold@suse.de

170
xen.spec
View File

@ -1,5 +1,5 @@
#
# spec file for package xen (Version 3.3.1_18455_01)
# spec file for package xen (Version 3.3.1_18486_01)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -22,9 +22,9 @@ Name: xen
ExclusiveArch: %ix86 x86_64
%define xvers 3.3
%define xvermaj 3
%define changeset 18455
%define changeset 18486
%define xen_build_dir xen-3.3.1-testing
%define with_kmp 0
%define with_kmp 1
BuildRequires: LibVNCServer-devel SDL-devel automake bin86 curl-devel dev86 graphviz latex2html libjpeg-devel libxml2-devel ncurses-devel openssl openssl-devel pciutils-devel python-devel transfig
%if %suse_version >= 1030
BuildRequires: texlive texlive-latex
@ -37,8 +37,8 @@ BuildRequires: glibc-32bit glibc-devel-32bit
%if %{?with_kmp}0
BuildRequires: kernel-source kernel-syms module-init-tools xorg-x11
%endif
Version: 3.3.1_18455_01
Release: 3
Version: 3.3.1_18486_01
Release: 1
License: GPL v2 only
Group: System/Kernel
AutoReqProv: on
@ -88,16 +88,18 @@ Patch18: 18521-per-CPU-TSS.patch
Patch19: 18523-per-CPU-misc.patch
Patch20: 18528-dump-evtchn.patch
Patch21: 18539-pirq-vector-mapping.patch
Patch22: 18542-pmstat-arg-check.patch
Patch23: 18547-pirq-vector-mapping-fix.patch
Patch24: 18573-move-pirq-logic.patch
Patch25: 18574-msi-free-vector.patch
Patch26: 18577-bad-assertion.patch
Patch27: 18583-passthrough-locking.patch
Patch28: 18584-evtchn-lock-rename.patch
Patch29: 18620-x86-page-type-preemptible-fix.patch
Patch30: 18631-msix-intr-remap.patch
Patch31: 18654-xend-vcpus.patch
Patch22: 18547-pirq-vector-mapping-fix.patch
Patch23: 18573-move-pirq-logic.patch
Patch24: 18574-msi-free-vector.patch
Patch25: 18577-bad-assertion.patch
Patch26: 18583-passthrough-locking.patch
Patch27: 18584-evtchn-lock-rename.patch
Patch28: 18620-x86-page-type-preemptible-fix.patch
Patch29: 18637-vmx-set-dr7.patch
Patch30: 18654-xend-vcpus.patch
Patch31: 18656-vtd-alloc-checks.patch
Patch32: 18661-recursive-spinlocks.patch
Patch33: 18745-xend-ioport-irq.patch
# Our patches
Patch100: xen-config.diff
Patch101: xend-config.diff
@ -159,25 +161,27 @@ Patch183: blktapctrl-default-to-ioemu.patch
Patch184: ioemu-blktap-barriers.patch
Patch185: tapdisk-ioemu-logfile.patch
Patch186: blktap-ioemu-close-fix.patch
Patch187: ioemu-blktap-zero-size.patch
# Jim's domain lock patch
Patch190: xend-domain-lock.patch
# Patches from Jan
Patch240: dump-exec-state.patch
Patch241: x86-show-page-walk-early.patch
Patch242: svm-lmsl.patch
Patch243: x86-extra-trap-info.patch
Patch244: x86-alloc-cpu-structs.patch
Patch245: 32on64-extra-mem.patch
Patch246: msi-enable.patch
Patch242: x86-extra-trap-info.patch
Patch243: x86-alloc-cpu-structs.patch
Patch244: 32on64-extra-mem.patch
Patch245: msi-enable.patch
# PV Driver Patches
Patch350: pv-driver-build.patch
Patch351: xen-ioemu-hvm-pv-support.diff
Patch352: pvdrv_emulation_control.patch
Patch353: blktap-pv-cdrom.patch
Patch354: vtd-alloc-checks.patch
Patch355: x86-emul-movnti.patch
Patch356: i386-highmem-assist.patch
Patch357: x86-cpufreq-report.patch
Patch354: i386-highmem-assist.patch
Patch355: x86-cpufreq-report.patch
Patch356: x86-dom-cleanup.patch
Patch357: x86-dom-cleanup-no-hack.patch
Patch358: x86-partial-page-ref.patch
Patch359: dom-print.patch
# novell_shim patches
Patch400: hv_tools.patch
Patch401: hv_xen_base.patch
@ -545,6 +549,8 @@ Authors:
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
@ -603,6 +609,7 @@ Authors:
%patch184 -p1
%patch185 -p1
%patch186 -p1
%patch187 -p1
%patch190 -p1
%patch240 -p1
%patch241 -p1
@ -610,7 +617,6 @@ Authors:
%patch243 -p1
%patch244 -p1
%patch245 -p1
%patch246 -p1
%patch350 -p1
%patch351 -p1
%patch352 -p1
@ -619,6 +625,8 @@ Authors:
%patch355 -p1
%patch356 -p1
%patch357 -p1
%patch358 -p1
%patch359 -p1
# Don't use shim for now
%ifarch x86_64
%patch400 -p1
@ -816,7 +824,6 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
%defattr(-,root,root)
#/usr/bin/lomount
/usr/bin/xencons
/usr/bin/xenperf
/usr/bin/xenstore*
/usr/bin/xentrace*
/usr/bin/pygrub
@ -969,6 +976,21 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
/sbin/ldconfig
%changelog
* Fri Nov 07 2008 kwolf@suse.de
- Fix merge damage which prevented disks to be snapshotted when
not in disk-only snapshot mode
* Wed Nov 05 2008 kwolf@suse.de
- bnc#435195 - Fix error handling for blktap devices and ioemu;
check for images smaller than a sector and abort (causes hangs
of the complete blktap stack otherwise)
ioemu-blktap-zero-size.patch
* Mon Nov 03 2008 plc@novell.com
- bnc#436572 - L3: vm serial port configuration and access is not
persistent across dom0 reboot
* Wed Oct 29 2008 carnold@novell.com
- bnc#436926 - Xen hypervisor crash
* Wed Oct 29 2008 jfehlig@novell.com
- bnc#438927 - Fix migration bug in xend
* Tue Oct 28 2008 carnold@suse.de
- disable KMP, does not build with current kernel
* Fri Oct 24 2008 jfehlig@novell.com
@ -995,7 +1017,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
blktap-ioemu-close-fix.patch
- blktapctrl: If tapdisk-ioemu has been shut down and a new
instance is needed, fix saving the PID of the new instance
* Fri Oct 03 2008 jfehlig@novell.com
* Thu Oct 02 2008 jfehlig@novell.com
- bnc#431737 - Fix use of deprecated python constructs in xend
* Mon Sep 29 2008 carnold@novell.com
- Update to c/s 18430, remove our versions of upstream patches.
@ -1006,7 +1028,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
* Thu Sep 25 2008 kwolf@suse.de
- bnc#429801 - Fixed xm start -c / --vncviewer
xm-start-fix.patch
* Thu Sep 25 2008 carnold@novell.com
* Wed Sep 24 2008 carnold@novell.com
- bnc#382401 - xm man page missing information for commands.
* Wed Sep 17 2008 carnold@novell.com
- Pulled some upstream patches for Intel and AMD microcode fixes.
@ -1064,7 +1086,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Added patch to prevent starting same domU from multiple hosts.
Feature is disabled by default - see /etc/xen/xend-config.sxp.
fate#305062
* Tue Aug 12 2008 jfehlig@novell.com
* Mon Aug 11 2008 jfehlig@novell.com
- Added python-openssl to Requires list for xen-tools. This
package is required if SSL relocation is enabled by user.
* Mon Aug 11 2008 carnold@novell.com
@ -1072,7 +1094,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
* Sat Aug 09 2008 jfehlig@novell.com
- Disabled xend-relocation-ssl-server for now. Certificates must
be created and feature needs testing.
* Sat Aug 09 2008 carnold@novell.com
* Fri Aug 08 2008 carnold@novell.com
- Update to xen-unstable changeset 18269 post RC3. Reverse
version back to 3.3.0 from 4.0.0.
* Wed Aug 06 2008 carnold@novell.com
@ -1080,9 +1102,9 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
3.3.0 to 4.0.0
* Mon Aug 04 2008 carnold@novell.com
- Updated to xen-unstable changeset 18210. Post 3.3.0-rc2.
* Wed Jul 09 2008 carnold@novell.com
* Tue Jul 08 2008 carnold@novell.com
- Updated to xen-unstable changeset 17990.
* Wed Jul 09 2008 kwolf@suse.de
* Tue Jul 08 2008 kwolf@suse.de
- ioemu: Write barriers for blktap devices
ioemu-blktap-barriers.patch
* Thu Jul 03 2008 kwolf@suse.de
@ -1114,7 +1136,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
ifup-bridge in sysconfig has been fixed so patch is no longer
needed. Calling ifdown on bridge now removes ports and deletes
bridge, so network-bridge no longer needs to do these tasks.
* Sat May 17 2008 carnold@novell.com
* Fri May 16 2008 carnold@novell.com
- bnc#390985 - xm man page needs FIXME sections to be fixed
xen-fixme-doc.diff
* Wed May 14 2008 carnold@novell.com
@ -1135,7 +1157,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Update to Xen 3.2.1 RC5 changeset 16864.
* Fri Apr 11 2008 jfehlig@novell.com
- bnc#378595 - Do not use ifup/ifdown in network-bridge for now.
* Tue Mar 25 2008 carnold@novell.com
* Mon Mar 24 2008 carnold@novell.com
- bnc#373194 - The xen module and the kernel for Dom0 don't match.
- Add ncurses-devel build dependency
* Mon Mar 24 2008 carnold@novell.com
@ -1150,12 +1172,12 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
* Wed Mar 12 2008 jfehlig@novell.com
- Increased dom0-min-mem value to 512Mb in xend-config.sxp
bnc#370007
* Tue Mar 11 2008 jfehlig@novell.com
* Mon Mar 10 2008 jfehlig@novell.com
- Fixed initialization of default VM config values when creating
VMs through Xen API. bnc#368273
* Mon Mar 10 2008 jfehlig@novell.com
- Removed unused/untested xend-relocation script.
* Sat Mar 08 2008 jfehlig@novell.com
* Fri Mar 07 2008 jfehlig@novell.com
- Set device model when creating pvfb consoles via XenAPI.
bnc#367851
* Fri Mar 07 2008 jfehlig@novell.com
@ -1209,7 +1231,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Merge xen-tools and xen-tools-ioemu into xen-tools.
* Thu Dec 20 2007 carnold@novell.com
- Update to xen 3.2 RC2. Changeset 16646
* Fri Dec 14 2007 carnold@novell.com
* Thu Dec 13 2007 carnold@novell.com
- Added agent support for HP Proliant hardware.
* Wed Dec 05 2007 carnold@novell.com
- #338108 - VUL-0: Xen security issues in SLE10
@ -1240,9 +1262,9 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- #302106: Update network-multinet
* Wed Sep 05 2007 carnold@novell.com
- #307458: AMD-V CR8 intercept reduction for HVM windows 64b guests
* Thu Aug 30 2007 ccoffing@novell.com
* Wed Aug 29 2007 ccoffing@novell.com
- Update block-iscsi to match changes to open-iscsi.
* Tue Aug 28 2007 carnold@novell.com
* Mon Aug 27 2007 carnold@novell.com
- #289275 - domu will not reboot if pci= is passed in at boot time.
* Fri Aug 24 2007 carnold@novell.com
- #297345: Added several upstream patches for hvm migration.
@ -1254,7 +1276,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
file.
* Mon Aug 13 2007 carnold@novell.com
- hvm svm: Log into 'xm dmesg' that SVM NPT is enabled.
* Sat Aug 11 2007 ccoffing@novell.com
* Fri Aug 10 2007 ccoffing@novell.com
- Honor RPM_OPT_FLAGS better
* Thu Aug 09 2007 ccoffing@novell.com
- #298176: Do not enable NX if CPU/BIOS does not support it
@ -1303,7 +1325,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
* Fri Jul 06 2007 ccoffing@novell.com
- xensource bug #858: Disable strict aliasing for xenstore, to
avoid domU hangs.
* Wed Jul 04 2007 ccoffing@novell.com
* Tue Jul 03 2007 ccoffing@novell.com
- #285929: Bad "xendomains status" output w/ empty XENDOMAINS_SAVE
* Tue Jul 03 2007 carnold@novell.com
- Changes necessary to support EDD and EDID from Jan.
@ -1312,7 +1334,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Removed the modified 15157 patch. This patch was actually a
consolidation of changesets 15157 and 15250. These changesets
are now discrete patches to ease subsequent updates of Xen.
* Thu Jun 21 2007 ccoffing@novell.com
* Wed Jun 20 2007 ccoffing@novell.com
- Split vm-install off as a separate package.
- Update man page.
- Update Ron Terry's network-multi script.
@ -1340,7 +1362,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
'xm block-detach dom dev_name'. Modified version fixes bug 262805
without introducing regression. Patch fixing c/s 15157 has been
submitted upstream.
* Thu May 24 2007 ccoffing@novell.com
* Wed May 23 2007 ccoffing@novell.com
- Drop xen-messages.diff; Xen now supports HVM save/restore.
* Tue May 22 2007 ccoffing@novell.com
- Update Ron Terry's network-multi script.
@ -1354,7 +1376,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
+ #259994: disk size would reset when editing path
+ #247073: handle autoyast URLs
+ #254311: physical disks were showing as 0.0 GB
* Thu May 17 2007 ccoffing@novell.com
* Wed May 16 2007 ccoffing@novell.com
- Properly quote pathnames in domUloader to fix EVMS. (#274484)
- Allow user to specify a default 'keymap' in xend's configuration
file. (#258818 and 241149)
@ -1378,7 +1400,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Added security fixes for problems found Travis Orandy (#270621)
CVE-2007-1320, CVE-2007-1321, CVE-2007-1322, CVE-2007-1323,
CVE-2007-1366
* Fri May 04 2007 ccoffing@novell.com
* Thu May 03 2007 ccoffing@novell.com
- Update to xen-3.1-testing rc7 (changeset 15020).
- Fix identification of virt-manager windows. (#264162)
* Wed May 02 2007 jfehlig@novell.com
@ -1397,7 +1419,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
* Fri Apr 20 2007 ccoffing@novell.com
- Updated README. (#250705)
- Fix vm-install's detection of PV RHEL4/5 kernels. (#260983)
* Fri Apr 20 2007 ccoffing@novell.com
* Thu Apr 19 2007 ccoffing@novell.com
- Place xenstore-* tools in new xen-tools-domU package, to be used
by suse_register. (#249157)
* Tue Apr 17 2007 ccoffing@novell.com
@ -1472,7 +1494,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
* Wed Mar 07 2007 jfehlig@novell.com
- Added upstream patch that fixes save/restore on 32pae guests.
Upstream c/s 14150. Bug #237859
* Wed Mar 07 2007 carnold@novell.com
* Tue Mar 06 2007 carnold@novell.com
- Remove a debug message which is spamming the logs during live
migration.
* Tue Mar 06 2007 jfehlig@novell.com
@ -1506,7 +1528,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Fix exception caused by incorrect method name in xen-messages.diff.
This is one of perhaps several problems with save/restore,
bug #237859
* Fri Mar 02 2007 dpmerrill@novell.com
* Thu Mar 01 2007 dpmerrill@novell.com
- Add xen-ioemu-hvm-pv-support.diff
This patch allows for shutting down the IDE drive.
* Thu Mar 01 2007 jfehlig@novell.com
@ -1523,7 +1545,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
model exceptions
+ Add "Add" button to Operating System Installation page, based
on usability feedback
* Thu Mar 01 2007 jfehlig@novell.com
* Wed Feb 28 2007 jfehlig@novell.com
- Added changeset 13786 and 14022 from xen-unstable. These
changesets affect the Xen API C bindings only and are low risk.
This is a continuation of support for FATE feature 110320. ECO
@ -1533,7 +1555,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
+ #244772: display error message in GUI if xen isn't running
+ #246049: better error message when OS==SUSE but ISO looks wrong
+ Fix printing of jobid when run with --background
* Thu Feb 22 2007 ccoffing@novell.com
* Wed Feb 21 2007 ccoffing@novell.com
- Don't allow "xm create" of running VM. (#245253)
- Update vm-install:
+ Fix inability to use already-extracted SUSE kernel/initrds
@ -1683,7 +1705,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Update to xen-unstable (changeset 12757).
- Enable LIBXENAPI_BINDINGS and XENFB_TOOLS.
- Enable unix domain socket for xend; needed by tools.
* Wed Dec 06 2006 ccoffing@novell.com
* Tue Dec 05 2006 ccoffing@novell.com
- Update to xen-unstable (changeset 12734; feature freeze for
3.0.4)
- Make /etc/xen mode 0700 to protect vnc passwords.
@ -1724,7 +1746,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
* Tue Oct 31 2006 ccoffing@novell.com
- Backport xen-unstable changesets 1184[1-3] to address SVM
interrupt injection issues. Replaces earlier (broken) patches.
* Tue Oct 31 2006 ccoffing@novell.com
* Mon Oct 30 2006 ccoffing@novell.com
- /var/lib/xen/images should not be world readable. (#214638)
- Update to xen-3.0.3-0 (changeset 11774; no code changes).
* Mon Oct 16 2006 ccoffing@novell.com
@ -1765,7 +1787,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Build debug version of xen-pae.
* Mon Sep 25 2006 ccoffing@novell.com
- Update to xen-unstable changeset 11616.
* Wed Sep 13 2006 ccoffing@novell.com
* Tue Sep 12 2006 ccoffing@novell.com
- Update check_python script to identify Python 2.5 RCs as valid.
* Mon Sep 11 2006 ccoffing@novell.com
- Update to xen-unstable changeset 11440.
@ -1773,14 +1795,14 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
(#204758)
- Include Jan's updated patch for #192150 (to preserve register
context when doing IO).
* Wed Sep 06 2006 ccoffing@novell.com
* Tue Sep 05 2006 ccoffing@novell.com
- Update block-nbd and xmexample.nbd, and add block-iscsi and
xmexample.iscsi (from Kurt).
* Thu Aug 31 2006 ccoffing@novell.com
- Automatically create/destroy virtual frame buffer viewer. Add
"sdl=1" to config file of a paravirtualized VM to get the viewer.
- Log files have moved to /var/log/xen.
* Wed Aug 30 2006 ccoffing@novell.com
* Tue Aug 29 2006 ccoffing@novell.com
- xendomains does not actually save domains. (#201349)
- Update to xen-unstable changeset 11299.
* Tue Aug 29 2006 ccoffing@novell.com
@ -1792,7 +1814,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
* Wed Aug 16 2006 ccoffing@novell.com
- Update to xen-unstable changeset 11134.
- Drop xen-reverse-10064.diff now that kernel is updated.
* Wed Aug 09 2006 ccoffing@novell.com
* Tue Aug 08 2006 ccoffing@novell.com
- Re-enabled patch for #184175.
- Update to xen-unstable changeset 10986.
- Include Jan's patch to preserve register context when doing
@ -1819,13 +1841,13 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Added for loop to retry the losetup -d in /etc/xen/scripts/block.
It is possible for the losetup -d to fail if another process is
examining the loopback devices e.g. losetup -a. (#151105)
* Thu Jul 13 2006 ccoffing@novell.com
* Wed Jul 12 2006 ccoffing@novell.com
- Corrected and updated README.
* Mon Jul 10 2006 ccoffing@novell.com
- Add Jeff Mahoney's block-sync.diff, to give control of
"losetup -y" to the user (and potentially yast). Defaults to
old async behavior. (#190869)
* Fri Jul 07 2006 ccoffing@novell.com
* Thu Jul 06 2006 ccoffing@novell.com
- Update to xen-unstable tree. Revert changeset 10064, to maintain
backwards compatibility with SLES 10.
* Wed Jul 05 2006 ccoffing@novell.com
@ -1853,7 +1875,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
* Fri Jun 23 2006 kallan@novell.com
- Updated xen-bonding.diff to enable bonding again after the latest
patches to network-bridge etc. (#161888)
* Thu Jun 22 2006 ccoffing@novell.com
* Wed Jun 21 2006 ccoffing@novell.com
- Clean up the useless "Nothing to flush" messages, from 'ip addr
flush', in /var/log/xen-hotplug.log
- Fix race condition in domUloader.py, when another process did
@ -2066,7 +2088,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Handle memory failure when staring fully virtualized
guests to prevent reboot of the box (AMD) or
hanging the box (VT) (#149179).
* Wed May 10 2006 ccoffing@novell.com
* Tue May 09 2006 ccoffing@novell.com
- Include select patches from xen-3.0-testing:
+ 9665: Fix pciif parsing for compatibility variable.
+ 9666: Fix HVM hang; was broken due to previous "hda lost
@ -2109,7 +2131,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
+ Fix reboot on large SMP machines (IBM, no bug #).
- Integrate Jan's patches:
+ Spurious interrupt roundup (#152892).
* Tue Apr 25 2006 ccoffing@novell.com
* Mon Apr 24 2006 ccoffing@novell.com
- Integrate Jan's patches:
+ FXSR patch (#135677).
+ APIC option patch (work-around #150114).
@ -2143,7 +2165,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
* Wed Apr 19 2006 agruen@suse.de
- Create /boot symlinks in the %%install section instead of in
%%post so that they will end up in the package file list.
* Wed Apr 19 2006 ccoffing@novell.com
* Tue Apr 18 2006 ccoffing@novell.com
- Add /etc/xen/vm to vm config file search path (#167208).
* Fri Apr 14 2006 kallan@novell.com
- Add support for bonding in network-bridge. (#161678).
@ -2160,7 +2182,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
+ Fixes xmlrpc issues.
+ Fixes several emulated instructions for HVM.
+ Fixes for x86_64 inline assembly.
* Wed Apr 12 2006 ccoffing@novell.com
* Tue Apr 11 2006 ccoffing@novell.com
- Fix "jitter" and race in dom0's memory target calculation, which
could cause auto-ballooning to fail (#164714).
* Tue Apr 11 2006 brogers@novell.com
@ -2205,7 +2227,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Correctly default XAUTHORITY if it is not set. This allows the
GUI to come up for fully virtualized guests (was especially
problematic when VM was started from YaST). (#142472)
* Thu Mar 30 2006 ccoffing@novell.com
* Wed Mar 29 2006 ccoffing@novell.com
- Fixed reversed "Do I have enough memory?" test when creating
new VMs (#156448).
* Tue Mar 28 2006 ccoffing@novell.com
@ -2284,7 +2306,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Remove unnecessary x86_64 patch.
- Fix auto-ballooning of dom0 memory for HVM domUs (XenSource bug
521).
* Wed Feb 22 2006 ccoffing@novell.com
* Tue Feb 21 2006 ccoffing@novell.com
- Update to hg 8920 (xen-unstable tree). Fixes instruction decode
for fully virtualized guests, fixing booting from CDs.
- Integrate 3 patches from Intel, to improve VNC performance.
@ -2336,7 +2358,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Correct return values and improve messages of init scripts.
* Fri Jan 20 2006 ccoffing@novell.com
- Use domUloader instead of pygrub.
* Fri Jan 20 2006 carnold@novell.com
* Thu Jan 19 2006 carnold@novell.com
- Build based on the xen-unstable.hg 8628
* Wed Jan 18 2006 carnold@novell.com
- Update to hg 8646 xen-unstable-hvm.hg tree.
@ -2344,7 +2366,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Allow version string "XEN_VER=3.0" instead of just
"XEN_VER=xen-3.0" for backwards compatibility.
- Correctly set changeset in compile.h.
* Fri Jan 13 2006 carnold@novell.com
* Thu Jan 12 2006 carnold@novell.com
- Added two patches from AMD that apply to the 8513 changeset.
* Thu Jan 12 2006 kukuk@suse.de
- Add libreiserfs-devel to nfb.
@ -2394,7 +2416,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
configurable timeout for the commands. Make xendomains status
report something useful.
- Make xendomains script comaptible to non-SUSE distros.
* Tue Oct 18 2005 garloff@suse.de
* Mon Oct 17 2005 garloff@suse.de
- Update to hg 7398.
* Mon Oct 17 2005 garloff@suse.de
- Create useful xendomains init script and sysconfig file.
@ -2429,13 +2451,13 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Fix network-bridge down.
* Thu Sep 08 2005 garloff@suse.de
- Build PAE version along non-PAE version of Hypervisor.
* Wed Sep 07 2005 garloff@suse.de
* Tue Sep 06 2005 garloff@suse.de
- Try to fix network bridge down issue.
- Document netowrking and firewalling caveats in README.SUSE.
- Enable PAE.
* Tue Sep 06 2005 garloff@suse.de
- Update to hg 6644.
* Mon Sep 05 2005 garloff@suse.de
* Sun Sep 04 2005 garloff@suse.de
- Update to hg 6610.
- Rename default name of xen-br0 to xenbr0.
- Fix pygrub installation.
@ -2491,7 +2513,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Fix version-check in NetWare loader (0x336ec577 -> 0x326ec578).
* Fri Jun 17 2005 ccoffing@novell.com
- Backport NetWare-friendly loader from Xen 3.0.
* Fri Jun 17 2005 ccoffing@novell.com
* Thu Jun 16 2005 ccoffing@novell.com
- Destroy domains that failed to be fully created.
* Fri Jun 10 2005 garloff@suse.de
- Update to latest 2.0-testing snapshot.
@ -2499,7 +2521,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
* Wed Jun 08 2005 garloff@suse.de
- Update mk-xen-rescue-img.sh script: Handle SLES9 better.
- Export PYTHONOPTIMIZE in xend start script.
* Tue Jun 07 2005 garloff@suse.de
* Mon Jun 06 2005 garloff@suse.de
- Merge _perform_err fixes.
* Mon May 23 2005 ccoffing@novell.com
- update to 2.0.6
@ -2507,7 +2529,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- More gcc4 and binutils related fixes.
* Wed Apr 13 2005 garloff@suse.de
- Build fixes for gcc4.
* Mon Apr 04 2005 garloff@suse.de
* Sun Apr 03 2005 garloff@suse.de
- Update xen: Various fixes (scheduling, memset, domain crash
handling) and enhancements (bg page scrubbing).
* Thu Mar 24 2005 garloff@suse.de
@ -2521,7 +2543,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
- Require ports < 1024 to allow controlling VMs.
* Mon Mar 21 2005 garloff@suse.de
- Update xen.
* Thu Mar 17 2005 garloff@suse.de
* Wed Mar 16 2005 garloff@suse.de
- Update xen.
- Add /var/lib/xen/xen-db/ subdirs.
* Sun Mar 13 2005 garloff@suse.de

View File

@ -2,21 +2,19 @@ Index: xen-3.3.1-testing/tools/examples/domain-lock
===================================================================
--- /dev/null
+++ xen-3.3.1-testing/tools/examples/domain-lock
@@ -0,0 +1,86 @@
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+set +x
+
+usage() {
+ echo "usage: domain-lock [-l|-u|-s] -p <vm-config-path> [-n <vm-name>] [-i <vm-uuid>] [-h <vm-host>]"
+ echo "usage: domain-lock [-l|-u|-s] [-n <vm name>] [-i <vm uuid>] [-p <physical host>] path"
+ echo ""
+ echo "-l lock"
+ echo "-u unlock"
+ echo "-s status (default)"
+ echo "-p Required argument indicating path for lock file"
+ echo "-n Virtual Machine name"
+ echo "-i Virtual Machine Id or UUID"
+ echo "-h Virtual Machine Server (Host) name"
+ echo "-l lock"
+ echo "-u unlock"
+ echo "-s status (default)"
+ echo "-n Virtual Machine name"
+ echo "-i Virtual Machine Id or UUID"
+ echo "-p Virtual Machine Server (physical host) name"
+ echo "path A per-VM, unique location where external lock will be managed"
+ exit 1
+}
+
@ -47,7 +45,7 @@ Index: xen-3.3.1-testing/tools/examples/domain-lock
+
+mode="status"
+
+while getopts ":lusp:n:i:h:" opt; do
+while getopts ":lusn:i:p:" opt; do
+ case $opt in
+ l )
+ mode="lock"
@ -59,7 +57,7 @@ Index: xen-3.3.1-testing/tools/examples/domain-lock
+ mode="status"
+ ;;
+ p )
+ vm_path=$OPTARG
+ vm_host=$OPTARG
+ ;;
+ n )
+ vm_name=$OPTARG
@ -67,15 +65,14 @@ Index: xen-3.3.1-testing/tools/examples/domain-lock
+ i )
+ vm_uuid=$OPTARG
+ ;;
+ h )
+ vm_host=$OPTARG
+ ;;
+ \? )
+ usage
+ ;;
+ esac
+done
+
+shift $(($OPTIND - 1))
+vm_path=$1
+[ -z $vm_path ] && usage
+
+case $mode in
@ -93,17 +90,20 @@ Index: xen-3.3.1-testing/tools/examples/xend-config.sxp
===================================================================
--- xen-3.3.1-testing.orig/tools/examples/xend-config.sxp
+++ xen-3.3.1-testing/tools/examples/xend-config.sxp
@@ -255,4 +255,44 @@
@@ -255,4 +255,46 @@
# Path where persistent domain configuration is stored.
# Default is /var/lib/xend/domains/
+#
#(xend-domains-path /var/lib/xend/domains)
+
+# Create a lock file when domains are started. Lock file is
+# placed in xend-domains-path/<domain_uuid> on domain startup
+# and removed when domain is stopped. By default, a lock file
+# Create an external lock file when domains are started. Lock
+# file is placed in xend-domains-lock-path/<domain_uuid> on domain
+# startup and removed when domain is stopped. By default, a lock file
+# is not created. Set to yes to enable lock file creation.
+# Note that external locking mechanisms are no substitute for a cluster
+# environment that protects shared resources, but may be useful in
+# some circumstances nonetheless.
+#
+#(xend-domain-lock no)
+
@ -118,20 +118,19 @@ Index: xen-3.3.1-testing/tools/examples/xend-config.sxp
+# External locking utility for acquiring/releasing domain lock.
+# By default /etc/xen/scripts/domain-lock will be used if
+# xend-domain-lock is set to yes. Set to path of custom
+# locking utility to override the default. Locking utility
+# should accept
+# <-l | -u | -s> -p <vm-config-path> [-n <vm-name>] [-i <vm-id>]
+# [-h <vm-host>]
+# command line options. Utility should return zero on success,
+# non-zero on error.
+# locking utility to override the default. Synopsis:
+#
+# lock-util <-l | -u | -s> [-n <vm-name>] [-i <vm-id>] [-p <phy-host>] path
+#
+# Utility should return zero on success, non-zero on error.
+# -l lock Acquire (create) lock file
+# -u unlock Remove lock file
+# -s status Default action. If lock file exists, print contents on
+# stdout and return 0)
+# -p path Required. Path where lock file should be written.
+# -p phy-host Name of physical host (dom0)
+# -n vm-name Name of domain
+# -i vm-id Id or UUID of domain
+# -h vm-host Name of host machine (dom0)
+# path A unique location for external lock must be specified
+#
+# The /etc/xen/scripts/domain-lock default utility will create
+# <xend-domain-lock-path>/<vm-uuid>/lock and write <vm-name>, <vm-id>,
@ -191,7 +190,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
+ # Check if domain has a lock file present
+ def is_dom_locked(self, path):
+ status = os.system('%s -s -p %s' % \
+ status = os.system('%s -s %s' % \
+ (xoptions.get_xend_domain_lock_utility(), \
+ path))
+
@ -201,15 +200,15 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
+ # entry in the lock file.
+ def get_lock_host(self, path):
+ fin = os.popen(xoptions.get_xend_domain_lock_utility() + \
+ ' -s -p ' + path, 'r')
+ ' -s ' + path, 'r')
+ hostname = "unknown"
+
+ try:
+ line = fin.readline()
+ hostname = line.split()[-1]
+ return hostname
+ finally:
+ fin.close()
+ return hostname
+
+ # Acquire a lock for the domain. No-op if domain locking is turned off.
+ def acquire_running_lock(self):
@ -229,12 +228,12 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
+ log.exception("%s could not be created." % path)
+ raise XendError("%s could not be created." % path)
+
+ status = os.system('%s -l -p %s -n %s -i %s -h %s' % \
+ status = os.system('%s -l -p %s -n %s -i %s %s' % \
+ (xoptions.get_xend_domain_lock_utility(), \
+ path, \
+ XendNode.instance().get_name(), \
+ self.info['name_label'], \
+ self.info['uuid'], \
+ XendNode.instance().get_name()))
+ path))
+ if status != 0:
+ raise XendError('Acquire running lock failed: %s' % status)
+
@ -245,7 +244,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
+
+ path = xoptions.get_xend_domain_lock_path()
+ path = os.path.join(path, self.get_uuid())
+ status = os.system('%s -u -p %s' % \
+ status = os.system('%s -u %s' % \
+ (xoptions.get_xend_domain_lock_utility(), \
+ path))
+ if status != 0: