OBS User unknown 2008-10-11 14:22:01 +00:00 committed by Git OBS Bridge
parent b834258fb8
commit 71babd6d75
37 changed files with 1751 additions and 733 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);
@@ -3637,9 +3850,8 @@ static int ptwr_emulated_update(
@@ -3617,9 +3830,8 @@ static int ptwr_emulated_update(
nl1e = l1e_from_intpte(val);
if ( unlikely(!get_page_from_l1e(nl1e, d)) )
{

View File

@ -10,7 +10,7 @@ Index: xen-3.3.1-testing/xen/common/domain.c
===================================================================
--- xen-3.3.1-testing.orig/xen/common/domain.c
+++ xen-3.3.1-testing/xen/common/domain.c
@@ -651,9 +651,11 @@ void vcpu_reset(struct vcpu *v)
@@ -670,9 +670,11 @@ void vcpu_reset(struct vcpu *v)
set_bit(_VPF_down, &v->pause_flags);
@ -27,7 +27,7 @@ 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
@@ -545,6 +545,7 @@ out:
@@ -534,6 +534,7 @@ out:
static int evtchn_set_pending(struct vcpu *v, int port)
{
struct domain *d = v->domain;
@ -35,7 +35,7 @@ Index: xen-3.3.1-testing/xen/common/event_channel.c
/*
* The following bit operations must happen in strict order.
@@ -564,15 +565,19 @@ static int evtchn_set_pending(struct vcp
@@ -553,15 +554,19 @@ static int evtchn_set_pending(struct vcp
}
/* Check if some VCPU might be polling for this event. */
@ -212,7 +212,7 @@ Index: xen-3.3.1-testing/xen/include/xen/sched.h
/* Guest has shut down (inc. reason code)? */
spinlock_t shutdown_lock;
bool_t is_shutting_down; /* in process of shutting down? */
@@ -507,6 +513,7 @@ static inline int vcpu_runnable(struct v
@@ -514,6 +520,7 @@ static inline int vcpu_runnable(struct v
atomic_read(&v->domain->pause_count));
}
@ -220,7 +220,7 @@ Index: xen-3.3.1-testing/xen/include/xen/sched.h
void vcpu_pause(struct vcpu *v);
void vcpu_pause_nosync(struct vcpu *v);
void domain_pause(struct domain *d);
@@ -523,12 +530,6 @@ void vcpu_unlock_affinity(struct vcpu *v
@@ -530,12 +537,6 @@ void vcpu_unlock_affinity(struct vcpu *v
void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate);

View File

@ -203,7 +203,7 @@ 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
@@ -524,6 +524,7 @@ void domain_unpause_by_systemcontroller(
@@ -531,6 +531,7 @@ void domain_unpause_by_systemcontroller(
void cpu_init(void);
void vcpu_force_reschedule(struct vcpu *v);

View File

@ -1,76 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1221576857 -3600
# Node ID 15efb62ecf09efd07105b10a3b0b84eecfe8ec8f
# Parent d7be37824fe0345b02d0fa8cc9aff01be1a2ba1f
x86: also fix powernow's dom_mask
Just like for the Intel/ACPI cpufreq code, powernow's dom_mask also
must not be confined to the number of CPUs in the system.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/powernow.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/acpi/cpufreq/powernow.c
+++ xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/powernow.c
@@ -241,9 +241,8 @@ int powernow_cpufreq_init(void)
{
unsigned int i, ret = 0;
unsigned int dom, max_dom = 0;
- cpumask_t *pt, dom_mask;
-
- cpus_clear(dom_mask);
+ cpumask_t *pt;
+ unsigned long *dom_mask;
for_each_online_cpu(i) {
struct cpuinfo_x86 *c = &cpu_data[i];
@@ -258,20 +257,26 @@ int powernow_cpufreq_init(void)
}
if (ret)
return ret;
- cpu_set(processor_pminfo[i].perf.domain_info.domain, dom_mask);
if (max_dom < processor_pminfo[i].perf.domain_info.domain)
max_dom = processor_pminfo[i].perf.domain_info.domain;
}
max_dom++;
+ dom_mask = xmalloc_array(unsigned long, BITS_TO_LONGS(max_dom));
+ if (!dom_mask)
+ return -ENOMEM;
+ bitmap_zero(dom_mask, max_dom);
+
pt = xmalloc_array(cpumask_t, max_dom);
if (!pt)
return -ENOMEM;
memset(pt, 0, max_dom * sizeof(cpumask_t));
/* get cpumask of each psd domain */
- for_each_online_cpu(i)
+ for_each_online_cpu(i) {
+ __set_bit(processor_pminfo[i].perf.domain_info.domain, dom_mask);
cpu_set(i, pt[processor_pminfo[i].perf.domain_info.domain]);
+ }
for_each_online_cpu(i)
processor_pminfo[i].perf.shared_cpu_map =
@@ -289,8 +294,8 @@ int powernow_cpufreq_init(void)
}
/* setup ondemand cpufreq */
- for (dom=0; dom<max_dom; dom++) {
- if (!cpu_isset(dom, dom_mask))
+ for (dom = 0; dom < max_dom; dom++) {
+ if (!test_bit(dom, dom_mask))
continue;
i = first_cpu(pt[dom]);
ret = cpufreq_governor_dbs(&xen_px_policy[i], CPUFREQ_GOV_START);
@@ -300,6 +305,7 @@ int powernow_cpufreq_init(void)
cpufreq_init_out:
xfree(pt);
+ xfree(dom_mask);
return ret;
}

View File

@ -1,63 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1221577042 -3600
# Node ID 9ab9dadf4876fcab63fcc2e3a8ad13e87b1a8293
# Parent 15efb62ecf09efd07105b10a3b0b84eecfe8ec8f
x86-64: enforce memory limits imposed by virtual memory layout
... which currently means:
- The 1:1 map cannot deal with more than 1Tb.
- The m2p table can handle at most 8Tb.
- The page_info array can cover up to e.g. 1.6Gb (<=3D 64 CPUs) or
1Tb (193-256 CPUs).
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-3.3.1-testing/xen/arch/x86/e820.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/e820.c
+++ xen-3.3.1-testing/xen/arch/x86/e820.c
@@ -4,6 +4,7 @@
#include <xen/compat.h>
#include <xen/dmi.h>
#include <asm/e820.h>
+#include <asm/mm.h>
#include <asm/page.h>
/* opt_mem: Limit of physical RAM. Any RAM beyond this point is ignored. */
@@ -327,7 +328,7 @@ static void __init clip_to_limit(uint64_
continue;
if ( warnmsg )
{
- snprintf(_warnmsg, sizeof(_warnmsg), warnmsg, (int)(limit>>30));
+ snprintf(_warnmsg, sizeof(_warnmsg), warnmsg, (long)(limit>>30));
printk("WARNING: %s\n", _warnmsg);
}
printk("Truncating memory map to %lukB\n",
@@ -366,8 +367,25 @@ static void __init machine_specific_memo
#ifdef __i386__
clip_to_limit((1ULL << 30) * MACHPHYS_MBYTES,
- "Only the first %u GB of the physical memory map "
+ "Only the first %lu GB of the physical memory map "
"can be accessed by Xen in 32-bit mode.");
+#else
+ {
+ unsigned long limit, mpt_limit, pft_limit;
+
+ limit = DIRECTMAP_VIRT_END - DIRECTMAP_VIRT_START;
+ mpt_limit = ((RDWR_MPT_VIRT_END - RDWR_MPT_VIRT_START)
+ / sizeof(unsigned long)) << PAGE_SHIFT;
+ pft_limit = ((FRAMETABLE_VIRT_END - FRAMETABLE_VIRT_START)
+ / sizeof(struct page_info)) << PAGE_SHIFT;
+ if ( limit > mpt_limit )
+ limit = mpt_limit;
+ if ( limit > pft_limit )
+ limit = pft_limit;
+ clip_to_limit(limit,
+ "Only the first %lu GB of the physical "
+ "memory map can be accessed by Xen.");
+ }
#endif
reserve_dmi_region();

View File

@ -126,7 +126,7 @@ 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
@@ -527,6 +527,7 @@ void vcpu_force_reschedule(struct vcpu *
@@ -534,6 +534,7 @@ void vcpu_force_reschedule(struct vcpu *
void cpu_disable_scheduler(void);
int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity);
int vcpu_lock_affinity(struct vcpu *v, cpumask_t *affinity);

719
18520-per-CPU-GDT.patch Normal file
View File

@ -0,0 +1,719 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1222087617 -3600
# Node ID 7f1a36b834e183904f069948d3037d50492d98d2
# Parent 3c42b5ad0a4f607749426f82ecf11f75d84699c5
x86: make GDT per-CPU
The major issue with supporting a significantly larger number of
physical CPUs appears to be the use of per-CPU GDT entries - at
present, x86-64 could support only up to 126 CPUs (with code changes
to also use the top-most GDT page, that would be 254). Instead of
trying to go with incremental steps here, by converting the GDT itself
to be per-CPU, limitations in that respect go away entirely.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-3.3.1-testing/xen/arch/x86/boot/wakeup.S
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/boot/wakeup.S
+++ xen-3.3.1-testing/xen/arch/x86/boot/wakeup.S
@@ -168,7 +168,7 @@ wakeup_32:
.word 0,0,0
lgdt_descr:
.word LAST_RESERVED_GDT_BYTE
- .quad gdt_table - FIRST_RESERVED_GDT_BYTE
+ .quad boot_cpu_gdt_table - FIRST_RESERVED_GDT_BYTE
wakeup_64:
lgdt lgdt_descr(%rip)
Index: xen-3.3.1-testing/xen/arch/x86/boot/x86_32.S
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/boot/x86_32.S
+++ xen-3.3.1-testing/xen/arch/x86/boot/x86_32.S
@@ -78,7 +78,7 @@ idt_descr:
.word 0
gdt_descr:
.word LAST_RESERVED_GDT_BYTE
- .long gdt_table - FIRST_RESERVED_GDT_BYTE
+ .long boot_cpu_gdt_table - FIRST_RESERVED_GDT_BYTE
.align 32
@@ -94,7 +94,7 @@ ENTRY(idle_pg_table)
#define GUEST_DESC(d) \
.long ((MACH2PHYS_VIRT_END - 1) >> 12) & 0xffff, \
((MACH2PHYS_VIRT_END - 1) >> 12) & (0xf << 16) | (d)
-ENTRY(gdt_table)
+ENTRY(boot_cpu_gdt_table)
.quad 0x0000000000000000 /* unused */
.quad 0x00cf9a000000ffff /* 0xe008 ring 0 4.00GB code at 0x0 */
.quad 0x00cf92000000ffff /* 0xe010 ring 0 4.00GB data at 0x0 */
@@ -102,4 +102,6 @@ ENTRY(gdt_table)
GUEST_DESC(0x00c0b200) /* 0xe021 ring 1 3.xxGB data at 0x0 */
GUEST_DESC(0x00c0fa00) /* 0xe02b ring 3 3.xxGB code at 0x0 */
GUEST_DESC(0x00c0f200) /* 0xe033 ring 3 3.xxGB data at 0x0 */
+ .fill (PER_CPU_GDT_ENTRY - FLAT_RING3_DS / 8 - 1), 8, 0
+ .quad 0x0000910000000000 /* per-CPU entry (limit == cpu) */
.align PAGE_SIZE,0
Index: xen-3.3.1-testing/xen/arch/x86/boot/x86_64.S
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/boot/x86_64.S
+++ xen-3.3.1-testing/xen/arch/x86/boot/x86_64.S
@@ -85,7 +85,7 @@ multiboot_ptr:
.word 0
gdt_descr:
.word LAST_RESERVED_GDT_BYTE
- .quad gdt_table - FIRST_RESERVED_GDT_BYTE
+ .quad boot_cpu_gdt_table - FIRST_RESERVED_GDT_BYTE
.word 0,0,0
idt_descr:
@@ -96,7 +96,7 @@ ENTRY(stack_start)
.quad cpu0_stack
.align PAGE_SIZE, 0
-ENTRY(gdt_table)
+ENTRY(boot_cpu_gdt_table)
.quad 0x0000000000000000 /* unused */
.quad 0x00af9a000000ffff /* 0xe008 ring 0 code, 64-bit mode */
.quad 0x00cf92000000ffff /* 0xe010 ring 0 data */
@@ -105,11 +105,13 @@ ENTRY(gdt_table)
.quad 0x00cff2000000ffff /* 0xe02b ring 3 data */
.quad 0x00affa000000ffff /* 0xe033 ring 3 code, 64-bit mode */
.quad 0x00cf9a000000ffff /* 0xe038 ring 0 code, compatibility */
+ .fill (PER_CPU_GDT_ENTRY - __HYPERVISOR_CS32 / 8 - 1), 8, 0
+ .quad 0x0000910000000000 /* per-CPU entry (limit == cpu) */
.align PAGE_SIZE, 0
/* NB. Even rings != 0 get access to the full 4Gb, as only the */
/* (compatibility) machine->physical mapping table lives there. */
-ENTRY(compat_gdt_table)
+ENTRY(boot_cpu_compat_gdt_table)
.quad 0x0000000000000000 /* unused */
.quad 0x00af9a000000ffff /* 0xe008 ring 0 code, 64-bit mode */
.quad 0x00cf92000000ffff /* 0xe010 ring 0 data */
@@ -118,4 +120,6 @@ ENTRY(compat_gdt_table)
.quad 0x00cffa000000ffff /* 0xe02b ring 3 code, compatibility */
.quad 0x00cff2000000ffff /* 0xe033 ring 3 data */
.quad 0x00cf9a000000ffff /* 0xe038 ring 0 code, compatibility */
+ .fill (PER_CPU_GDT_ENTRY - __HYPERVISOR_CS32 / 8 - 1), 8, 0
+ .quad 0x0000910000000000 /* per-CPU entry (limit == cpu) */
.align PAGE_SIZE, 0
Index: xen-3.3.1-testing/xen/arch/x86/cpu/common.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/cpu/common.c
+++ xen-3.3.1-testing/xen/arch/x86/cpu/common.c
@@ -575,6 +575,9 @@ void __cpuinit cpu_init(void)
if (cpu_has_pat)
wrmsrl(MSR_IA32_CR_PAT, host_pat);
+ /* Install correct page table. */
+ write_ptbase(current);
+
*(unsigned short *)(&gdt_load[0]) = LAST_RESERVED_GDT_BYTE;
*(unsigned long *)(&gdt_load[2]) = GDT_VIRT_START(current);
asm volatile ( "lgdt %0" : "=m" (gdt_load) );
@@ -605,9 +608,6 @@ void __cpuinit cpu_init(void)
#define CD(register) asm volatile ( "mov %0,%%db" #register : : "r"(0UL) );
CD(0); CD(1); CD(2); CD(3); /* no db4 and db5 */; CD(6); CD(7);
#undef CD
-
- /* Install correct page table. */
- write_ptbase(current);
}
#ifdef CONFIG_HOTPLUG_CPU
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
@@ -211,7 +211,6 @@ static inline int may_switch_mode(struct
int switch_native(struct domain *d)
{
- l1_pgentry_t gdt_l1e;
unsigned int vcpuid;
if ( d == NULL )
@@ -223,12 +222,8 @@ int switch_native(struct domain *d)
d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 0;
- /* switch gdt */
- gdt_l1e = l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
for ( vcpuid = 0; vcpuid < MAX_VIRT_CPUS; vcpuid++ )
{
- d->arch.mm_perdomain_pt[((vcpuid << GDT_LDT_VCPU_SHIFT) +
- FIRST_RESERVED_GDT_PAGE)] = gdt_l1e;
if (d->vcpu[vcpuid])
release_compat_l4(d->vcpu[vcpuid]);
}
@@ -238,7 +233,6 @@ int switch_native(struct domain *d)
int switch_compat(struct domain *d)
{
- l1_pgentry_t gdt_l1e;
unsigned int vcpuid;
if ( d == NULL )
@@ -250,15 +244,11 @@ int switch_compat(struct domain *d)
d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 1;
- /* switch gdt */
- gdt_l1e = l1e_from_page(virt_to_page(compat_gdt_table), PAGE_HYPERVISOR);
for ( vcpuid = 0; vcpuid < MAX_VIRT_CPUS; vcpuid++ )
{
if ( (d->vcpu[vcpuid] != NULL) &&
(setup_compat_l4(d->vcpu[vcpuid]) != 0) )
goto undo_and_fail;
- d->arch.mm_perdomain_pt[((vcpuid << GDT_LDT_VCPU_SHIFT) +
- FIRST_RESERVED_GDT_PAGE)] = gdt_l1e;
}
domain_set_alloc_bitsize(d);
@@ -267,13 +257,10 @@ int switch_compat(struct domain *d)
undo_and_fail:
d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 0;
- gdt_l1e = l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
while ( vcpuid-- != 0 )
{
if ( d->vcpu[vcpuid] != NULL )
release_compat_l4(d->vcpu[vcpuid]);
- d->arch.mm_perdomain_pt[((vcpuid << GDT_LDT_VCPU_SHIFT) +
- FIRST_RESERVED_GDT_PAGE)] = gdt_l1e;
}
return -ENOMEM;
}
@@ -322,7 +309,12 @@ int vcpu_initialise(struct vcpu *v)
if ( is_idle_domain(d) )
{
v->arch.schedule_tail = continue_idle_domain;
- v->arch.cr3 = __pa(idle_pg_table);
+ if ( v->vcpu_id )
+ v->arch.cr3 = d->vcpu[0]->arch.cr3;
+ else if ( !*idle_vcpu )
+ v->arch.cr3 = __pa(idle_pg_table);
+ else if ( !(v->arch.cr3 = clone_idle_pagetable(v)) )
+ return -ENOMEM;
}
v->arch.guest_context.ctrlreg[4] =
@@ -349,8 +341,7 @@ int arch_domain_create(struct domain *d,
#ifdef __x86_64__
struct page_info *pg;
#endif
- l1_pgentry_t gdt_l1e;
- int i, vcpuid, pdpt_order, paging_initialised = 0;
+ int i, pdpt_order, paging_initialised = 0;
int rc = -ENOMEM;
d->arch.hvm_domain.hap_enabled =
@@ -369,18 +360,6 @@ int arch_domain_create(struct domain *d,
goto fail;
memset(d->arch.mm_perdomain_pt, 0, PAGE_SIZE << pdpt_order);
- /*
- * Map Xen segments into every VCPU's GDT, irrespective of whether every
- * VCPU will actually be used. This avoids an NMI race during context
- * switch: if we take an interrupt after switching CR3 but before switching
- * GDT, and the old VCPU# is invalid in the new domain, we would otherwise
- * try to load CS from an invalid table.
- */
- gdt_l1e = l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
- for ( vcpuid = 0; vcpuid < MAX_VIRT_CPUS; vcpuid++ )
- d->arch.mm_perdomain_pt[((vcpuid << GDT_LDT_VCPU_SHIFT) +
- FIRST_RESERVED_GDT_PAGE)] = gdt_l1e;
-
#if defined(__i386__)
mapcache_domain_init(d);
@@ -1193,9 +1172,12 @@ static void paravirt_ctxt_switch_to(stru
static void __context_switch(void)
{
struct cpu_user_regs *stack_regs = guest_cpu_user_regs();
- unsigned int cpu = smp_processor_id();
+ unsigned int i, cpu = smp_processor_id();
struct vcpu *p = per_cpu(curr_vcpu, cpu);
struct vcpu *n = current;
+ struct desc_struct *gdt;
+ struct page_info *page;
+ struct desc_ptr gdt_desc;
ASSERT(p != n);
ASSERT(cpus_empty(n->vcpu_dirty_cpumask));
@@ -1221,14 +1203,30 @@ static void __context_switch(void)
cpu_set(cpu, n->domain->domain_dirty_cpumask);
cpu_set(cpu, n->vcpu_dirty_cpumask);
+ gdt = !is_pv_32on64_vcpu(n) ? per_cpu(gdt_table, cpu) :
+ per_cpu(compat_gdt_table, cpu);
+ page = virt_to_page(gdt);
+ for (i = 0; i < NR_RESERVED_GDT_PAGES; ++i)
+ {
+ l1e_write(n->domain->arch.mm_perdomain_pt +
+ (n->vcpu_id << GDT_LDT_VCPU_SHIFT) +
+ FIRST_RESERVED_GDT_PAGE + i,
+ l1e_from_page(page + i, __PAGE_HYPERVISOR));
+ }
+
+ if ( p->vcpu_id != n->vcpu_id )
+ {
+ gdt_desc.limit = LAST_RESERVED_GDT_BYTE;
+ gdt_desc.base = (unsigned long)(gdt - FIRST_RESERVED_GDT_ENTRY);
+ asm volatile ( "lgdt %0" : : "m" (gdt_desc) );
+ }
+
write_ptbase(n);
if ( p->vcpu_id != n->vcpu_id )
{
- char gdt_load[10];
- *(unsigned short *)(&gdt_load[0]) = LAST_RESERVED_GDT_BYTE;
- *(unsigned long *)(&gdt_load[2]) = GDT_VIRT_START(n);
- asm volatile ( "lgdt %0" : "=m" (gdt_load) );
+ gdt_desc.base = GDT_VIRT_START(n);
+ asm volatile ( "lgdt %0" : : "m" (gdt_desc) );
}
if ( p->domain != n->domain )
@@ -1279,8 +1277,6 @@ void context_switch(struct vcpu *prev, s
uint64_t efer = read_efer();
if ( !(efer & EFER_SCE) )
write_efer(efer | EFER_SCE);
- flush_tlb_one_local(GDT_VIRT_START(next) +
- FIRST_RESERVED_GDT_BYTE);
}
#endif
Index: xen-3.3.1-testing/xen/arch/x86/domain_build.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/domain_build.c
+++ xen-3.3.1-testing/xen/arch/x86/domain_build.c
@@ -314,24 +314,11 @@ int __init construct_dom0(
#if defined(__x86_64__)
if ( compat32 )
{
- l1_pgentry_t gdt_l1e;
-
d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 1;
v->vcpu_info = (void *)&d->shared_info->compat.vcpu_info[0];
if ( nr_pages != (unsigned int)nr_pages )
nr_pages = UINT_MAX;
-
- /*
- * Map compatibility Xen segments into every VCPU's GDT. See
- * arch_domain_create() for further comments.
- */
- gdt_l1e = l1e_from_page(virt_to_page(compat_gdt_table),
- PAGE_HYPERVISOR);
- for ( i = 0; i < MAX_VIRT_CPUS; i++ )
- d->arch.mm_perdomain_pt[((i << GDT_LDT_VCPU_SHIFT) +
- FIRST_RESERVED_GDT_PAGE)] = gdt_l1e;
- flush_tlb_one_local(GDT_LDT_VIRT_START + FIRST_RESERVED_GDT_BYTE);
}
#endif
Index: xen-3.3.1-testing/xen/arch/x86/hvm/vmx/vmcs.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/hvm/vmx/vmcs.c
+++ xen-3.3.1-testing/xen/arch/x86/hvm/vmx/vmcs.c
@@ -446,7 +446,7 @@ static void vmx_set_host_env(struct vcpu
__vmwrite(HOST_IDTR_BASE, (unsigned long)idt_tables[cpu]);
- __vmwrite(HOST_TR_SELECTOR, __TSS(cpu) << 3);
+ __vmwrite(HOST_TR_SELECTOR, TSS_ENTRY << 3);
__vmwrite(HOST_TR_BASE, (unsigned long)&init_tss[cpu]);
__vmwrite(HOST_SYSENTER_ESP, get_stack_bottom());
Index: xen-3.3.1-testing/xen/arch/x86/setup.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/setup.c
+++ xen-3.3.1-testing/xen/arch/x86/setup.c
@@ -115,6 +115,12 @@ extern void early_cpu_init(void);
extern void vesa_init(void);
extern void vesa_mtrr_init(void);
+DEFINE_PER_CPU(struct desc_struct *, gdt_table) = boot_cpu_gdt_table;
+#ifdef CONFIG_COMPAT
+DEFINE_PER_CPU(struct desc_struct *, compat_gdt_table)
+ = boot_cpu_compat_gdt_table;
+#endif
+
struct tss_struct init_tss[NR_CPUS];
char __attribute__ ((__section__(".bss.stack_aligned"))) cpu0_stack[STACK_SIZE];
@@ -224,6 +230,7 @@ static void __init percpu_init_areas(voi
static void __init init_idle_domain(void)
{
struct domain *idle_domain;
+ unsigned int i;
/* Domain creation requires that scheduler structures are initialised. */
scheduler_init();
@@ -236,6 +243,12 @@ static void __init init_idle_domain(void
idle_vcpu[0] = this_cpu(curr_vcpu) = current;
setup_idle_pagetable();
+
+ for (i = 0; i < NR_RESERVED_GDT_PAGES; ++i)
+ idle_domain->arch.mm_perdomain_pt[FIRST_RESERVED_GDT_PAGE + i] =
+ l1e_from_page(virt_to_page(boot_cpu_gdt_table) + i,
+ __PAGE_HYPERVISOR);
+
}
static void __init srat_detect_node(int cpu)
@@ -443,7 +456,6 @@ void __init __start_xen(unsigned long mb
parse_video_info();
set_current((struct vcpu *)0xfffff000); /* debug sanity */
- idle_vcpu[0] = current;
set_processor_id(0); /* needed early, for smp_processor_id() */
if ( cpu_has_efer )
rdmsrl(MSR_EFER, this_cpu(efer));
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
*/
{
unsigned long boot_error;
+ unsigned int i;
int timeout;
unsigned long start_eip;
unsigned short nmi_high = 0, nmi_low = 0;
struct vcpu *v;
+ struct desc_struct *gdt;
+#ifdef __x86_64__
+ struct page_info *page;
+#endif
/*
* Save current MTRR state in case it was changed since early boot
@@ -864,6 +869,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);
+ gdt = per_cpu(gdt_table, cpu);
+ if (gdt == boot_cpu_gdt_table) {
+ i = get_order_from_pages(NR_RESERVED_GDT_PAGES);
+#ifdef __x86_64__
+#ifdef CONFIG_COMPAT
+ page = alloc_domheap_pages(NULL, i,
+ MEMF_node(cpu_to_node(cpu)));
+ per_cpu(compat_gdt_table, cpu) = gdt = page_to_virt(page);
+ memcpy(gdt, boot_cpu_compat_gdt_table,
+ NR_RESERVED_GDT_PAGES * PAGE_SIZE);
+ gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a = cpu;
+#endif
+ page = alloc_domheap_pages(NULL, i,
+ MEMF_node(cpu_to_node(cpu)));
+ per_cpu(gdt_table, cpu) = gdt = page_to_virt(page);
+#else
+ per_cpu(gdt_table, cpu) = gdt = alloc_xenheap_pages(i);
+#endif
+ memcpy(gdt, boot_cpu_gdt_table,
+ NR_RESERVED_GDT_PAGES * PAGE_SIZE);
+ BUILD_BUG_ON(NR_CPUS > 0x10000);
+ gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a = cpu;
+ }
+
+ for (i = 0; i < NR_RESERVED_GDT_PAGES; ++i)
+ v->domain->arch.mm_perdomain_pt
+ [(v->vcpu_id << GDT_LDT_VCPU_SHIFT) +
+ FIRST_RESERVED_GDT_PAGE + i]
+ = l1e_from_page(virt_to_page(gdt) + i,
+ __PAGE_HYPERVISOR);
+
/*
* This grunge runs the startup process for
* the targeted processor.
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
@@ -2960,13 +2960,13 @@ void set_intr_gate(unsigned int n, void
void set_tss_desc(unsigned int n, void *addr)
{
_set_tssldt_desc(
- gdt_table + __TSS(n) - FIRST_RESERVED_GDT_ENTRY,
+ per_cpu(gdt_table, n) + TSS_ENTRY - FIRST_RESERVED_GDT_ENTRY,
(unsigned long)addr,
offsetof(struct tss_struct, __cacheline_filler) - 1,
9);
#ifdef CONFIG_COMPAT
_set_tssldt_desc(
- compat_gdt_table + __TSS(n) - FIRST_RESERVED_GDT_ENTRY,
+ per_cpu(compat_gdt_table, n) + TSS_ENTRY - FIRST_RESERVED_GDT_ENTRY,
(unsigned long)addr,
offsetof(struct tss_struct, __cacheline_filler) - 1,
11);
Index: xen-3.3.1-testing/xen/arch/x86/x86_32/mm.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/x86_32/mm.c
+++ xen-3.3.1-testing/xen/arch/x86/x86_32/mm.c
@@ -132,6 +132,30 @@ void __init setup_idle_pagetable(void)
__PAGE_HYPERVISOR));
}
+unsigned long clone_idle_pagetable(struct vcpu *v)
+{
+ unsigned int i;
+ struct domain *d = v->domain;
+ l3_pgentry_t *l3_table = v->arch.pae_l3_cache.table[0];
+ l2_pgentry_t *l2_table = alloc_xenheap_page();
+
+ if ( !l2_table )
+ return 0;
+
+ memcpy(l3_table, idle_pg_table, L3_PAGETABLE_ENTRIES * sizeof(*l3_table));
+ l3_table[l3_table_offset(PERDOMAIN_VIRT_START)] =
+ l3e_from_page(virt_to_page(l2_table), _PAGE_PRESENT);
+
+ copy_page(l2_table, idle_pg_table_l2 +
+ l3_table_offset(PERDOMAIN_VIRT_START) * L2_PAGETABLE_ENTRIES);
+ for ( i = 0; i < PDPT_L2_ENTRIES; ++i )
+ l2_table[l2_table_offset(PERDOMAIN_VIRT_START) + i] =
+ l2e_from_page(virt_to_page(d->arch.mm_perdomain_pt) + i,
+ __PAGE_HYPERVISOR);
+
+ return __pa(l3_table);
+}
+
void __init zap_low_mappings(l2_pgentry_t *dom0_l2)
{
int i;
@@ -186,7 +210,7 @@ void __init subarch_init_memory(void)
{
/* Guest kernel runs in ring 0, not ring 1. */
struct desc_struct *d;
- d = &gdt_table[(FLAT_RING1_CS >> 3) - FIRST_RESERVED_GDT_ENTRY];
+ d = &boot_cpu_gdt_table[(FLAT_RING1_CS >> 3) - FIRST_RESERVED_GDT_ENTRY];
d[0].b &= ~_SEGMENT_DPL;
d[1].b &= ~_SEGMENT_DPL;
}
Index: xen-3.3.1-testing/xen/arch/x86/x86_32/supervisor_mode_kernel.S
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/x86_32/supervisor_mode_kernel.S
+++ xen-3.3.1-testing/xen/arch/x86/x86_32/supervisor_mode_kernel.S
@@ -100,15 +100,10 @@ ENTRY(fixup_ring0_guest_stack)
# %gs:%esi now points to the guest stack before the
# interrupt/exception occured.
- /*
- * Reverse the __TSS macro, giving us the CPU number.
- * The TSS for this cpu is at init_tss + ( cpu * 128 ).
- */
- str %ecx
- shrl $3,%ecx # Calculate GDT index for TSS.
- subl $(FIRST_RESERVED_GDT_ENTRY+8),%ecx # %ecx = 2*cpu.
- shll $6,%ecx # Each TSS entry is 0x80 bytes
- addl $init_tss,%ecx # but we have 2*cpu from above.
+ movl $PER_CPU_GDT_ENTRY*8,%ecx
+ lsll %ecx,%ecx
+ shll $7,%ecx # Each TSS entry is 0x80 bytes
+ addl $init_tss,%ecx
# Load Xen stack from TSS.
movw TSS_ss0(%ecx),%ax
Index: xen-3.3.1-testing/xen/arch/x86/x86_32/traps.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/x86_32/traps.c
+++ xen-3.3.1-testing/xen/arch/x86/x86_32/traps.c
@@ -194,13 +194,15 @@ static unsigned char doublefault_stack[D
asmlinkage void do_double_fault(void)
{
- struct tss_struct *tss = &doublefault_tss;
- unsigned int cpu = ((tss->back_link>>3)-__FIRST_TSS_ENTRY)>>1;
+ struct tss_struct *tss;
+ unsigned int cpu;
watchdog_disable();
console_force_unlock();
+ asm ( "lsll %1, %0" : "=r" (cpu) : "rm" (PER_CPU_GDT_ENTRY << 3) );
+
/* Find information saved during fault and dump it to the console. */
tss = &init_tss[cpu];
printk("*** DOUBLE FAULT ***\n");
@@ -325,7 +327,7 @@ void __devinit subarch_percpu_traps_init
tss->eflags = 2;
tss->bitmap = IOBMP_INVALID_OFFSET;
_set_tssldt_desc(
- gdt_table + __DOUBLEFAULT_TSS_ENTRY - FIRST_RESERVED_GDT_ENTRY,
+ boot_cpu_gdt_table + __DOUBLEFAULT_TSS_ENTRY - FIRST_RESERVED_GDT_ENTRY,
(unsigned long)tss, 235, 9);
set_task_gate(TRAP_double_fault, __DOUBLEFAULT_TSS_ENTRY<<3);
Index: xen-3.3.1-testing/xen/arch/x86/x86_64/mm.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/x86_64/mm.c
+++ xen-3.3.1-testing/xen/arch/x86/x86_64/mm.c
@@ -21,6 +21,7 @@
#include <xen/lib.h>
#include <xen/init.h>
#include <xen/mm.h>
+#include <xen/numa.h>
#include <xen/sched.h>
#include <xen/guest_access.h>
#include <asm/current.h>
@@ -206,6 +207,24 @@ void __init setup_idle_pagetable(void)
__PAGE_HYPERVISOR));
}
+unsigned long clone_idle_pagetable(struct vcpu *v)
+{
+ struct domain *d = v->domain;
+ struct page_info *page = alloc_domheap_page(NULL,
+ MEMF_node(vcpu_to_node(v)));
+ l4_pgentry_t *l4_table = page_to_virt(page);
+
+ if ( !page )
+ return 0;
+
+ copy_page(l4_table, idle_pg_table);
+ l4_table[l4_table_offset(PERDOMAIN_VIRT_START)] =
+ l4e_from_page(virt_to_page(d->arch.mm_perdomain_l3),
+ __PAGE_HYPERVISOR);
+
+ return __pa(l4_table);
+}
+
void __init zap_low_mappings(void)
{
BUG_ON(num_online_cpus() != 1);
Index: xen-3.3.1-testing/xen/arch/x86/x86_64/traps.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/x86_64/traps.c
+++ xen-3.3.1-testing/xen/arch/x86/x86_64/traps.c
@@ -213,15 +213,14 @@ void show_page_walk(unsigned long addr)
asmlinkage void double_fault(void);
asmlinkage void do_double_fault(struct cpu_user_regs *regs)
{
- unsigned int cpu, tr;
-
- asm volatile ( "str %0" : "=r" (tr) );
- cpu = ((tr >> 3) - __FIRST_TSS_ENTRY) >> 2;
+ unsigned int cpu;
watchdog_disable();
console_force_unlock();
+ asm ( "lsll %1, %0" : "=r" (cpu) : "rm" (PER_CPU_GDT_ENTRY << 3) );
+
/* Find information saved during fault and dump it to the console. */
printk("*** DOUBLE FAULT ***\n");
print_xen_info();
Index: xen-3.3.1-testing/xen/include/asm-x86/desc.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/desc.h
+++ xen-3.3.1-testing/xen/include/asm-x86/desc.h
@@ -34,11 +34,9 @@
#define FLAT_COMPAT_USER_CS FLAT_COMPAT_RING3_CS
#define FLAT_COMPAT_USER_SS FLAT_COMPAT_RING3_SS
-#define __FIRST_TSS_ENTRY (FIRST_RESERVED_GDT_ENTRY + 8)
-#define __FIRST_LDT_ENTRY (__FIRST_TSS_ENTRY + 2)
-
-#define __TSS(n) (((n)<<2) + __FIRST_TSS_ENTRY)
-#define __LDT(n) (((n)<<2) + __FIRST_LDT_ENTRY)
+#define TSS_ENTRY (FIRST_RESERVED_GDT_ENTRY + 8)
+#define LDT_ENTRY (TSS_ENTRY + 2)
+#define PER_CPU_GDT_ENTRY (LDT_ENTRY + 2)
#elif defined(__i386__)
@@ -51,17 +49,15 @@
#define __DOUBLEFAULT_TSS_ENTRY FIRST_RESERVED_GDT_ENTRY
-#define __FIRST_TSS_ENTRY (FIRST_RESERVED_GDT_ENTRY + 8)
-#define __FIRST_LDT_ENTRY (__FIRST_TSS_ENTRY + 1)
-
-#define __TSS(n) (((n)<<1) + __FIRST_TSS_ENTRY)
-#define __LDT(n) (((n)<<1) + __FIRST_LDT_ENTRY)
+#define TSS_ENTRY (FIRST_RESERVED_GDT_ENTRY + 8)
+#define LDT_ENTRY (TSS_ENTRY + 1)
+#define PER_CPU_GDT_ENTRY (LDT_ENTRY + 1)
#endif
#ifndef __ASSEMBLY__
-#define load_TR(n) __asm__ __volatile__ ("ltr %%ax" : : "a" (__TSS(n)<<3) )
+#define load_TR(n) __asm__ __volatile__ ("ltr %%ax" : : "a" (TSS_ENTRY<<3) )
#if defined(__x86_64__)
#define GUEST_KERNEL_RPL(d) (is_pv_32bit_domain(d) ? 1 : 3)
@@ -205,11 +201,19 @@ do {
#endif
-extern struct desc_struct gdt_table[];
+struct desc_ptr {
+ unsigned short limit;
+ unsigned long base;
+} __attribute__((__packed__)) ;
+
+extern struct desc_struct boot_cpu_gdt_table[];
+DECLARE_PER_CPU(struct desc_struct *, gdt_table);
#ifdef CONFIG_COMPAT
-extern struct desc_struct compat_gdt_table[];
+extern struct desc_struct boot_cpu_compat_gdt_table[];
+DECLARE_PER_CPU(struct desc_struct *, compat_gdt_table);
#else
-# define compat_gdt_table gdt_table
+# define boot_cpu_compat_gdt_table boot_cpu_gdt_table
+# define per_cpu__compat_gdt_table per_cpu__gdt_table
#endif
extern void set_intr_gate(unsigned int irq, void * addr);
Index: xen-3.3.1-testing/xen/include/asm-x86/ldt.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/ldt.h
+++ xen-3.3.1-testing/xen/include/asm-x86/ldt.h
@@ -6,7 +6,6 @@
static inline void load_LDT(struct vcpu *v)
{
- unsigned int cpu;
struct desc_struct *desc;
unsigned long ents;
@@ -16,11 +15,11 @@ static inline void load_LDT(struct vcpu
}
else
{
- cpu = smp_processor_id();
- desc = (!is_pv_32on64_vcpu(v) ? gdt_table : compat_gdt_table)
- + __LDT(cpu) - FIRST_RESERVED_GDT_ENTRY;
+ desc = (!is_pv_32on64_vcpu(v)
+ ? this_cpu(gdt_table) : this_cpu(compat_gdt_table))
+ + LDT_ENTRY - FIRST_RESERVED_GDT_ENTRY;
_set_tssldt_desc(desc, LDT_VIRT_START(v), ents*8-1, 2);
- __asm__ __volatile__ ( "lldt %%ax" : : "a" (__LDT(cpu)<<3) );
+ __asm__ __volatile__ ( "lldt %%ax" : : "a" (LDT_ENTRY << 3) );
}
}
Index: xen-3.3.1-testing/xen/include/asm-x86/page.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/page.h
+++ xen-3.3.1-testing/xen/include/asm-x86/page.h
@@ -278,6 +278,7 @@ extern unsigned int m2p_compat_vstart;
#endif
void paging_init(void);
void setup_idle_pagetable(void);
+unsigned long clone_idle_pagetable(struct vcpu *);
#endif /* !defined(__ASSEMBLY__) */
#define _PAGE_PRESENT 0x001U

128
18521-per-CPU-TSS.patch Normal file
View File

@ -0,0 +1,128 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1222088424 -3600
# Node ID 6d3b932cbecac19bf71d7be51e4f4489089ed753
# Parent 7f1a36b834e183904f069948d3037d50492d98d2
i386: make double fault TSS per-CPU
As a follow-up to the per-CPU-GDT patch, this also makes the double
fault TSS (and the associated stack) per-CPU.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-3.3.1-testing/xen/arch/x86/boot/x86_32.S
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/boot/x86_32.S
+++ xen-3.3.1-testing/xen/arch/x86/boot/x86_32.S
@@ -95,7 +95,7 @@ ENTRY(idle_pg_table)
.long ((MACH2PHYS_VIRT_END - 1) >> 12) & 0xffff, \
((MACH2PHYS_VIRT_END - 1) >> 12) & (0xf << 16) | (d)
ENTRY(boot_cpu_gdt_table)
- .quad 0x0000000000000000 /* unused */
+ .quad 0x0000000000000000 /* double fault TSS */
.quad 0x00cf9a000000ffff /* 0xe008 ring 0 4.00GB code at 0x0 */
.quad 0x00cf92000000ffff /* 0xe010 ring 0 4.00GB data at 0x0 */
GUEST_DESC(0x00c0ba00) /* 0xe019 ring 1 3.xxGB code at 0x0 */
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
= l1e_from_page(virt_to_page(gdt) + i,
__PAGE_HYPERVISOR);
+#ifdef __i386__
+ if (!per_cpu(doublefault_tss, cpu)) {
+ per_cpu(doublefault_tss, cpu) = alloc_xenheap_page();
+ memset(per_cpu(doublefault_tss, cpu), 0, PAGE_SIZE);
+ }
+#endif
+
/*
* This grunge runs the startup process for
* the targeted processor.
Index: xen-3.3.1-testing/xen/arch/x86/x86_32/traps.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/x86_32/traps.c
+++ xen-3.3.1-testing/xen/arch/x86/x86_32/traps.c
@@ -188,9 +188,9 @@ void show_page_walk(unsigned long addr)
unmap_domain_page(l1t);
}
-#define DOUBLEFAULT_STACK_SIZE 2048
-static struct tss_struct doublefault_tss;
-static unsigned char doublefault_stack[DOUBLEFAULT_STACK_SIZE];
+DEFINE_PER_CPU(struct tss_struct *, doublefault_tss);
+static unsigned char __attribute__ ((__section__ (".bss.page_aligned")))
+ boot_cpu_doublefault_space[PAGE_SIZE];
asmlinkage void do_double_fault(void)
{
@@ -303,34 +303,36 @@ static void set_task_gate(unsigned int n
void __devinit subarch_percpu_traps_init(void)
{
- struct tss_struct *tss = &doublefault_tss;
+ struct tss_struct *tss = this_cpu(doublefault_tss);
asmlinkage int hypercall(void);
- if ( smp_processor_id() != 0 )
- return;
+ if ( !tss )
+ {
+ /* The hypercall entry vector is only accessible from ring 1. */
+ _set_gate(idt_table+HYPERCALL_VECTOR, 14, 1, &hypercall);
- /* The hypercall entry vector is only accessible from ring 1. */
- _set_gate(idt_table+HYPERCALL_VECTOR, 14, 1, &hypercall);
+ tss = (void *)boot_cpu_doublefault_space;
+ this_cpu(doublefault_tss) = tss;
+ }
/*
* Make a separate task for double faults. This will get us debug output if
* we blow the kernel stack.
*/
- memset(tss, 0, sizeof(*tss));
tss->ds = __HYPERVISOR_DS;
tss->es = __HYPERVISOR_DS;
tss->ss = __HYPERVISOR_DS;
- tss->esp = (unsigned long)&doublefault_stack[DOUBLEFAULT_STACK_SIZE];
+ tss->esp = (unsigned long)tss + PAGE_SIZE;
tss->__cr3 = __pa(idle_pg_table);
tss->cs = __HYPERVISOR_CS;
tss->eip = (unsigned long)do_double_fault;
tss->eflags = 2;
tss->bitmap = IOBMP_INVALID_OFFSET;
_set_tssldt_desc(
- boot_cpu_gdt_table + __DOUBLEFAULT_TSS_ENTRY - FIRST_RESERVED_GDT_ENTRY,
+ this_cpu(gdt_table) + DOUBLEFAULT_TSS_ENTRY - FIRST_RESERVED_GDT_ENTRY,
(unsigned long)tss, 235, 9);
- set_task_gate(TRAP_double_fault, __DOUBLEFAULT_TSS_ENTRY<<3);
+ set_task_gate(TRAP_double_fault, DOUBLEFAULT_TSS_ENTRY << 3);
}
void init_int80_direct_trap(struct vcpu *v)
Index: xen-3.3.1-testing/xen/include/asm-x86/desc.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/desc.h
+++ xen-3.3.1-testing/xen/include/asm-x86/desc.h
@@ -47,7 +47,7 @@
#define FLAT_COMPAT_USER_DS FLAT_USER_DS
#define FLAT_COMPAT_USER_SS FLAT_USER_SS
-#define __DOUBLEFAULT_TSS_ENTRY FIRST_RESERVED_GDT_ENTRY
+#define DOUBLEFAULT_TSS_ENTRY FIRST_RESERVED_GDT_ENTRY
#define TSS_ENTRY (FIRST_RESERVED_GDT_ENTRY + 8)
#define LDT_ENTRY (TSS_ENTRY + 1)
@@ -199,6 +199,8 @@ do {
(((u32)(addr) & 0x00FF0000U) >> 16); \
} while (0)
+DECLARE_PER_CPU(struct tss_struct *, doublefault_tss);
+
#endif
struct desc_ptr {

201
18523-per-CPU-misc.patch Normal file
View File

@ -0,0 +1,201 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1222090651 -3600
# Node ID c0db74e416626f34cf91b0eefe659bcfe8b43a35
# Parent ae24b533dc9d0d5ce05b34a1ef72917589b4e63d
Fix misc issues related to allowing support of more CPUs
This mainly means removing stack variables that (should) depend on
NR_CPUS (other than cpumask_t ones) and adjusting certain array sizes.
There's at least one open tools issue: The 'xm vcpu-pin' path assumes
a maximum of 64 CPU-s in many places.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-3.3.1-testing/xen/arch/x86/nmi.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/nmi.c
+++ xen-3.3.1-testing/xen/arch/x86/nmi.c
@@ -96,7 +96,7 @@ int nmi_active;
int __init check_nmi_watchdog (void)
{
- unsigned int prev_nmi_count[NR_CPUS];
+ static unsigned int __initdata prev_nmi_count[NR_CPUS];
int cpu;
if ( !nmi_watchdog )
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
Dprintk("CPU present map: %lx\n", physids_coerce(phys_cpu_present_map));
kicked = 1;
- for (bit = 0; kicked < NR_CPUS && bit < MAX_APICS; bit++) {
+ for (bit = 0; kicked < NR_CPUS && bit < NR_CPUS; bit++) {
apicid = cpu_present_to_apicid(bit);
/*
* Don't even attempt to start the boot CPU!
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
@@ -201,6 +201,9 @@ void *map_domain_page_global(unsigned lo
ASSERT(!in_irq() && local_irq_is_enabled());
+ /* At least half the ioremap space should be available to us. */
+ BUILD_BUG_ON(IOREMAP_VIRT_START + (IOREMAP_MBYTES << 19) >= FIXADDR_START);
+
spin_lock(&globalmap_lock);
idx = find_next_zero_bit(inuse, GLOBALMAP_BITS, inuse_cursor);
Index: xen-3.3.1-testing/xen/common/domctl.c
===================================================================
--- xen-3.3.1-testing.orig/xen/common/domctl.c
+++ xen-3.3.1-testing/xen/common/domctl.c
@@ -145,16 +145,23 @@ static unsigned int default_vcpu0_locati
{
struct domain *d;
struct vcpu *v;
- unsigned int i, cpu, cnt[NR_CPUS] = { 0 };
+ unsigned int i, cpu, nr_cpus, *cnt;
cpumask_t cpu_exclude_map;
/* Do an initial CPU placement. Pick the least-populated CPU. */
- rcu_read_lock(&domlist_read_lock);
- for_each_domain ( d )
- for_each_vcpu ( d, v )
- if ( !test_bit(_VPF_down, &v->pause_flags) )
- cnt[v->processor]++;
- rcu_read_unlock(&domlist_read_lock);
+ nr_cpus = last_cpu(cpu_possible_map) + 1;
+ cnt = xmalloc_array(unsigned int, nr_cpus);
+ if ( cnt )
+ {
+ memset(cnt, 0, nr_cpus * sizeof(*cnt));
+
+ rcu_read_lock(&domlist_read_lock);
+ for_each_domain ( d )
+ for_each_vcpu ( d, v )
+ if ( !test_bit(_VPF_down, &v->pause_flags) )
+ cnt[v->processor]++;
+ rcu_read_unlock(&domlist_read_lock);
+ }
/*
* If we're on a HT system, we only auto-allocate to a non-primary HT. We
@@ -172,10 +179,12 @@ static unsigned int default_vcpu0_locati
(cpus_weight(cpu_sibling_map[i]) > 1) )
continue;
cpus_or(cpu_exclude_map, cpu_exclude_map, cpu_sibling_map[i]);
- if ( cnt[i] <= cnt[cpu] )
+ if ( !cnt || cnt[i] <= cnt[cpu] )
cpu = i;
}
+ xfree(cnt);
+
return cpu;
}
Index: xen-3.3.1-testing/xen/common/sched_credit.c
===================================================================
--- xen-3.3.1-testing.orig/xen/common/sched_credit.c
+++ xen-3.3.1-testing/xen/common/sched_credit.c
@@ -1258,14 +1258,15 @@ csched_dump_pcpu(int cpu)
struct csched_pcpu *spc;
struct csched_vcpu *svc;
int loop;
+ char cpustr[100];
spc = CSCHED_PCPU(cpu);
runq = &spc->runq;
- printk(" sort=%d, sibling=0x%lx, core=0x%lx\n",
- spc->runq_sort_last,
- cpu_sibling_map[cpu].bits[0],
- cpu_core_map[cpu].bits[0]);
+ cpumask_scnprintf(cpustr, sizeof(cpustr), cpu_sibling_map[cpu]);
+ printk(" sort=%d, sibling=%s, ", spc->runq_sort_last, cpustr);
+ cpumask_scnprintf(cpustr, sizeof(cpustr), cpu_core_map[cpu]);
+ printk("core=%s\n", cpustr);
/* current VCPU */
svc = CSCHED_VCPU(per_cpu(schedule_data, cpu).curr);
@@ -1292,6 +1293,7 @@ csched_dump(void)
{
struct list_head *iter_sdom, *iter_svc;
int loop;
+ char idlers_buf[100];
printk("info:\n"
"\tncpus = %u\n"
@@ -1317,7 +1319,8 @@ csched_dump(void)
CSCHED_TICKS_PER_TSLICE,
CSCHED_TICKS_PER_ACCT);
- printk("idlers: 0x%lx\n", csched_priv.idlers.bits[0]);
+ cpumask_scnprintf(idlers_buf, sizeof(idlers_buf), csched_priv.idlers);
+ printk("idlers: %s\n", idlers_buf);
CSCHED_STATS_PRINTK();
Index: xen-3.3.1-testing/xen/common/sched_sedf.c
===================================================================
--- xen-3.3.1-testing.orig/xen/common/sched_sedf.c
+++ xen-3.3.1-testing/xen/common/sched_sedf.c
@@ -1298,8 +1298,18 @@ static int sedf_adjust_weights(struct xe
{
struct vcpu *p;
struct domain *d;
- int sumw[NR_CPUS] = { 0 };
- s_time_t sumt[NR_CPUS] = { 0 };
+ unsigned int nr_cpus = last_cpu(cpu_possible_map) + 1;
+ int *sumw = xmalloc_array(int, nr_cpus);
+ s_time_t *sumt = xmalloc_array(s_time_t, nr_cpus);
+
+ if ( !sumw || !sumt )
+ {
+ xfree(sumt);
+ xfree(sumw);
+ return -ENOMEM;
+ }
+ memset(sumw, 0, nr_cpus * sizeof(*sumw));
+ memset(sumt, 0, nr_cpus * sizeof(*sumt));
/* Sum across all weights. */
rcu_read_lock(&domlist_read_lock);
@@ -1348,6 +1358,9 @@ static int sedf_adjust_weights(struct xe
}
rcu_read_unlock(&domlist_read_lock);
+ xfree(sumt);
+ xfree(sumw);
+
return 0;
}
@@ -1356,6 +1369,7 @@ static int sedf_adjust_weights(struct xe
static int sedf_adjust(struct domain *p, struct xen_domctl_scheduler_op *op)
{
struct vcpu *v;
+ int rc;
PRINT(2,"sedf_adjust was called, domain-id %i new period %"PRIu64" "
"new slice %"PRIu64"\nlatency %"PRIu64" extra:%s\n",
@@ -1411,8 +1425,9 @@ static int sedf_adjust(struct domain *p,
}
}
- if ( sedf_adjust_weights(op) )
- return -EINVAL;
+ rc = sedf_adjust_weights(op);
+ if ( rc )
+ return rc;
for_each_vcpu ( p, v )
{

View File

@ -2,7 +2,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2277,7 +2277,7 @@ class XendDomainInfo:
@@ -2255,7 +2255,7 @@ class XendDomainInfo:
vtd_mem = ((vtd_mem + 1023) / 1024) * 1024
# Make sure there's enough RAM available for the domain

View File

@ -1,8 +1,8 @@
Index: xen-3.3.1-testing/tools/blktap/drivers/block-cdrom.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xen-3.3.1-testing/tools/blktap/drivers/block-cdrom.c 2008-09-24 09:45:02.000000000 -0600
@@ -0,0 +1,539 @@
+++ xen-3.3.1-testing/tools/blktap/drivers/block-cdrom.c 2008-09-28 13:14:49.000000000 -0600
@@ -0,0 +1,535 @@
+/* block-cdrom.c
+ *
+ * simple slow synchronous cdrom disk implementation. Based off
@ -153,18 +153,14 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/block-cdrom.c
+ struct tdcdrom_state *prv = (struct tdcdrom_state *)dd->private;
+ int o_flags;
+
+ o_flags = O_NONBLOCK | O_DIRECT | O_LARGEFILE |
+ o_flags = O_NONBLOCK | O_LARGEFILE |
+ ((prv->flags == TD_RDONLY) ? O_RDONLY : O_RDWR);
+
+ if (prv->fd < 0) {
+ prv->fd = open(prv->dev_name, o_flags);
+ if ( (prv->fd == -1) && (errno == EINVAL) ) {
+ /* Maybe O_DIRECT isn't supported. */
+ o_flags &= ~O_DIRECT;
+ prv->fd = open(prv->dev_name, o_flags);
+ if (prv->fd != -1) {
+ DPRINTF("WARNING: Accessing image without O_DIRECT! (%s)\n", prv->dev_name);
+ }
+ if (prv->fd == -1) {
+ DPRINTF("Unable tp open: (%s)\n", prv->dev_name);
+ return;
+ }
+ }
+
@ -545,7 +541,7 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/block-cdrom.c
Index: xen-3.3.1-testing/xen/include/public/io/cdromif.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xen-3.3.1-testing/xen/include/public/io/cdromif.h 2008-09-24 09:42:05.000000000 -0600
+++ xen-3.3.1-testing/xen/include/public/io/cdromif.h 2008-09-28 13:11:57.000000000 -0600
@@ -0,0 +1,120 @@
+/******************************************************************************
+ * cdromif.h
@ -669,8 +665,8 @@ Index: xen-3.3.1-testing/xen/include/public/io/cdromif.h
+#endif
Index: xen-3.3.1-testing/tools/blktap/drivers/Makefile
===================================================================
--- xen-3.3.1-testing.orig/tools/blktap/drivers/Makefile 2008-09-23 06:52:48.000000000 -0600
+++ xen-3.3.1-testing/tools/blktap/drivers/Makefile 2008-09-23 06:52:50.000000000 -0600
--- xen-3.3.1-testing.orig/tools/blktap/drivers/Makefile 2008-09-28 13:11:54.000000000 -0600
+++ xen-3.3.1-testing/tools/blktap/drivers/Makefile 2008-09-28 13:11:57.000000000 -0600
@@ -24,8 +24,9 @@
$(warning *** libgcrypt not installed: falling back to libcrypto ***)
endif
@ -693,8 +689,8 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/Makefile
BLK-OBJS-$(CONFIG_Linux) += blk_linux.o
Index: xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h
===================================================================
--- xen-3.3.1-testing.orig/tools/blktap/drivers/tapdisk.h 2008-09-23 06:52:50.000000000 -0600
+++ xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h 2008-09-23 06:52:50.000000000 -0600
--- xen-3.3.1-testing.orig/tools/blktap/drivers/tapdisk.h 2008-09-28 13:11:56.000000000 -0600
+++ xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h 2008-09-28 13:11:57.000000000 -0600
@@ -137,6 +137,9 @@
int (*td_get_parent_id) (struct disk_driver *dd, struct disk_id *id);
int (*td_validate_parent)(struct disk_driver *dd,
@ -741,8 +737,8 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h
typedef struct driver_list_entry {
Index: xen-3.3.1-testing/tools/blktap/lib/blktaplib.h
===================================================================
--- xen-3.3.1-testing.orig/tools/blktap/lib/blktaplib.h 2008-09-23 06:52:50.000000000 -0600
+++ xen-3.3.1-testing/tools/blktap/lib/blktaplib.h 2008-09-23 06:52:50.000000000 -0600
--- xen-3.3.1-testing.orig/tools/blktap/lib/blktaplib.h 2008-09-28 13:11:56.000000000 -0600
+++ xen-3.3.1-testing/tools/blktap/lib/blktaplib.h 2008-09-28 13:11:57.000000000 -0600
@@ -221,6 +221,7 @@
#define DISK_TYPE_QCOW 4
#define DISK_TYPE_QCOW2 5
@ -754,7 +750,7 @@ Index: xen-3.3.1-testing/tools/blktap/lib/blktaplib.h
Index: xen-3.3.1-testing/xen/include/public/io/blkif.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/public/io/blkif.h 2008-09-16 10:31:07.000000000 -0600
+++ xen-3.3.1-testing/xen/include/public/io/blkif.h 2008-09-23 06:54:18.000000000 -0600
+++ xen-3.3.1-testing/xen/include/public/io/blkif.h 2008-09-28 13:11:57.000000000 -0600
@@ -76,6 +76,10 @@
* "feature-flush-cache" node!
*/
@ -769,7 +765,7 @@ Index: xen-3.3.1-testing/xen/include/public/io/blkif.h
Index: xen-3.3.1-testing/tools/blktap/drivers/tapdisk.c
===================================================================
--- xen-3.3.1-testing.orig/tools/blktap/drivers/tapdisk.c 2008-09-16 10:31:02.000000000 -0600
+++ xen-3.3.1-testing/tools/blktap/drivers/tapdisk.c 2008-09-23 06:56:45.000000000 -0600
+++ xen-3.3.1-testing/tools/blktap/drivers/tapdisk.c 2008-09-28 13:11:57.000000000 -0600
@@ -735,6 +735,22 @@
goto out;
}
@ -796,7 +792,7 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/tapdisk.c
Index: xen-3.3.1-testing/tools/python/xen/xend/server/BlktapController.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xend/server/BlktapController.py 2008-09-16 10:31:03.000000000 -0600
+++ xen-3.3.1-testing/tools/python/xen/xend/server/BlktapController.py 2008-09-23 07:02:27.000000000 -0600
+++ xen-3.3.1-testing/tools/python/xen/xend/server/BlktapController.py 2008-09-28 13:11:57.000000000 -0600
@@ -14,8 +14,8 @@
'ram',
'qcow',

View File

@ -5,7 +5,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2618,7 +2618,7 @@ class XendDomainInfo:
@@ -2596,7 +2596,7 @@ class XendDomainInfo:
(fn, BOOTLOADER_LOOPBACK_DEVICE))
vbd = {

View File

@ -11,19 +11,33 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/blktapctrl.c
int run = 1;
int max_timeout = MAX_TIMEOUT;
int ctlfd = 0;
@@ -174,7 +176,10 @@ static int test_path(char *path, char **
@@ -148,7 +150,8 @@ static int get_tapdisk_pid(blkif_t *blki
* return 0 on success, -1 on error.
*/
-static int test_path(char *path, char **dev, int *type, blkif_t **blkif)
+static int test_path(char *path, char **dev, int *type, blkif_t **blkif,
+ int* use_ioemu)
{
char *ptr, handle[10];
int i, size, found = 0;
@@ -174,6 +177,7 @@ static int test_path(char *path, char **
}
if (found) {
- *type = dtypes[i]->idnum;
+ if (dtypes[i]->use_ioemu)
+ *type = DISK_TYPE_IOEMU;
+ else
+ *type = dtypes[i]->idnum;
+ *use_ioemu = dtypes[i]->use_ioemu;
*type = dtypes[i]->idnum;
if (dtypes[i]->single_handler == 1) {
/* Check whether tapdisk process
@@ -474,6 +479,7 @@ static int launch_tapdisk_provider(char
@@ -185,6 +189,7 @@ static int test_path(char *path, char **
*blkif = active_disks[dtypes[i]
->idnum]->blkif;
}
+
return 0;
}
}
@@ -474,6 +479,7 @@ static int launch_tapdisk_provider(char
return child;
}
@ -39,7 +53,29 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/blktapctrl.c
static int launch_tapdisk_ioemu(void)
{
@@ -554,6 +561,7 @@ static int connect_qemu(blkif_t *blkif,
@@ -524,7 +531,7 @@ static int connect_qemu(blkif_t *blkif,
if (tapdisk_ioemu_pid == 0 || kill(tapdisk_ioemu_pid, 0)) {
/* No device model and tapdisk-ioemu doesn't run yet */
DPRINTF("Launching tapdisk-ioemu\n");
- tapdisk_ioemu_pid = launch_tapdisk_ioemu();
+ launch_tapdisk_ioemu();
dom0_readfd = open_ctrl_socket(wrctldev);
dom0_writefd = open_ctrl_socket(rdctldev);
@@ -533,6 +540,12 @@ static int connect_qemu(blkif_t *blkif,
DPRINTF("Using tapdisk-ioemu connection\n");
blkif->fds[READ] = dom0_readfd;
blkif->fds[WRITE] = dom0_writefd;
+
+ if (tapdisk_ioemu_pid == 0) {
+ get_tapdisk_pid(blkif);
+ tapdisk_ioemu_pid = blkif->tappid;
+ }
+
} else if (access(rdctldev, R_OK | W_OK) == 0) {
/* Use existing pipe to the device model */
DPRINTF("Using qemu-dm connection\n");
@@ -554,6 +567,7 @@ static int connect_qemu(blkif_t *blkif,
return 0;
}
@ -47,7 +83,7 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/blktapctrl.c
/* Launch tapdisk instance */
static int connect_tapdisk(blkif_t *blkif, int minor)
{
@@ -597,6 +605,7 @@ fail:
@@ -597,6 +611,7 @@ fail:
return ret;
}
@ -55,18 +91,35 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/blktapctrl.c
static int blktapctrl_new_blkif(blkif_t *blkif)
{
@@ -621,6 +630,10 @@ static int blktapctrl_new_blkif(blkif_t
@@ -606,13 +621,14 @@ static int blktapctrl_new_blkif(blkif_t
image_t *image;
blkif_t *exist = NULL;
static uint16_t next_cookie = 0;
+ int use_ioemu;
DPRINTF("Received a poll for a new vbd\n");
if ( ((blk=blkif->info) != NULL) && (blk->params != NULL) ) {
if (blktap_interface_create(ctlfd, &major, &minor, blkif) < 0)
return -1;
- if (test_path(blk->params, &ptr, &type, &exist) != 0) {
+ if (test_path(blk->params, &ptr, &type, &exist, &use_ioemu) != 0) {
DPRINTF("Error in blktap device string(%s).\n",
blk->params);
goto fail;
@@ -621,13 +637,18 @@ static int blktapctrl_new_blkif(blkif_t
blkif->cookie = next_cookie++;
if (!exist) {
- if (type == DISK_TYPE_IOEMU) {
+#ifdef ALWAYS_USE_IOEMU
+ if (connect_qemu(blkif, blkif->domid))
+ goto fail;
+#else
if (type == DISK_TYPE_IOEMU) {
+ if (use_ioemu) {
if (connect_qemu(blkif, blkif->domid))
goto fail;
@@ -628,6 +641,7 @@ static int blktapctrl_new_blkif(blkif_t
} else {
if (connect_tapdisk(blkif, minor))
goto fail;
}

View File

@ -15,7 +15,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/smp.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/smp.c
+++ xen-3.3.1-testing/xen/arch/x86/smp.c
@@ -357,7 +357,7 @@ fastcall void smp_call_function_interrup
@@ -356,7 +356,7 @@ fastcall void smp_call_function_interrup
if ( call_data->wait )
{
@ -24,7 +24,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/smp.c
mb();
atomic_inc(&call_data->finished);
}
@@ -365,7 +365,7 @@ fastcall void smp_call_function_interrup
@@ -364,7 +364,7 @@ fastcall void smp_call_function_interrup
{
mb();
atomic_inc(&call_data->started);

View File

@ -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,6 +701,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
@@ -693,12 +701,14 @@ int hvm_vcpu_initialise(struct vcpu *v)
hvm_funcs.vcpu_destroy(v);
fail2:
vlapic_destroy(v);
@ -65,7 +65,14 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
fail1:
return rc;
}
@@ -1647,7 +1656,7 @@ void hvm_cpuid(unsigned int input, unsig
void hvm_vcpu_destroy(struct vcpu *v)
{
+ hyperx_intercept_vcpu_destroy(v);
hvm_vcpu_cacheattr_destroy(v);
vlapic_destroy(v);
hvm_funcs.vcpu_destroy(v);
@@ -1647,7 +1657,7 @@ void hvm_cpuid(unsigned int input, unsig
struct vcpu *v = current;
if ( cpuid_hypervisor_leaves(input, eax, ebx, ecx, edx) )
@ -74,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 +1668,8 @@ void hvm_cpuid(unsigned int input, unsig
@@ -1659,6 +1669,8 @@ void hvm_cpuid(unsigned int input, unsig
if ( vlapic_hw_disabled(vcpu_vlapic(v)) )
__clear_bit(X86_FEATURE_APIC & 31, edx);
}
@ -83,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 +1760,8 @@ int hvm_msr_read_intercept(struct cpu_us
@@ -1749,6 +1761,8 @@ int hvm_msr_read_intercept(struct cpu_us
break;
default:
@ -92,7 +99,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
return hvm_funcs.msr_read_intercept(regs);
}
@@ -1837,6 +1850,8 @@ int hvm_msr_write_intercept(struct cpu_u
@@ -1837,6 +1851,8 @@ int hvm_msr_write_intercept(struct cpu_u
break;
default:
@ -101,7 +108,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
return hvm_funcs.msr_write_intercept(regs);
}
@@ -1963,6 +1978,10 @@ int hvm_do_hypercall(struct cpu_user_reg
@@ -1963,6 +1979,10 @@ int hvm_do_hypercall(struct cpu_user_reg
case 0:
break;
}
@ -112,7 +119,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
if ( (eax >= NR_hypercalls) || !hvm_hypercall32_table[eax] )
{
@@ -2476,6 +2495,15 @@ long do_hvm_op(unsigned long op, XEN_GUE
@@ -2464,6 +2484,15 @@ long do_hvm_op(unsigned long op, XEN_GUE
rc = -EINVAL;
break;

View File

@ -2,7 +2,7 @@
Index: xen-3.3.1-testing/xen/include/asm-x86/hvm/hvm_extensions.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xen-3.3.1-testing/xen/include/asm-x86/hvm/hvm_extensions.h 2008-09-17 17:30:15.000000000 -0600
+++ xen-3.3.1-testing/xen/include/asm-x86/hvm/hvm_extensions.h 2008-10-07 20:55:01.000000000 -0600
@@ -0,0 +1,165 @@
+/****************************************************************************
+ |
@ -172,14 +172,14 @@ Index: xen-3.3.1-testing/xen/include/asm-x86/hvm/hvm_extensions.h
Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/Makefile
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/Makefile 2008-09-17 17:30:15.000000000 -0600
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/Makefile 2008-10-07 20:55:01.000000000 -0600
@@ -0,0 +1,2 @@
+obj-y += hv_intercept.o
+obj-y += hv_hypercall.o
Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_errno.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_errno.h 2008-09-17 17:30:15.000000000 -0600
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_errno.h 2008-10-07 20:55:01.000000000 -0600
@@ -0,0 +1,62 @@
+/****************************************************************************
+ |
@ -246,7 +246,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_errno.h
Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_hypercall.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_hypercall.c 2008-09-17 17:30:15.000000000 -0600
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_hypercall.c 2008-10-07 20:55:01.000000000 -0600
@@ -0,0 +1,125 @@
+/****************************************************************************
+ |
@ -376,7 +376,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_hypercall.c
Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_hypercall.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_hypercall.h 2008-09-17 17:30:15.000000000 -0600
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_hypercall.h 2008-10-07 20:55:01.000000000 -0600
@@ -0,0 +1,45 @@
+/****************************************************************************
+ |
@ -426,8 +426,8 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_hypercall.h
Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_intercept.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_intercept.c 2008-09-17 18:22:05.000000000 -0600
@@ -0,0 +1,977 @@
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_intercept.c 2008-10-07 21:19:25.000000000 -0600
@@ -0,0 +1,980 @@
+/****************************************************************************
+ |
+ | Copyright (c) [2007, 2008] Novell, Inc.
@ -1032,7 +1032,6 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_intercept.c
+ unsigned int *ebx, unsigned int *ecx,
+ unsigned int *edx )
+{
+ uint32_t idx;
+ struct domain *d = current->domain;
+ int extid = d->arch.hvm_domain.params[HVM_PARAM_EXTEND_HYPERVISOR];
+
@ -1053,8 +1052,12 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_intercept.c
+ */
+ if ((input >= 0x40001000) && (input <= 0x40001002))
+ {
+ idx = (input - 0x40001000);
+ /* Get rid of the offset and let xen handle it */
+ input -= 0x1000;
+ cpuid_hypervisor_leaves(input, eax, ebx, ecx, edx);
+ /* Setup hypercall MSR value - add the offset*/
+ if (input == 0x40000002)
+ *ebx |= 0x1000;
+ return (1);
+ }
+ }
@ -1086,7 +1089,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_intercept.c
+ }
+
+ if (hv_preprocess_cpuid_leaves(input, eax, ebx, ecx, edx))
+ return (0);
+ return (1);
+ idx = (input - 0x40000000);
+
+ switch (idx)
@ -1408,7 +1411,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_intercept.c
Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_shim.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_shim.h 2008-09-17 17:30:15.000000000 -0600
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_shim.h 2008-10-07 20:55:01.000000000 -0600
@@ -0,0 +1,281 @@
+/****************************************************************************
+ |

41
python2.6-fixes.patch Normal file
View File

@ -0,0 +1,41 @@
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 @@
#============================================================================
import os
-import sha
+import hashlib
import stat
import array
import struct
Index: xen-3.3.1-testing/tools/python/xen/xend/XendAPI.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xend/XendAPI.py
+++ xen-3.3.1-testing/tools/python/xen/xend/XendAPI.py
@@ -18,7 +18,6 @@
import inspect
import os
import Queue
-import sets
import string
import sys
import traceback
@@ -116,13 +115,13 @@ event_registrations = {}
def event_register(session, reg_classes):
if session not in event_registrations:
event_registrations[session] = {
- 'classes' : sets.Set(),
+ 'classes' : set(),
'queue' : Queue.Queue(EVENT_QUEUE_LENGTH),
'next-id' : 1
}
if not reg_classes:
reg_classes = classes
- event_registrations[session]['classes'].union_update(reg_classes)
+ event_registrations[session]['classes'].update(reg_classes)
def event_unregister(session, unreg_classes):

View File

@ -588,7 +588,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xm/main.py
def xm_save(args):
arg_check(args, "save", 2, 3)
@@ -2757,6 +2832,10 @@ commands = {
@@ -2758,6 +2833,10 @@ commands = {
"restore": xm_restore,
"resume": xm_resume,
"save": xm_save,

View File

@ -0,0 +1,33 @@
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
@@ -100,16 +100,22 @@ int main(void)
struct timeval tv;
void *old_fd_start = NULL;
- logfile = stderr;
-
+ /* Daemonize */
+ if (fork() != 0)
+ exit(0);
+
bdrv_init();
qemu_aio_init();
init_blktap();
- /* Daemonize */
- if (fork() != 0)
- exit(0);
-
+ logfile = fopen("/var/log/xen/tapdisk-ioemu.log", "a");
+ if (logfile) {
+ fclose(stderr);
+ stderr = logfile;
+ } else {
+ logfile = stderr;
+ }
+
/*
* Main loop: Pass events to the corrsponding handlers and check for
* completed aio operations.

415
x86-alloc-cpu-structs.patch Normal file
View File

@ -0,0 +1,415 @@
Index: xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/cpufreq.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -44,7 +44,7 @@
#include <acpi/acpi.h>
#include <acpi/cpufreq/cpufreq.h>
-struct processor_pminfo processor_pminfo[NR_CPUS];
+struct processor_pminfo *__read_mostly processor_pminfo[NR_CPUS];
struct cpufreq_policy xen_px_policy[NR_CPUS];
static cpumask_t *cpufreq_dom_pt;
@@ -436,7 +436,7 @@ acpi_cpufreq_cpu_init(struct cpufreq_pol
drv_data[cpu] = data;
- data->acpi_data = &processor_pminfo[cpu].perf;
+ data->acpi_data = &processor_pminfo[cpu]->perf;
perf = data->acpi_data;
policy->shared_type = perf->shared_type;
@@ -575,8 +575,8 @@ int cpufreq_dom_init(void)
cpufreq_dom_max = 0;
for_each_online_cpu(i) {
- if (cpufreq_dom_max < processor_pminfo[i].perf.domain_info.domain)
- cpufreq_dom_max = processor_pminfo[i].perf.domain_info.domain;
+ if (cpufreq_dom_max < processor_pminfo[i]->perf.domain_info.domain)
+ cpufreq_dom_max = processor_pminfo[i]->perf.domain_info.domain;
}
cpufreq_dom_max++;
@@ -592,13 +592,13 @@ int cpufreq_dom_init(void)
memset(cpufreq_dom_pt, 0, cpufreq_dom_max * sizeof(cpumask_t));
for_each_online_cpu(i) {
- __set_bit(processor_pminfo[i].perf.domain_info.domain, cpufreq_dom_mask);
- cpu_set(i, cpufreq_dom_pt[processor_pminfo[i].perf.domain_info.domain]);
+ __set_bit(processor_pminfo[i]->perf.domain_info.domain, cpufreq_dom_mask);
+ cpu_set(i, cpufreq_dom_pt[processor_pminfo[i]->perf.domain_info.domain]);
}
for_each_online_cpu(i)
- processor_pminfo[i].perf.shared_cpu_map =
- cpufreq_dom_pt[processor_pminfo[i].perf.domain_info.domain];
+ processor_pminfo[i]->perf.shared_cpu_map =
+ cpufreq_dom_pt[processor_pminfo[i]->perf.domain_info.domain];
return 0;
}
Index: xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/powernow.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/acpi/cpufreq/powernow.c
+++ xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/powernow.c
@@ -49,9 +49,6 @@
#define MSR_PSTATE_CTRL 0xc0010062 /* Pstate control MSR */
#define MSR_PSTATE_CUR_LIMIT 0xc0010061 /* pstate current limit MSR */
-extern struct processor_pminfo processor_pminfo[NR_CPUS];
-extern struct cpufreq_policy xen_px_policy[NR_CPUS];
-
struct powernow_cpufreq_data {
struct processor_performance *acpi_data;
struct cpufreq_frequency_table *freq_table;
@@ -149,7 +146,7 @@ static int powernow_cpufreq_cpu_init(str
drv_data[cpu] = data;
- data->acpi_data = &processor_pminfo[cpu].perf;
+ data->acpi_data = &processor_pminfo[cpu]->perf;
perf = data->acpi_data;
policy->shared_type = perf->shared_type;
@@ -257,8 +254,8 @@ int powernow_cpufreq_init(void)
}
if (ret)
return ret;
- if (max_dom < processor_pminfo[i].perf.domain_info.domain)
- max_dom = processor_pminfo[i].perf.domain_info.domain;
+ if (max_dom < processor_pminfo[i]->perf.domain_info.domain)
+ max_dom = processor_pminfo[i]->perf.domain_info.domain;
}
max_dom++;
@@ -274,13 +271,13 @@ int powernow_cpufreq_init(void)
/* get cpumask of each psd domain */
for_each_online_cpu(i) {
- __set_bit(processor_pminfo[i].perf.domain_info.domain, dom_mask);
- cpu_set(i, pt[processor_pminfo[i].perf.domain_info.domain]);
+ __set_bit(processor_pminfo[i]->perf.domain_info.domain, dom_mask);
+ cpu_set(i, pt[processor_pminfo[i]->perf.domain_info.domain]);
}
for_each_online_cpu(i)
- processor_pminfo[i].perf.shared_cpu_map =
- pt[processor_pminfo[i].perf.domain_info.domain];
+ processor_pminfo[i]->perf.shared_cpu_map =
+ pt[processor_pminfo[i]->perf.domain_info.domain];
cpufreq_driver = &powernow_cpufreq_driver;
Index: xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/utility.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/acpi/cpufreq/utility.c
+++ xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/utility.c
@@ -45,10 +45,12 @@ void px_statistic_suspend(void)
now = NOW();
for_each_online_cpu(cpu) {
- struct pm_px *pxpt = &px_statistic_data[cpu];
+ struct pm_px *pxpt = px_statistic_data[cpu];
uint64_t total_idle_ns;
uint64_t tmp_idle_ns;
+ if ( !pxpt )
+ continue;
total_idle_ns = get_cpu_idle_time(cpu);
tmp_idle_ns = total_idle_ns - pxpt->prev_idle_wall;
@@ -66,7 +68,10 @@ void px_statistic_resume(void)
now = NOW();
for_each_online_cpu(cpu) {
- struct pm_px *pxpt = &px_statistic_data[cpu];
+ struct pm_px *pxpt = px_statistic_data[cpu];
+
+ if ( !pxpt )
+ continue;
pxpt->prev_state_wall = now;
pxpt->prev_idle_wall = get_cpu_idle_time(cpu);
}
@@ -80,11 +85,14 @@ void px_statistic_update(cpumask_t cpuma
now = NOW();
for_each_cpu_mask(i, cpumask) {
- struct pm_px *pxpt = &px_statistic_data[i];
- uint32_t statnum = processor_pminfo[i].perf.state_count;
+ struct pm_px *pxpt = px_statistic_data[i];
+ struct processor_pminfo *pmpt = processor_pminfo[i];
uint64_t total_idle_ns;
uint64_t tmp_idle_ns;
+ if ( !pxpt || !pmpt )
+ continue;
+
total_idle_ns = get_cpu_idle_time(i);
tmp_idle_ns = total_idle_ns - pxpt->prev_idle_wall;
@@ -94,7 +102,7 @@ void px_statistic_update(cpumask_t cpuma
pxpt->u.pt[from].residency += now - pxpt->prev_state_wall;
pxpt->u.pt[from].residency -= tmp_idle_ns;
- (*(pxpt->u.trans_pt + from*statnum + to))++;
+ (*(pxpt->u.trans_pt + from * pmpt->perf.state_count + to))++;
pxpt->prev_state_wall = now;
pxpt->prev_idle_wall = total_idle_ns;
@@ -104,11 +112,23 @@ void px_statistic_update(cpumask_t cpuma
int px_statistic_init(int cpuid)
{
uint32_t i, count;
- struct pm_px *pxpt = &px_statistic_data[cpuid];
- struct processor_pminfo *pmpt = &processor_pminfo[cpuid];
+ struct pm_px *pxpt = px_statistic_data[cpuid];
+ const struct processor_pminfo *pmpt = processor_pminfo[cpuid];
count = pmpt->perf.state_count;
+ if ( !pmpt )
+ return -EINVAL;
+
+ if ( !pxpt )
+ {
+ pxpt = xmalloc(struct pm_px);
+ if ( !pxpt )
+ return -ENOMEM;
+ memset(pxpt, 0, sizeof(*pxpt));
+ px_statistic_data[cpuid] = pxpt;
+ }
+
pxpt->u.trans_pt = xmalloc_array(uint64_t, count * count);
if (!pxpt->u.trans_pt)
return -ENOMEM;
@@ -137,9 +157,13 @@ int px_statistic_init(int cpuid)
void px_statistic_reset(int cpuid)
{
uint32_t i, j, count;
- struct pm_px *pxpt = &px_statistic_data[cpuid];
+ struct pm_px *pxpt = px_statistic_data[cpuid];
+ const struct processor_pminfo *pmpt = processor_pminfo[cpuid];
- count = processor_pminfo[cpuid].perf.state_count;
+ if ( !pxpt || !pmpt )
+ return;
+
+ count = pmpt->perf.state_count;
for (i=0; i < count; i++) {
pxpt->u.pt[i].residency = 0;
@@ -298,9 +322,9 @@ void cpufreq_suspend(void)
/* to protect the case when Px was not controlled by xen */
for_each_online_cpu(cpu) {
- struct processor_performance *perf = &processor_pminfo[cpu].perf;
+ const struct processor_pminfo *pmpt = processor_pminfo[cpu];
- if (!(perf->init & XEN_PX_INIT))
+ if (!pmpt || !(pmpt->perf.init & XEN_PX_INIT))
return;
}
@@ -318,10 +342,11 @@ int cpufreq_resume(void)
/* 1. to protect the case when Px was not controlled by xen */
/* 2. set state and resume flag to sync cpu to right state and freq */
for_each_online_cpu(cpu) {
- struct processor_performance *perf = &processor_pminfo[cpu].perf;
+ struct processor_pminfo *pmpt = processor_pminfo[cpu];
+ struct processor_performance *perf = &pmpt->perf;
struct cpufreq_policy *policy = &xen_px_policy[cpu];
- if (!(perf->init & XEN_PX_INIT))
+ if (!pmpt || !(perf->init & XEN_PX_INIT))
goto err;
perf->state = 0;
policy->resume = 1;
Index: xen-3.3.1-testing/xen/arch/x86/acpi/cpu_idle.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/acpi/cpu_idle.c
+++ xen-3.3.1-testing/xen/arch/x86/acpi/cpu_idle.c
@@ -126,7 +126,7 @@ struct acpi_processor_power
struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
};
-static struct acpi_processor_power processor_powers[NR_CPUS];
+static struct acpi_processor_power *__read_mostly processor_powers[NR_CPUS];
static void print_acpi_power(uint32_t cpu, struct acpi_processor_power *power)
{
@@ -160,8 +160,11 @@ static void print_acpi_power(uint32_t cp
static void dump_cx(unsigned char key)
{
- for( int i = 0; i < num_online_cpus(); i++ )
- print_acpi_power(i, &processor_powers[i]);
+ unsigned int cpu;
+
+ for_each_online_cpu ( cpu )
+ if (processor_powers[cpu])
+ print_acpi_power(cpu, processor_powers[cpu]);
}
static int __init cpu_idle_key_init(void)
@@ -270,14 +273,12 @@ static struct {
static void acpi_processor_idle(void)
{
- struct acpi_processor_power *power = NULL;
+ struct acpi_processor_power *power = processor_powers[smp_processor_id()];
struct acpi_processor_cx *cx = NULL;
struct acpi_processor_cx *next_state = NULL;
int sleep_ticks = 0;
u32 t1, t2 = 0;
- power = &processor_powers[smp_processor_id()];
-
/*
* Interrupts must be disabled during bus mastering calculations and
* for C2/C3 transitions.
@@ -290,7 +291,7 @@ static void acpi_processor_idle(void)
return;
}
- cx = power->state;
+ cx = power ? power->state : NULL;
if ( !cx )
{
if ( pm_idle_save )
@@ -938,7 +939,15 @@ long set_cx_pminfo(uint32_t cpu, struct
return -EFAULT;
}
- acpi_power = &processor_powers[cpu_id];
+ acpi_power = processor_powers[cpu_id];
+ if ( !acpi_power )
+ {
+ acpi_power = xmalloc(struct acpi_processor_power);
+ if ( !acpi_power )
+ return -ENOMEM;
+ memset(acpi_power, 0, sizeof(*acpi_power));
+ processor_powers[cpu_id] = acpi_power;
+ }
init_cx_pminfo(acpi_power);
@@ -974,18 +983,25 @@ long set_cx_pminfo(uint32_t cpu, struct
uint32_t pmstat_get_cx_nr(uint32_t cpuid)
{
- return processor_powers[cpuid].count;
+ return processor_powers[cpuid] ? processor_powers[cpuid]->count : 0;
}
int pmstat_get_cx_stat(uint32_t cpuid, struct pm_cx_stat *stat)
{
- struct acpi_processor_power *power = &processor_powers[cpuid];
+ const struct acpi_processor_power *power = processor_powers[cpuid];
struct vcpu *v = idle_vcpu[cpuid];
uint64_t usage;
int i;
+ if ( unlikely(!power) )
+ {
+ stat->last = 0;
+ stat->nr = 0;
+ stat->idle_time = 0;
+ return 0;
+ }
stat->last = (power->state) ? power->state->type : 0;
- stat->nr = processor_powers[cpuid].count;
+ stat->nr = power->count;
stat->idle_time = v->runstate.time[RUNSTATE_running];
if ( v->is_running )
stat->idle_time += NOW() - v->runstate.state_entry_time;
Index: xen-3.3.1-testing/xen/arch/x86/acpi/pmstat.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/acpi/pmstat.c
+++ xen-3.3.1-testing/xen/arch/x86/acpi/pmstat.c
@@ -40,7 +40,7 @@
#include <public/sysctl.h>
#include <acpi/cpufreq/cpufreq.h>
-struct pm_px px_statistic_data[NR_CPUS];
+struct pm_px *__read_mostly px_statistic_data[NR_CPUS];
extern uint32_t pmstat_get_cx_nr(uint32_t cpuid);
extern int pmstat_get_cx_stat(uint32_t cpuid, struct pm_cx_stat *stat);
@@ -49,15 +49,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];
+ const 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)) &&
+ if ( (!pmpt || !(pmpt->perf.init & XEN_PX_INIT)) &&
(op->type & PMSTAT_CATEGORY_MASK) == PMSTAT_PX )
return -EINVAL;
- if ( !cpu_online(op->cpuid) )
+ if ( op->cpuid >= NR_CPUS || !cpu_online(op->cpuid) )
return -EINVAL;
switch( op->type )
@@ -73,6 +72,10 @@ 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];
+
+ if ( !pxpt )
+ return -ENODATA;
total_idle_ns = get_cpu_idle_time(op->cpuid);
tmp_idle_ns = total_idle_ns - pxpt->prev_idle_wall;
Index: xen-3.3.1-testing/xen/arch/x86/platform_hypercall.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/platform_hypercall.c
+++ xen-3.3.1-testing/xen/arch/x86/platform_hypercall.c
@@ -364,8 +364,19 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
ret = -EINVAL;
break;
}
- pmpt = &processor_pminfo[cpuid];
- pxpt = &processor_pminfo[cpuid].perf;
+ pmpt = processor_pminfo[cpuid];
+ if ( !pmpt )
+ {
+ pmpt = xmalloc(struct processor_pminfo);
+ if ( !pmpt )
+ {
+ ret = -ENOMEM;
+ break;
+ }
+ memset(pmpt, 0, sizeof(*pmpt));
+ processor_pminfo[cpuid] = pmpt;
+ }
+ pxpt = &pmpt->perf;
pmpt->acpi_id = xenpmpt->id;
pmpt->id = cpuid;
Index: xen-3.3.1-testing/xen/include/acpi/cpufreq/processor_perf.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/acpi/cpufreq/processor_perf.h
+++ xen-3.3.1-testing/xen/include/acpi/cpufreq/processor_perf.h
@@ -44,7 +44,7 @@ struct processor_pminfo {
struct processor_performance perf;
};
-extern struct processor_pminfo processor_pminfo[NR_CPUS];
+extern struct processor_pminfo *processor_pminfo[NR_CPUS];
struct px_stat {
uint8_t total; /* total Px states */
@@ -61,6 +61,6 @@ struct pm_px {
uint64_t prev_idle_wall;
};
-extern struct pm_px px_statistic_data[NR_CPUS];
+extern struct pm_px *px_statistic_data[NR_CPUS];
#endif /* __XEN_PROCESSOR_PM_H__ */

View File

@ -1,32 +0,0 @@
Index: xen-3.3.1-testing/xen/include/asm-x86/page.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/page.h
+++ xen-3.3.1-testing/xen/include/asm-x86/page.h
@@ -301,9 +301,10 @@ void setup_idle_pagetable(void);
* WARNING: This will need to be disabled to run OSes that use the spare PTE
* bits themselves (e.g., *BSD).
*/
-#ifndef NDEBUG
-#define _PAGE_GNTTAB _PAGE_AVAIL2
-#else
+#ifdef NDEBUG
+#undef _PAGE_GNTTAB
+#endif
+#ifndef _PAGE_GNTTAB
#define _PAGE_GNTTAB 0
#endif
Index: xen-3.3.1-testing/xen/include/asm-x86/x86_64/page.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/x86_64/page.h
+++ xen-3.3.1-testing/xen/include/asm-x86/x86_64/page.h
@@ -104,6 +104,9 @@ typedef l4_pgentry_t root_pgentry_t;
#define _PAGE_NX_BIT (1U<<23)
#define _PAGE_NX (cpu_has_nx ? _PAGE_NX_BIT : 0U)
+/* Bit 22 of a 24-bit flag mask. This corresponds to bit 62 of a pte.*/
+#define _PAGE_GNTTAB (1U<<22)
+
/*
* Disallow unused flag bits plus PAT/PSE, PCD, PWT and GLOBAL.
* Permit the NX bit if the hardware supports it.

View File

@ -69,7 +69,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/x86_64/mm.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/x86_64/mm.c
+++ xen-3.3.1-testing/xen/arch/x86/x86_64/mm.c
@@ -32,6 +32,7 @@
@@ -33,6 +33,7 @@
#include <asm/msr.h>
#include <public/memory.h>
@ -77,7 +77,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/x86_64/mm.c
#ifdef CONFIG_COMPAT
unsigned int m2p_compat_vstart = __HYPERVISOR_COMPAT_VIRT_START;
#endif
@@ -151,6 +152,8 @@ void __init paging_init(void)
@@ -152,6 +153,8 @@ void __init paging_init(void)
l2_ro_mpt++;
}

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a81260006fcf33de732acb4ad2bc84974548f75b6be58f8f8d519a90d8f6b8c3
size 22688080
oid sha256:ad242249f77ef42e323e81cbd61afcac37eaa93749a8fe7d5aec2cf4048768ba
size 22688600

View File

@ -2,7 +2,7 @@ Index: xen-3.3.1-testing/Config.mk
===================================================================
--- xen-3.3.1-testing.orig/Config.mk
+++ xen-3.3.1-testing/Config.mk
@@ -85,20 +85,20 @@ QEMU_REMOTE=http://xenbits.xensource.com
@@ -84,20 +84,20 @@ QEMU_REMOTE=http://xenbits.xensource.com
# Specify which qemu-dm to use. This may be `ioemu' to use the old
# Mercurial in-tree version, or a local directory, or a git URL.

View File

@ -36,7 +36,7 @@ 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
@@ -604,6 +604,31 @@ class DevController:
@@ -620,6 +620,31 @@ class DevController:
return (Missing, None)
@ -148,7 +148,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
from xen.xend.XendError import XendError, VmError
from xen.xend.XendDevices import XendDevices
from xen.xend.XendTask import XendTask
@@ -1897,6 +1897,10 @@ class XendDomainInfo:
@@ -1875,6 +1875,10 @@ class XendDomainInfo:
deviceClass, config = self.info['devices'].get(dev_uuid)
self._waitForDevice(deviceClass, config['devid'])
@ -159,7 +159,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
def _waitForDevice_destroy(self, deviceClass, devid, backpath):
return self.getDeviceController(deviceClass).waitForDevice_destroy(
devid, backpath)
@@ -2569,8 +2573,11 @@ class XendDomainInfo:
@@ -2547,8 +2551,11 @@ class XendDomainInfo:
blexec = osdep.pygrub_path
blcfg = None
@ -173,7 +173,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
if not disks:
msg = "Had a bootloader specified, but no disks are bootable"
@@ -2581,13 +2588,10 @@ class XendDomainInfo:
@@ -2559,13 +2566,10 @@ class XendDomainInfo:
devtype = devinfo[0]
disk = devinfo[1]['uname']
@ -190,7 +190,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
log.info("Mounting %s on %s." %
(fn, BOOTLOADER_LOOPBACK_DEVICE))
@@ -2599,7 +2603,9 @@ class XendDomainInfo:
@@ -2577,7 +2581,9 @@ class XendDomainInfo:
from xen.xend import XendDomain
dom0 = XendDomain.instance().privilegedDomain()
@ -201,7 +201,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
fn = BOOTLOADER_LOOPBACK_DEVICE
try:
@@ -2610,7 +2616,7 @@ class XendDomainInfo:
@@ -2588,7 +2594,7 @@ class XendDomainInfo:
log.info("Unmounting %s from %s." %
(fn, BOOTLOADER_LOOPBACK_DEVICE))

View File

@ -23,7 +23,7 @@ Index: xen-3.3.1-testing/docs/man/xm.pod.1
===================================================================
--- xen-3.3.1-testing.orig/docs/man/xm.pod.1
+++ xen-3.3.1-testing/docs/man/xm.pod.1
@@ -188,7 +188,8 @@ scheduling by the Xen hypervisor.
@@ -295,7 +295,8 @@ scheduling by the Xen hypervisor.
=item B<s - shutdown>
@ -33,7 +33,7 @@ Index: xen-3.3.1-testing/docs/man/xm.pod.1
=item B<c - crashed>
@@ -201,8 +202,6 @@ restart on crash. See L<xmdomain.cfg> f
@@ -308,8 +309,6 @@ restart on crash. See L<xmdomain.cfg> f
The domain is in process of dying, but hasn't completely shutdown or
crashed.
@ -41,8 +41,8 @@ Index: xen-3.3.1-testing/docs/man/xm.pod.1
-
=back
B<LONG OUTPUT>
@@ -523,8 +522,6 @@ Xen ships with a number of domain schedu
B<NOTES>
@@ -733,8 +732,6 @@ Xen ships with a number of domain schedu
time with the B<sched=> parameter on the Xen command line. By
default B<credit> is used for scheduling.
@ -51,7 +51,7 @@ Index: xen-3.3.1-testing/docs/man/xm.pod.1
=over 4
=item B<sched-credit> [ B<-d> I<domain-id> [ B<-w>[B<=>I<WEIGHT>] | B<-c>[B<=>I<CAP>] ] ]
@@ -574,8 +571,6 @@ The normal EDF scheduling usage in nanos
@@ -784,8 +781,6 @@ The normal EDF scheduling usage in nanos
The normal EDF scheduling usage in nanoseconds
@ -60,7 +60,7 @@ Index: xen-3.3.1-testing/docs/man/xm.pod.1
=item I<latency-hint>
Scaled period if domain is doing heavy I/O.
@@ -719,9 +714,6 @@ the default setting in xend-config.sxp f
@@ -935,9 +930,6 @@ the default setting in xend-config.sxp f
Passes the specified IP Address to the adapter on creation.
@ -70,7 +70,7 @@ Index: xen-3.3.1-testing/docs/man/xm.pod.1
=item B<mac=>I<macaddr>
The MAC address that the domain will see on its Ethernet device. If
@@ -745,9 +737,6 @@ Removes the network device from the doma
@@ -963,9 +955,6 @@ Removes the network device from the doma
I<devid> is the virtual interface device number within the domain
(i.e. the 3 in vif22.3).
@ -80,7 +80,7 @@ Index: xen-3.3.1-testing/docs/man/xm.pod.1
=item B<network-list> [B<-l>|B<--long>]> I<domain-id>
List virtual network interfaces for a domain. The returned output is
@@ -766,9 +755,6 @@ formatted as a list or as an S-Expressio
@@ -988,9 +977,6 @@ formatted as a list or as an S-Expressio
The Virtual Network interfaces for Xen.

View File

@ -31,7 +31,7 @@ Index: xen-3.3.1-testing/xen/arch/x86/x86_32/mm.c
+ lowmem_emergency_pool_pages = 4000;
}
void __init zap_low_mappings(l2_pgentry_t *dom0_l2)
unsigned long clone_idle_pagetable(struct vcpu *v)
Index: xen-3.3.1-testing/xen/common/page_alloc.c
===================================================================
--- xen-3.3.1-testing.orig/xen/common/page_alloc.c

View File

@ -15,8 +15,8 @@ Index: xen-3.3.1-testing/docs/man/xm.pod.1
===================================================================
--- xen-3.3.1-testing.orig/docs/man/xm.pod.1
+++ xen-3.3.1-testing/docs/man/xm.pod.1
@@ -76,7 +76,7 @@ format, and possible options used in eit
I<name>=I<value> combinations.
@@ -75,7 +75,7 @@ in the config file. See L<xmdomain.cfg>
format, and possible options used in either the configfile or for I<vars>.
I<configfile> can either be an absolute path to a file, or a relative
-path to a file located in /etc/xen.
@ -24,7 +24,7 @@ Index: xen-3.3.1-testing/docs/man/xm.pod.1
Create will return B<as soon> as the domain is started. This B<does
not> mean the guest OS in the domain has actually booted, or is
@@ -101,7 +101,7 @@ B<EXAMPLES>
@@ -156,7 +156,7 @@ B<EXAMPLES>
xm create Fedora4

View File

@ -5,7 +5,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xm/main.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xm/main.py
+++ xen-3.3.1-testing/tools/python/xen/xm/main.py
@@ -1933,6 +1933,10 @@ def xm_debug_keys(args):
@@ -1934,6 +1934,10 @@ def xm_debug_keys(args):
def xm_top(args):
arg_check(args, "top", 0)

View File

@ -165,7 +165,7 @@ Index: xen-3.3.1-testing/docs/man/xm.pod.1
===================================================================
--- xen-3.3.1-testing.orig/docs/man/xm.pod.1
+++ xen-3.3.1-testing/docs/man/xm.pod.1
@@ -106,8 +106,8 @@ soon as it is run.
@@ -161,8 +161,8 @@ soon as it is run.
=item I<without config file>

View File

@ -1,3 +1,26 @@
-------------------------------------------------------------------
Thu Oct 2 16:23:15 MDT 2008 - jfehlig@novell.com
- bnc#431737 - Fix use of deprecated python constructs in xend
-------------------------------------------------------------------
Mon Sep 29 10:36:07 MDT 2008 - carnold@novell.com
- Update to c/s 18430, remove our versions of upstream patches.
- fate#303867 - minimum HVM domain limits. Pulled upstream
patches for supporting up to 255 cpus.
-------------------------------------------------------------------
Fri Sep 26 18:09:13 CEST 2008 - kwolf@suse.de
- bnc#430222 - Fixed block-attach for tap:aio images
-------------------------------------------------------------------
Thu Sep 25 13:30:33 CEST 2008 - kwolf@suse.de
- bnc#429801 - Fixed xm start -c / --vncviewer
xm-start-fix.patch
-------------------------------------------------------------------
Wed Sep 24 15:44:43 MDT 2008 - carnold@novell.com

View File

@ -1,5 +1,5 @@
#
# spec file for package xen (Version 3.3.1_18412_02)
# spec file for package xen (Version 3.3.1_18442_01)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -21,7 +21,7 @@
Name: xen
%define xvers 3.3
%define xvermaj 3
%define changeset 18412
%define changeset 18442
%define xen_build_dir xen-3.3.1-testing
%if %sles_version
%define with_kmp 1
@ -40,7 +40,7 @@ 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_18412_02
Version: 3.3.1_18442_01
Release: 1
License: GPL v2 only
Group: System/Kernel
@ -81,9 +81,11 @@ Patch8: 18483-intel-microcode-update.patch
Patch9: 18484-stubdom-ioemu-makefile.patch
Patch10: 18487-microcode-update-irq-context.patch
Patch11: 18488-microcode-free-fix.patch
Patch12: 18505-amd-powernow-fix.patch
Patch13: 18506-enforce-memory-limits.patch
Patch14: 18509-continue-hypercall-on-cpu.patch
Patch12: 18509-continue-hypercall-on-cpu.patch
Patch13: 18520-per-CPU-GDT.patch
Patch14: 18521-per-CPU-TSS.patch
Patch15: 18523-per-CPU-misc.patch
Patch16: xenstore-leak.patch
# Our patches
Patch100: xen-config.diff
Patch101: xend-config.diff
@ -129,7 +131,8 @@ Patch157: xen-api-auth.patch
Patch158: xen-qemu-iscsi-fix.patch
Patch159: xend-vif-fix.patch
Patch160: tools-gdbserver-build.diff
Patch161: xm-man-update.diff
# Needs to go upstream sometime, when python 2.6 is widespread
Patch161: python2.6-fixes.patch
# Patches for snapshot support
Patch170: qemu-img-snapshot.patch
Patch171: ioemu-blktap-fix-open.patch
@ -142,6 +145,7 @@ Patch181: ioemu-blktap-image-format.patch
Patch182: build-tapdisk-ioemu.patch
Patch183: blktapctrl-default-to-ioemu.patch
Patch184: ioemu-blktap-barriers.patch
Patch185: tapdisk-ioemu-logfile.patch
# Jim's domain lock patch
Patch190: xend-domain-lock.patch
# Patches from Jan
@ -149,7 +153,7 @@ Patch240: dump-exec-state.patch
Patch241: x86-show-page-walk-early.patch
Patch242: svm-lmsl.patch
Patch243: x86-extra-trap-info.patch
Patch244: x86-page-gnttab.patch
Patch244: x86-alloc-cpu-structs.patch
Patch250: 32on64-extra-mem.patch
Patch251: msi-enable.patch
# PV Driver Patches
@ -507,6 +511,8 @@ Authors:
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
@ -563,6 +569,7 @@ Authors:
%patch182 -p1
%patch183 -p1
%patch184 -p1
%patch185 -p1
%patch190 -p1
%patch240 -p1
%patch241 -p1
@ -925,6 +932,17 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
/sbin/ldconfig
%changelog
* 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.
- fate#303867 - minimum HVM domain limits. Pulled upstream
patches for supporting up to 255 cpus.
* Fri Sep 26 2008 kwolf@suse.de
- bnc#430222 - Fixed block-attach for tap:aio images
* Thu Sep 25 2008 kwolf@suse.de
- bnc#429801 - Fixed xm start -c / --vncviewer
xm-start-fix.patch
* Wed Sep 24 2008 carnold@novell.com
- bnc#382401 - xm man page missing information for commands.
* Wed Sep 17 2008 carnold@novell.com

View File

@ -2,7 +2,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -3254,6 +3254,14 @@ class XendDomainInfo:
@@ -3225,6 +3225,14 @@ class XendDomainInfo:
if not config.has_key('backend'):
config['backend'] = "00000000-0000-0000-0000-000000000000"

View File

@ -2,7 +2,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1886,7 +1886,7 @@ class XendDomainInfo:
@@ -1864,7 +1864,7 @@ class XendDomainInfo:
try:
if not corefile:
this_time = time.strftime("%Y-%m%d-%H%M.%S", time.localtime())

View File

@ -172,8 +172,8 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
+ self.acquire_running_lock();
self._constructDomain()
self._storeVmDetails()
self._createDevices()
@@ -2339,6 +2343,11 @@ class XendDomainInfo:
self._createChannels()
@@ -2317,6 +2321,11 @@ class XendDomainInfo:
self._stateSet(DOM_STATE_HALTED)
self.domid = None # Do not push into _stateSet()!
@ -185,7 +185,7 @@ Index: xen-3.3.1-testing/tools/python/xen/xend/XendDomainInfo.py
finally:
self.refresh_shutdown_lock.release()
@@ -3567,6 +3576,74 @@ class XendDomainInfo:
@@ -3538,6 +3547,74 @@ class XendDomainInfo:
def has_device(self, dev_class, dev_uuid):
return (dev_uuid in self.info['%s_refs' % dev_class.lower()])

12
xenstore-leak.patch Normal file
View File

@ -0,0 +1,12 @@
diff -r 8cc28137805d tools/python/xen/xend/server/DevController.py
--- a/tools/python/xen/xend/server/DevController.py Thu Oct 09 11:00:51 2008 +0100
+++ b/tools/python/xen/xend/server/DevController.py Thu Oct 09 16:00:08 2008 -0600
@@ -257,7 +257,7 @@ class DevController:
if force:
frontpath = self.frontendPath(dev)
- backpath = self.readVm(devid, "backend")
+ backpath = xstransact.Read(frontpath, "backend")
if backpath:
xstransact.Remove(backpath)
xstransact.Remove(frontpath)

View File

@ -1,460 +0,0 @@
diff -r ae29cd95ba7d docs/man/xm.pod.1
--- a/docs/man/xm.pod.1 Mon Sep 22 15:33:42 2008 +0100
+++ b/docs/man/xm.pod.1 Tue Sep 23 09:40:54 2008 -0600
@@ -67,13 +67,12 @@ so running curses based interfaces over
so running curses based interfaces over the console B<is not
advised>. Vi tends to get very odd when using it over this interface.
-=item B<create> [B<-c>] I<configfile> [I<name>=I<value>]..
+=item B<create> I<configfile> [I<OPTIONS>] [I<vars>]..
-The create sub command requires a config file and can optionally take a
-series of name value pairs that add to or override variables defined
+The create subcommand requires a config file and can optionally take a
+series of I<vars> that add to or override variables defined
in the config file. See L<xmdomain.cfg> for full details of that file
-format, and possible options used in either the configfile or
-I<name>=I<value> combinations.
+format, and possible options used in either the configfile or for I<vars>.
I<configfile> can either be an absolute path to a file, or a relative
path to a file located in /etc/xen.
@@ -86,9 +85,65 @@ B<OPTIONS>
=over 4
-=item B<-c>
+=item B<--help_config>
-Attache console to the domain as soon as it has started. This is
+Print the available configuration variables I<vars>. These variables may be
+used on the command line or in the configuration file I<configfile>.
+
+=item B<-q>, B<--quiet>
+
+No console output.
+
+=item B<--path>
+
+Search path for configuration scripts. The value of PATH is a
+colon-separated directory list.
+
+=item B<-f=FILE>, B<--defconfig=FILE>
+
+Use the given Python configuration script. The configuration
+script is loaded after arguments have been processed. Each
+command-line option sets a configuration variable named after
+its long option name, and these variables are placed in the
+environment of the script before it is loaded. Variables
+for options that may be repeated have list values. Other
+variables can be set using name=value on the command line.
+After the script is loaded, option values that were not set
+on the command line are replaced by the values set in the script.
+
+=item B<-F=FILE>, B<--config=FILE>
+
+Use the given SXP formated configuration script.
+SXP is the underlying configuration format used by Xen.
+SXP configuration scripts can be hand-written or generated
+from Python configuration scripts, using the -n
+(dryrun) option to print the configuration. An SXP formatted
+configuration file may also be generated for a given I<domain-id> by
+redirecting the output from the the B<xm list --long I<domain-id>>
+to a file.
+
+=item B<-n>, B<--dryrun>
+
+Dry run - prints the resulting configuration in SXP
+but does not create the domain.
+
+=item B<-x>, B<--xmldryrun>
+
+XML dry run - prints the resulting configuration in
+XML but does not create the domain.
+
+=item B<-s>, B<--skipdtd>
+
+Skip DTD checking - skips checks on XML before
+creating. Experimental. Can decrease create time.
+
+=item B<-p>, B<--paused>
+
+Leave the domain paused after it is created.
+
+=item B<-c>, B<--console_autoconnect>
+
+Attach console to the domain as soon as it has started. This is
useful for determining issues with crashing domains.
=back
@@ -118,6 +173,11 @@ virtual networking. (This example comes
=back
+=item B<delete>
+
+Remove a domain from Xend domain management. The B<xm list> command
+shows the domain names.
+
=item B<destroy> I<domain-id>
Immediately terminate the domain I<domain-id>. This doesn't give the
@@ -133,6 +193,28 @@ Converts a domain name to a domain id us
Converts a domain id to a domain name using xend's internal mapping.
+=item B<dump-core> [I<OPTIONS>] I<domain-id> [I<filename>]
+
+Dumps the virtual machine's memory for the specified domain to the
+I<filename> specified. The dump file will be written to a distribution
+specific directory for dump files. Such as: /var/lib/xen/dump or
+/var/xen/dump Defaults to dumping the core without pausing the domain
+if no I<OPTIONS> are specified.
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-L>, B<--live>
+
+Dump core without pausing the domain.
+
+=item B<-C>, B<--crash>
+
+Crash domain after dumping core.
+
+=back
+
=item B<help> [B<--long>]
Displays the short help message (i.e. common commands).
@@ -140,10 +222,35 @@ The B<--long> option prints out the comp
The B<--long> option prints out the complete set of B<xm> subcommands,
grouped by function.
-=item B<list> [B<--long> | B<--label>] [I<domain-id> ...]
+=item B<list> [I<OPTIONS>] [I<domain-id> ...]
Prints information about one or more domains. If no domains are
specified it prints out information about all domains.
+
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-l>, B<--long>
+
+The output for B<xm list> is not the table view shown below, but
+instead presents the data in SXP format.
+
+=item B<--label>
+
+Security labels are added to the output of xm list and the lines
+are sorted by the labels (ignoring case).
+See the ACCESS CONTROL SUBCOMMAND section of this man page for more
+information about labels.
+
+=item B<--state=<state>>
+
+Output information for VMs in the specified state.
+
+=back
+
+B<EXAMPLE>
An example format for the list is as follows:
@@ -164,10 +271,10 @@ Xen.
B<STATES>
-=over 4
-
The State field lists 6 states for a Xen domain, and which ones the
current domain is in.
+
+=over 4
=item B<r - running>
@@ -204,32 +311,6 @@ FIXME: Is this right?
FIXME: Is this right?
=back
-
-B<LONG OUTPUT>
-
-=over 4
-
-If B<--long> is specified, the output for B<xm list> is not the table
-view shown above, but instead is an S-Expression representing all
-information known about all domains asked for. This is mostly only
-useful for external programs to parse the data.
-
-B<Note:> There is no stable guarantees on the format of this data.
-Use at your own risk.
-
-=back
-
-B<LABEL OUTPUT>
-
-=over 4
-
-If B<--label> is specified, the security labels are added to the
-output of B<xm list> and the lines are sorted by the labels (ignoring
-case). The B<--long> option prints the labels by default and cannot be
-combined with B<--label>. See the ACCESS CONTROL SUBCOMMAND section of
-this man page for more information about labels.
-
-==back
B<NOTES>
@@ -296,6 +377,90 @@ attempting to do other useful work.
=back
+=item B<new> I<configfile> [I<OPTIONS>] [I<vars>]...
+
+Adds a domain to Xend domain management.
+
+The new subcommand requires a config file and can optionally
+take a series of I<vars> that add to or override variables
+defined in the config file. See xmdomain.cfg for full details of that
+file format, and possible options used in either the configfile or for
+I<vars>.
+
+I<configfile> can either be an absolute path to a file, or a relative
+path to a file located in /etc/xen.
+
+The new subcommand will return without starting the domain. The
+domain needs to be started using the B<xm start> command.
+
+B<OPTIONS>
+
+=over 4
+
+=item B<--help_config>
+
+Print the available configuration variables I<vars>. These variables may be
+used on the command line or in the configuration file I<configfile>.
+
+=item B<-q>, B<--quiet>
+
+No console output.
+
+=item B<--path>
+
+Search path for configuration scripts. The value of PATH is a
+colon-separated directory list.
+
+=item B<-f=FILE>, B<--defconfig=FILE>
+
+
+Use the given Python configuration script. The configuration
+script is loaded after arguments have been processed. Each
+command-line option sets a configuration variable named after
+its long option name, and these variables are placed in the
+environment of the script before it is loaded. Variables
+for options that may be repeated have list values. Other
+variables can be set using name=value on the command line.
+After the script is loaded, option values that were not set
+on the command line are replaced by the values set in the script.
+
+=item B<-F=FILE>, B<--config=FILE>
+
+Use the given SXP formated configuration script.
+SXP is the underlying configuration format used by Xen.
+SXP configuration scripts can be hand-written or generated
+from Python configuration scripts, using the -n
+(dryrun) option to print the configuration. An SXP formatted
+configuration file may also be generated for a given I<domain-id> by
+redirecting the output from the the B<xm list --long I<domain-id>>
+to a file.
+
+=item B<-n>, B<--dryrun>
+
+Dry run - prints the resulting configuration in SXP
+but does not create the domain.
+
+=item B<-x>, B<--xmldryrun>
+
+XML dry run - prints the resulting configuration in
+XML but does not create the domain.
+
+=item B<-s>, B<--skipdtd>
+
+Skip DTD checking - skips checks on XML before
+creating. Experimental. Can decrease create time.
+
+=item B<-p>, B<--paused>
+
+Leave the domain paused after it is created.
+
+=item B<-c>, B<--console_autoconnect>
+
+Attach console to the domain as soon as it has started. This is
+useful for determining issues with crashing domains.
+
+=back
+
=item B<pause> I<domain-id>
Pause a domain. When in a paused state the domain will still consume
@@ -331,6 +496,22 @@ as all services in the domain will have
=item B<restore> I<state-file>
Build a domain from an B<xm save> state file. See B<save> for more info.
+
+=item B<resume> I<domain-name> [I<OPTIONS>]
+
+Moves a domain out of the suspended state and back into memory.
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-p>, <--paused>
+
+Moves a domain back into memory but leaves the domain in a paused state.
+The B<xm unpause> subcommand may then be used to bring it out of the
+paused state.
+
+=back
=item B<save> I<domain-id> I<state-file>
@@ -369,6 +550,31 @@ Wait for the domain to complete shutdown
Wait for the domain to complete shutdown before returning.
=back
+
+=item B<start> I<domain-name> [I<OPTIONS>]
+
+Start a Xend managed domain that was added using the B<xm new> command.
+
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-p>, B<--paused>
+
+Do not unpause domain after starting it.
+
+=item B<-c>, B<--console_autoconnect>
+
+Connect to the console after the domain is created.
+
+=back
+
+=item B<suspend> I<domain-name>
+
+Suspend a domain to a state file so that it can be later
+resumed using the B<xm resume> subcommand. Similar to the B<xm save>
+subcommand although the state file may not be specified.
=item B<sysrq> I<domain-id> I<letter>
@@ -477,10 +683,10 @@ page more readable):
B<FIELDS>
-=over 4
-
Not all fields will be explained here, but some of the less obvious
ones deserve explanation:
+
+=over 4
=item B<hw_caps>
@@ -514,6 +720,10 @@ Executes the B<xentop> command, which pr
Executes the B<xentop> command, which provides real time monitoring of
domains. Xentop is a curses interface, and reasonably self
explanatory.
+
+=item B<uptime>
+
+Prints the current uptime of the domains running.
=back
@@ -698,13 +908,19 @@ List virtual block devices for a domain.
List virtual block devices for a domain. The returned output is
formatted as a list or as an S-Expression if the B<--long> option was given.
+=back
+
=head2 NETWORK DEVICES
+
+=over 4
=item B<network-attach> I<domain-id> [B<script=>I<scriptname>] [B<ip=>I<ipaddr>]
[B<mac=>I<macaddr>] [B<bridge=>I<bridge-name>] [B<backend=>I<bedomain-id>]
Creates a new network device in the domain specified by I<domain-id>. It
takes the following optional options:
+
+=back
B<OPTIONS>
@@ -739,6 +955,8 @@ The backend domain id. By default this
=back
+=over 4
+
=item B<network-detach> I<domain-id> I<devid>
Removes the network device from the domain specified by I<domain-id>.
@@ -753,7 +971,11 @@ List virtual network interfaces for a do
List virtual network interfaces for a domain. The returned output is
formatted as a list or as an S-Expression if the B<--long> option was given.
+=back
+
=head2 VIRTUAL TPM DEVICES
+
+=over 4
=item B<vtpm-list> [B<-l>|B<--long>] I<domain-id>
@@ -828,6 +1050,8 @@ described under "Configuring Security" b
described under "Configuring Security" below. There, you will find
also examples of each subcommand described here.
+=over 4
+
=item B<setpolicy> ACM I<policy>
Makes the given ACM policy available to xend as a I<xend-managed policy>.
@@ -835,6 +1059,8 @@ version of the policy is created. The po
version of the policy is created. The policy is loaded and the system's
bootloader is prepared to boot the system with this policy the next time
it is started.
+
+=back
=over 4
@@ -848,6 +1074,8 @@ global policy root directory.
global policy root directory.
=back
+
+=over 4
=item B<resetpolicy>
@@ -1155,6 +1383,8 @@ their binary identifiers (ssidrefs) used
=back
+=back
+
=head1 SEE ALSO
B<xmdomain.cfg>(5), B<xentop>(1)