Accepting request 103458 from Virtualization

Checkin for os12.2

OBS-URL: https://build.opensuse.org/request/show/103458
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/xen?expand=0&rev=152
This commit is contained in:
Stephan Kulow 2012-02-10 16:20:50 +00:00 committed by Git OBS Bridge
commit 10a80b26fe
128 changed files with 7488 additions and 442 deletions

View File

@ -16,10 +16,17 @@ a new physdevop hypercall).
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/arch/x86/physdev.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/physdev.c
+++ xen-4.1.2-testing/xen/arch/x86/physdev.c
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1322813126 -3600
# Node ID 60d4e257d04ba0bd663bbef5e93a97b6d8b66e54
# Parent 3f815406feb25a9348d8be9bc49fdc8c93ccb7c2
x86-64/mmcfg: remove __initdata annotation overlooked in 23749:e8d1c8f074ba
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -16,6 +16,10 @@
#include <xsm/xsm.h>
#include <asm/p2m.h>
@ -56,10 +63,8 @@ Index: xen-4.1.2-testing/xen/arch/x86/physdev.c
case PHYSDEVOP_restore_msi: {
struct physdev_restore_msi restore_msi;
struct pci_dev *pdev;
Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig.h
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/mmconfig.h
+++ xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig.h
--- a/xen/arch/x86/x86_64/mmconfig.h
+++ b/xen/arch/x86/x86_64/mmconfig.h
@@ -84,6 +84,11 @@ extern int pci_mmcfg_config_num;
extern struct acpi_mcfg_allocation *pci_mmcfg_config;
@ -73,10 +78,8 @@ Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig.h
-void pci_mmcfg_arch_free(void);
+int pci_mmcfg_arch_enable(unsigned int);
+void pci_mmcfg_arch_disable(unsigned int);
Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig-shared.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/mmconfig-shared.c
+++ xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig-shared.c
--- a/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -22,10 +22,10 @@
#include <asm/e820.h>
#include <asm/msr.h>
@ -182,12 +185,12 @@ Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig-shared.c
- /* for late to exit */
- if (known_bridge)
- return;
-
- if (pci_mmcfg_check_hostbridge())
- known_bridge = 1;
+ if (pci_mmcfg_check_hostbridge()) {
+ unsigned int i;
- if (pci_mmcfg_check_hostbridge())
- known_bridge = 1;
-
- if (!known_bridge) {
+ pci_mmcfg_arch_init();
+ for (i = 0; i < pci_mmcfg_config_num; ++i)
@ -244,10 +247,17 @@ Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig-shared.c
}
/**
Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig_64.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/mmconfig_64.c
+++ xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig_64.c
--- a/xen/arch/x86/x86_64/mmconfig_64.c
+++ b/xen/arch/x86/x86_64/mmconfig_64.c
@@ -23,7 +23,7 @@ struct mmcfg_virt {
char __iomem *virt;
};
static struct mmcfg_virt *pci_mmcfg_virt;
-static int __initdata mmcfg_pci_segment_shift;
+static unsigned int mmcfg_pci_segment_shift;
static char __iomem *get_virt(unsigned int seg, unsigned int *bus)
{
@@ -112,7 +112,8 @@ int pci_mmcfg_write(unsigned int seg, un
return 0;
}
@ -350,10 +360,8 @@ Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mmconfig_64.c
- xfree(pci_mmcfg_virt);
- pci_mmcfg_virt = NULL;
-}
Index: xen-4.1.2-testing/xen/arch/x86/x86_64/physdev.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/physdev.c
+++ xen-4.1.2-testing/xen/arch/x86/x86_64/physdev.c
--- a/xen/arch/x86/x86_64/physdev.c
+++ b/xen/arch/x86/x86_64/physdev.c
@@ -54,6 +54,10 @@
#define physdev_get_free_pirq compat_physdev_get_free_pirq
#define physdev_get_free_pirq_t physdev_get_free_pirq_compat_t
@ -365,10 +373,8 @@ Index: xen-4.1.2-testing/xen/arch/x86/x86_64/physdev.c
#define COMPAT
#undef guest_handle_okay
#define guest_handle_okay compat_handle_okay
Index: xen-4.1.2-testing/xen/include/public/physdev.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/public/physdev.h
+++ xen-4.1.2-testing/xen/include/public/physdev.h
--- a/xen/include/public/physdev.h
+++ b/xen/include/public/physdev.h
@@ -255,6 +255,19 @@ struct physdev_get_free_pirq {
typedef struct physdev_get_free_pirq physdev_get_free_pirq_t;
DEFINE_XEN_GUEST_HANDLE(physdev_get_free_pirq_t);
@ -389,10 +395,8 @@ Index: xen-4.1.2-testing/xen/include/public/physdev.h
/*
* Notify that some PIRQ-bound event channels have been unmasked.
* ** This command is obsolete since interface version 0x00030202 and is **
Index: xen-4.1.2-testing/xen/include/xlat.lst
===================================================================
--- xen-4.1.2-testing.orig/xen/include/xlat.lst
+++ xen-4.1.2-testing/xen/include/xlat.lst
--- a/xen/include/xlat.lst
+++ b/xen/include/xlat.lst
@@ -60,6 +60,7 @@
! memory_map memory.h
! memory_reservation memory.h

View File

@ -25,7 +25,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
mfn_t mfn;
int ret;
+ p2m_unlock(p2m);
+ p2m_lock(p2m);
+
mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query);

View File

@ -0,0 +1,127 @@
changeset: 23949:39df16923958
user: Jan Beulich <jbeulich@suse.com>
date: Thu Oct 13 10:00:13 2011 +0200
files: xen/arch/x86/cpu/mcheck/vmce.c xen/arch/x86/traps.c xen/common/schedule.c xen/include/xen/sched.h
description:
constify vcpu_set_affinity()'s second parameter
None of the callers actually make use of the function's returning of
the old affinity through its second parameter, and eliminating this
capability allows some callers to no longer use a local variable here,
reducing their stack footprint significantly when building with large
NR_CPUS.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---
xen/arch/x86/cpu/mcheck/vmce.c | 5 +----
xen/arch/x86/traps.c | 10 ++--------
xen/common/schedule.c | 6 ++----
xen/include/xen/sched.h | 2 +-
4 files changed, 6 insertions(+), 17 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/cpu/mcheck/vmce.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/cpu/mcheck/vmce.c
+++ xen-4.1.2-testing/xen/arch/x86/cpu/mcheck/vmce.c
@@ -304,7 +304,6 @@ int vmce_wrmsr(u32 msr, u64 val)
int inject_vmce(struct domain *d)
{
int cpu = smp_processor_id();
- cpumask_t affinity;
/* PV guest and HVM guest have different vMCE# injection methods. */
if ( !test_and_set_bool(d->vcpu[0]->mce_pending) )
@@ -323,11 +322,9 @@ int inject_vmce(struct domain *d)
{
d->vcpu[0]->cpu_affinity_tmp =
d->vcpu[0]->cpu_affinity;
- cpus_clear(affinity);
- cpu_set(cpu, affinity);
mce_printk(MCE_VERBOSE, "MCE: CPU%d set affinity, old %d\n",
cpu, d->vcpu[0]->processor);
- vcpu_set_affinity(d->vcpu[0], &affinity);
+ vcpu_set_affinity(d->vcpu[0], cpumask_of(cpu));
vcpu_kick(d->vcpu[0]);
}
else
Index: xen-4.1.2-testing/xen/arch/x86/traps.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/traps.c
+++ xen-4.1.2-testing/xen/arch/x86/traps.c
@@ -3104,7 +3104,6 @@ static void nmi_mce_softirq(void)
{
int cpu = smp_processor_id();
struct softirq_trap *st = &per_cpu(softirq_trap, cpu);
- cpumask_t affinity;
BUG_ON(st == NULL);
BUG_ON(st->vcpu == NULL);
@@ -3120,9 +3119,7 @@ static void nmi_mce_softirq(void)
* Make sure to wakeup the vcpu on the
* specified processor.
*/
- cpus_clear(affinity);
- cpu_set(st->processor, affinity);
- vcpu_set_affinity(st->vcpu, &affinity);
+ vcpu_set_affinity(st->vcpu, cpumask_of(st->processor));
/* Affinity is restored in the iret hypercall. */
}
@@ -3192,14 +3189,11 @@ void async_exception_cleanup(struct vcpu
!test_and_set_bool(curr->mce_pending) )
{
int cpu = smp_processor_id();
- cpumask_t affinity;
curr->cpu_affinity_tmp = curr->cpu_affinity;
- cpus_clear(affinity);
- cpu_set(cpu, affinity);
printk(XENLOG_DEBUG "MCE: CPU%d set affinity, old %d\n",
cpu, curr->processor);
- vcpu_set_affinity(curr, &affinity);
+ vcpu_set_affinity(curr, cpumask_of(cpu));
}
}
}
Index: xen-4.1.2-testing/xen/common/schedule.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/schedule.c
+++ xen-4.1.2-testing/xen/common/schedule.c
@@ -593,9 +593,9 @@ int cpu_disable_scheduler(unsigned int c
return ret;
}
-int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity)
+int vcpu_set_affinity(struct vcpu *v, const cpumask_t *affinity)
{
- cpumask_t online_affinity, old_affinity;
+ cpumask_t online_affinity;
cpumask_t *online;
if ( v->domain->is_pinned )
@@ -607,9 +607,7 @@ int vcpu_set_affinity(struct vcpu *v, cp
vcpu_schedule_lock_irq(v);
- old_affinity = v->cpu_affinity;
v->cpu_affinity = *affinity;
- *affinity = old_affinity;
if ( !cpu_isset(v->processor, v->cpu_affinity) )
set_bit(_VPF_migrating, &v->pause_flags);
Index: xen-4.1.2-testing/xen/include/xen/sched.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/sched.h
+++ xen-4.1.2-testing/xen/include/xen/sched.h
@@ -623,7 +623,7 @@ void scheduler_free(struct scheduler *sc
int schedule_cpu_switch(unsigned int cpu, struct cpupool *c);
void vcpu_force_reschedule(struct vcpu *v);
int cpu_disable_scheduler(unsigned int cpu);
-int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity);
+int vcpu_set_affinity(struct vcpu *v, const cpumask_t *affinity);
void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate);
uint64_t get_cpu_idle_time(unsigned int cpu);

View File

@ -0,0 +1,27 @@
changeset: 24104:4daa4ad90f12
user: Keir Fraser <keir@xen.org>
date: Tue Nov 08 19:33:46 2011 +0000
files: xen/common/wait.c
description:
waitqueue: Double size of x86 shadow stack.
Signed-off-by: Keir Fraser <keir@xen.org>
---
xen/common/wait.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -33,7 +33,7 @@ struct waitqueue_vcpu {
* hypervisor context before sleeping (descheduling), setjmp/longjmp-style.
*/
void *esp;
- char stack[1500];
+ char stack[3000];
#endif
};

View File

@ -0,0 +1,30 @@
changeset: 24105:89efd82620ec
user: Olaf Hering <olaf@aepfle.de>
date: Tue Nov 08 19:35:01 2011 +0000
files: xen/arch/x86/mm/p2m.c
description:
xenpaging: compare domain pointer in p2m_mem_paging_populate
Compare just the domain pointer instead of the domain_id number.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Keir Fraser <keir@xen.org>
---
xen/arch/x86/mm/p2m.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
@@ -3060,7 +3060,7 @@ void p2m_mem_paging_populate(struct p2m_
p2m_unlock(p2m);
/* Pause domain if request came from guest and gfn has paging type */
- if ( p2m_is_paging(p2mt) && v->domain->domain_id == d->domain_id )
+ if ( p2m_is_paging(p2mt) && v->domain == d )
{
vcpu_pause_nosync(v);
req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;

View File

@ -0,0 +1,112 @@
changeset: 24106:2af5bfbc9fde
user: Olaf Hering <olaf@aepfle.de>
date: Tue Nov 08 19:35:42 2011 +0000
files: xen/arch/x86/mm/mem_event.c
description:
mem_event: check capabilities only once
It is not required to check the system capabilities during every domctl.
Rearrange the code to check them only once.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Keir Fraser <keir@xen.org>
---
xen/arch/x86/mm/mem_event.c | 54 ++++++++++++++++++++++++--------------------
1 file changed, 30 insertions(+), 24 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/mem_event.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c
@@ -253,32 +253,35 @@ int mem_event_domctl(struct domain *d, x
case XEN_DOMCTL_MEM_EVENT_OP_PAGING:
{
struct mem_event_domain *med = &d->mem_paging;
- struct p2m_domain *p2m = p2m_get_hostp2m(d);
- rc = -ENODEV;
- /* Only HAP is supported */
- if ( !hap_enabled(d) )
- break;
-
- /* Currently only EPT is supported */
- if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
- break;
-
- rc = -EXDEV;
- /* Disallow paging in a PoD guest */
- if ( p2m->pod.entry_count )
- break;
+ rc = -EINVAL;
switch( mec->op )
{
case XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE:
{
+ struct p2m_domain *p2m = p2m_get_hostp2m(d);
+ rc = -ENODEV;
+ /* Only HAP is supported */
+ if ( !hap_enabled(d) )
+ break;
+
+ /* Currently only EPT is supported */
+ if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
+ break;
+
+ rc = -EXDEV;
+ /* Disallow paging in a PoD guest */
+ if ( p2m->pod.entry_count )
+ break;
+
rc = mem_event_enable(d, mec, med);
}
break;
case XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE:
{
- rc = mem_event_disable(med);
+ if ( med->ring_page )
+ rc = mem_event_disable(med);
}
break;
@@ -295,26 +298,29 @@ int mem_event_domctl(struct domain *d, x
case XEN_DOMCTL_MEM_EVENT_OP_ACCESS:
{
struct mem_event_domain *med = &d->mem_access;
- rc = -ENODEV;
- /* Only HAP is supported */
- if ( !hap_enabled(d) )
- break;
-
- /* Currently only EPT is supported */
- if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
- break;
+ rc = -EINVAL;
switch( mec->op )
{
case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE:
{
+ rc = -ENODEV;
+ /* Only HAP is supported */
+ if ( !hap_enabled(d) )
+ break;
+
+ /* Currently only EPT is supported */
+ if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
+ break;
+
rc = mem_event_enable(d, mec, med);
}
break;
case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE:
{
- rc = mem_event_disable(&d->mem_access);
+ if ( med->ring_page )
+ rc = mem_event_disable(&d->mem_access);
}
break;

View File

@ -1,5 +1,8 @@
# HG changeset patch
# Parent 951a9879c34bee1dd2fa0329a541ae089f271c11
changeset: 24138:e2cc58b85b6e
user: Olaf Hering <olaf@aepfle.de>
date: Mon Nov 14 17:49:14 2011 +0000
files: tools/xenpaging/pagein.c
description:
xenpaging: munmap all pages after page-in
Do munmap() on all mapped pages, not just the first one. Without this
@ -8,6 +11,8 @@ because the page count does not go down to 1. This change was missing
from changeset 23827:d1d6abc1db20.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
tools/xenpaging/pagein.c | 2 +-

View File

@ -0,0 +1,107 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321459471 0
# Node ID 644ca5d3ec435f3372ce88a4de86909bd4033819
# Parent 1cbb3c1dfb3203f5344a6c1c52507b9e75af6742
x86/emulator: add feature checks for newer instructions
Certain instructions were introduced only after the i686 or original
x86-64 architecture, so we should not try to emulate them if the guest
is not seeing the respective feature enabled (or, worse, if the
underlying hardware doesn't support them). This affects fisttp,
movnti, and cmpxchg16b.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -955,6 +955,47 @@ in_protmode(
return !(in_realmode(ctxt, ops) || (ctxt->regs->eflags & EFLG_VM));
}
+#define EAX 0
+#define ECX 1
+#define EDX 2
+#define EBX 3
+
+static bool_t vcpu_has(
+ unsigned int eax,
+ unsigned int reg,
+ unsigned int bit,
+ struct x86_emulate_ctxt *ctxt,
+ const struct x86_emulate_ops *ops)
+{
+ unsigned int ebx = 0, ecx = 0, edx = 0;
+ int rc;
+
+ fail_if(!ops->cpuid);
+ rc = ops->cpuid(&eax, &ebx, &ecx, &edx, ctxt);
+ if ( rc == X86EMUL_OKAY )
+ {
+ switch ( reg )
+ {
+ case EAX: reg = eax; break;
+ case EBX: reg = ebx; break;
+ case ECX: reg = ecx; break;
+ case EDX: reg = edx; break;
+ default: BUG();
+ }
+ if ( !(reg & (1U << bit)) )
+ rc = ~X86EMUL_OKAY;
+ }
+
+ done:
+ return rc == X86EMUL_OKAY;
+}
+
+#define vcpu_must_have(leaf, reg, bit) \
+ generate_exception_if(!vcpu_has(leaf, reg, bit, ctxt, ops), EXC_UD, -1)
+#define vcpu_must_have_sse2() vcpu_must_have(0x00000001, EDX, 26)
+#define vcpu_must_have_sse3() vcpu_must_have(0x00000001, ECX, 0)
+#define vcpu_must_have_cx16() vcpu_must_have(0x00000001, ECX, 13)
+
static int
in_longmode(
struct x86_emulate_ctxt *ctxt,
@@ -2738,6 +2779,7 @@ x86_emulate(
emulate_fpu_insn_memsrc("fildl", src.val);
break;
case 1: /* fisttp m32i */
+ vcpu_must_have_sse3();
ea.bytes = 4;
dst = ea;
dst.type = OP_MEM;
@@ -2846,6 +2888,7 @@ x86_emulate(
emulate_fpu_insn_memsrc("fldl", src.val);
break;
case 1: /* fisttp m64i */
+ vcpu_must_have_sse3();
ea.bytes = 8;
dst = ea;
dst.type = OP_MEM;
@@ -2953,6 +2996,7 @@ x86_emulate(
emulate_fpu_insn_memsrc("fild", src.val);
break;
case 1: /* fisttp m16i */
+ vcpu_must_have_sse3();
ea.bytes = 2;
dst = ea;
dst.type = OP_MEM;
@@ -4141,6 +4185,7 @@ x86_emulate(
case 0xc3: /* movnti */
/* Ignore the non-temporal hint for now. */
+ vcpu_must_have_sse2();
generate_exception_if(dst.bytes <= 2, EXC_UD, -1);
dst.val = src.val;
break;
@@ -4151,6 +4196,8 @@ x86_emulate(
generate_exception_if((modrm_reg & 7) != 1, EXC_UD, -1);
generate_exception_if(ea.type != OP_MEM, EXC_UD, -1);
+ if ( op_bytes == 8 )
+ vcpu_must_have_cx16();
op_bytes *= 2;
/* Get actual old value. */

View File

@ -0,0 +1,68 @@
changeset: 24171:fe80909663c1
user: Keir Fraser <keir@xen.org>
date: Tue Nov 22 13:00:21 2011 +0000
files: xen/common/wait.c
description:
x86,waitqueue: Allocate whole page for shadow stack.
Signed-off-by: Keir Fraser <keir@xen.org>
---
xen/common/wait.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -33,7 +33,7 @@ struct waitqueue_vcpu {
* hypervisor context before sleeping (descheduling), setjmp/longjmp-style.
*/
void *esp;
- char stack[3000];
+ char *stack;
#endif
};
@@ -41,11 +41,19 @@ int init_waitqueue_vcpu(struct vcpu *v)
{
struct waitqueue_vcpu *wqv;
- wqv = xmalloc(struct waitqueue_vcpu);
+ wqv = xzalloc(struct waitqueue_vcpu);
if ( wqv == NULL )
return -ENOMEM;
- memset(wqv, 0, sizeof(*wqv));
+#ifdef CONFIG_X86
+ wqv->stack = alloc_xenheap_page();
+ if ( wqv->stack == NULL )
+ {
+ xfree(wqv);
+ return -ENOMEM;
+ }
+#endif
+
INIT_LIST_HEAD(&wqv->list);
wqv->vcpu = v;
@@ -63,6 +71,9 @@ void destroy_waitqueue_vcpu(struct vcpu
return;
BUG_ON(!list_empty(&wqv->list));
+#ifdef CONFIG_X86
+ free_xenheap_page(wqv->stack);
+#endif
xfree(wqv);
v->waitqueue_vcpu = NULL;
@@ -115,7 +126,7 @@ static void __prepare_to_wait(struct wai
: "=S" (wqv->esp)
: "c" (cpu_info), "D" (wqv->stack)
: "memory" );
- BUG_ON((cpu_info - (char *)wqv->esp) > sizeof(wqv->stack));
+ BUG_ON((cpu_info - (char *)wqv->esp) > PAGE_SIZE);
}
static void __finish_wait(struct waitqueue_vcpu *wqv)

View File

@ -0,0 +1,53 @@
changeset: 24178:1f2a06dbbb69
user: Keir Fraser <keir@xen.org>
date: Tue Nov 22 15:35:26 2011 +0000
files: xen/common/keyhandler.c
description:
debug: Add domain/vcpu pause_count info to 'd' key.
Signed-off-by: Keir Fraser <keir@xen.org>
---
xen/common/keyhandler.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
Index: xen-4.1.2-testing/xen/common/keyhandler.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/keyhandler.c
+++ xen-4.1.2-testing/xen/common/keyhandler.c
@@ -244,9 +244,10 @@ static void dump_domains(unsigned char k
unsigned int i;
printk("General information for domain %u:\n", d->domain_id);
cpuset_print(tmpstr, sizeof(tmpstr), d->domain_dirty_cpumask);
- printk(" refcnt=%d dying=%d nr_pages=%d xenheap_pages=%d "
- "dirty_cpus=%s max_pages=%u\n",
+ printk(" refcnt=%d dying=%d pause_count=%d\n",
atomic_read(&d->refcnt), d->is_dying,
+ atomic_read(&d->pause_count));
+ printk(" nr_pages=%d xenheap_pages=%d dirty_cpus=%s max_pages=%u\n",
d->tot_pages, d->xenheap_pages, tmpstr, d->max_pages);
printk(" handle=%02x%02x%02x%02x-%02x%02x-%02x%02x-"
"%02x%02x-%02x%02x%02x%02x%02x%02x vm_assist=%08lx\n",
@@ -270,17 +271,18 @@ static void dump_domains(unsigned char k
d->domain_id);
for_each_vcpu ( d, v )
{
- printk(" VCPU%d: CPU%d [has=%c] flags=%lx poll=%d "
+ printk(" VCPU%d: CPU%d [has=%c] poll=%d "
"upcall_pend = %02x, upcall_mask = %02x ",
v->vcpu_id, v->processor,
- v->is_running ? 'T':'F',
- v->pause_flags, v->poll_evtchn,
+ v->is_running ? 'T':'F', v->poll_evtchn,
vcpu_info(v, evtchn_upcall_pending),
vcpu_info(v, evtchn_upcall_mask));
cpuset_print(tmpstr, sizeof(tmpstr), v->vcpu_dirty_cpumask);
printk("dirty_cpus=%s ", tmpstr);
cpuset_print(tmpstr, sizeof(tmpstr), v->cpu_affinity);
printk("cpu_affinity=%s\n", tmpstr);
+ printk(" pause_count=%d pause_flags=%lx\n",
+ atomic_read(&v->pause_count), v->pause_flags);
arch_dump_vcpu_info(v);
periodic_timer_print(tmpstr, sizeof(tmpstr), v->periodic_period);
printk(" %s\n", tmpstr);

View File

@ -0,0 +1,50 @@
# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1322148057 0
# Node ID 7da681c490e0a8a2b3f1fb311d254dc7ce618a43
# Parent b082fdc52ad7607d93b59148fb289aafe21f294b
x86/mm/p2m: fix pod locking
The path p2m-lookup -> p2m-pt->get_entry -> 1GB PoD superpage ->
pod_demand_populate ends in the pod code performing a p2m_set_entry with
no locks held (in order to split the 1GB superpage into 512 2MB ones)
Further, it calls p2m_unlock after that, which will break the spinlock.
This patch attempts to fix that.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1244,7 +1244,6 @@ p2m_pod_demand_populate(struct p2m_domai
set_p2m_entry(p2m, gfn_aligned, _mfn(POPULATE_ON_DEMAND_MFN), 9,
p2m_populate_on_demand, p2m->default_access);
audit_p2m(p2m, 1);
- p2m_unlock(p2m);
return 0;
}
@@ -1602,7 +1601,8 @@ pod_retry_l3:
{
if ( q != p2m_query )
{
- if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) )
+ if ( !p2m_pod_check_and_populate(p2m, gfn,
+ (l1_pgentry_t *) &l3e, 18, q) )
goto pod_retry_l3;
}
else
@@ -1733,7 +1733,8 @@ static mfn_t p2m_gfn_to_mfn_current(stru
/* The read has succeeded, so we know that mapping exists */
if ( q != p2m_query )
{
- if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) )
+ if ( !p2m_pod_check_and_populate(p2m, gfn,
+ (l1_pgentry_t *) &l3e, 18, q) )
goto pod_retry_l3;
p2mt = p2m_invalid;
printk("%s: Allocate 1GB failed!\n", __func__);

View File

@ -0,0 +1,25 @@
# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1322148057 0
# Node ID 6b3d8250ee2c63d90680c142549123a4b1559f55
# Parent 7da681c490e0a8a2b3f1fb311d254dc7ce618a43
x86/mm: change return code for log-dirty disabling
Disabling log dirty mode in HAP always returns -EINVAL. Make it
return the correct rc on success.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -710,6 +710,8 @@ int hap_domctl(struct domain *d, xen_dom
return rc;
case XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION:
sc->mb = hap_get_allocation(d);
+ /* Fall through... */
+ case XEN_DOMCTL_SHADOW_OP_OFF:
return 0;
default:
HAP_ERROR("Bad hap domctl op %u\n", sc->op);

View File

@ -0,0 +1,21 @@
# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1322149491 0
# Node ID 67d2ac426defedad9c10eb339019f9dc9f02d2ae
# Parent 3c864e04c2ad060ca1cac6579994777993fef6e6
Trivial fix for rc val in hap track dirty vram
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -143,7 +143,7 @@ int hap_track_dirty_vram(struct domain *
}
else if ( !paging_mode_log_dirty(d) && !dirty_vram )
{
- rc -ENOMEM;
+ rc = -ENOMEM;
if ( (dirty_vram = xmalloc(struct sh_dirty_vram)) == NULL )
goto param_fail;

View File

@ -0,0 +1,68 @@
changeset: 24195:9b65336f688f
user: Keir Fraser <keir@xen.org>
date: Thu Nov 24 15:48:10 2011 +0000
files: xen/common/wait.c
description:
waitqueue: Detect saved-stack overflow and crash the guest.
Signed-off-by: Keir Fraser <keir@xen.org>
---
xen/common/wait.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -106,13 +106,16 @@ void wake_up(struct waitqueue_head *wq)
static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
{
char *cpu_info = (char *)get_cpu_info();
+
asm volatile (
#ifdef CONFIG_X86_64
"push %%rax; push %%rbx; push %%rcx; push %%rdx; push %%rdi; "
"push %%rbp; push %%r8; push %%r9; push %%r10; push %%r11; "
"push %%r12; push %%r13; push %%r14; push %%r15; call 1f; "
"1: mov 80(%%rsp),%%rdi; mov 96(%%rsp),%%rcx; mov %%rsp,%%rsi; "
- "sub %%rsi,%%rcx; rep movsb; mov %%rsp,%%rsi; pop %%rax; "
+ "sub %%rsi,%%rcx; cmp %3,%%rcx; jbe 2f; "
+ "xor %%esi,%%esi; jmp 3f; "
+ "2: rep movsb; mov %%rsp,%%rsi; 3: pop %%rax; "
"pop %%r15; pop %%r14; pop %%r13; pop %%r12; "
"pop %%r11; pop %%r10; pop %%r9; pop %%r8; "
"pop %%rbp; pop %%rdi; pop %%rdx; pop %%rcx; pop %%rbx; pop %%rax"
@@ -120,13 +123,20 @@ static void __prepare_to_wait(struct wai
"push %%eax; push %%ebx; push %%ecx; push %%edx; push %%edi; "
"push %%ebp; call 1f; "
"1: mov 8(%%esp),%%edi; mov 16(%%esp),%%ecx; mov %%esp,%%esi; "
- "sub %%esi,%%ecx; rep movsb; mov %%esp,%%esi; pop %%eax; "
+ "sub %%esi,%%ecx; cmp %3,%%ecx; jbe 2f; "
+ "xor %%esi,%%esi; jmp 3f; "
+ "2: rep movsb; mov %%esp,%%esi; 3: pop %%eax; "
"pop %%ebp; pop %%edi; pop %%edx; pop %%ecx; pop %%ebx; pop %%eax"
#endif
: "=S" (wqv->esp)
- : "c" (cpu_info), "D" (wqv->stack)
+ : "c" (cpu_info), "D" (wqv->stack), "i" (PAGE_SIZE)
: "memory" );
- BUG_ON((cpu_info - (char *)wqv->esp) > PAGE_SIZE);
+
+ if ( unlikely(wqv->esp == 0) )
+ {
+ gdprintk(XENLOG_ERR, "Stack too large in %s\n", __FUNCTION__);
+ domain_crash_synchronous();
+ }
}
static void __finish_wait(struct waitqueue_vcpu *wqv)
@@ -162,6 +172,7 @@ void prepare_to_wait(struct waitqueue_he
struct vcpu *curr = current;
struct waitqueue_vcpu *wqv = curr->waitqueue_vcpu;
+ ASSERT(!in_atomic());
ASSERT(list_empty(&wqv->list));
spin_lock(&wq->lock);

View File

@ -0,0 +1,49 @@
changeset: 24196:de4fe05fe887
user: Keir Fraser <keir@xen.org>
date: Thu Nov 24 15:49:25 2011 +0000
files: xen/common/wait.c
description:
waitqueue: Reorder prepare_to_wait() so that vcpu is definitely on the
queue on exit, even after a wakeup.
Otherwise, when we go round the loop in wait_event(), we may not
actually sleep after the first iteration, as we do not put ourselves
back on the queue on wakeup.
Signed-off-by: Keir Fraser <keir@xen.org>
---
xen/common/wait.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -107,6 +107,8 @@ static void __prepare_to_wait(struct wai
{
char *cpu_info = (char *)get_cpu_info();
+ ASSERT(wqv->esp == 0);
+
asm volatile (
#ifdef CONFIG_X86_64
"push %%rax; push %%rbx; push %%rcx; push %%rdx; push %%rdi; "
@@ -173,14 +175,13 @@ void prepare_to_wait(struct waitqueue_he
struct waitqueue_vcpu *wqv = curr->waitqueue_vcpu;
ASSERT(!in_atomic());
- ASSERT(list_empty(&wqv->list));
+ __prepare_to_wait(wqv);
+ ASSERT(list_empty(&wqv->list));
spin_lock(&wq->lock);
list_add_tail(&wqv->list, &wq->list);
vcpu_pause_nosync(curr);
spin_unlock(&wq->lock);
-
- __prepare_to_wait(wqv);
}
void finish_wait(struct waitqueue_head *wq)

View File

@ -0,0 +1,78 @@
changeset: 24197:ca92c4a8b31f
user: Keir Fraser <keir@xen.org>
date: Thu Nov 24 15:50:08 2011 +0000
files: xen/common/wait.c
description:
x86/waitqueue: Because we have per-cpu stacks, we must wake up on teh
same cpu that we slept on. Otherwise stack references are bogus on
wakeup.
Signed-off-by: Keir Fraser <keir@xen.org>
---
xen/common/wait.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -34,6 +34,8 @@ struct waitqueue_vcpu {
*/
void *esp;
char *stack;
+ cpumask_t saved_affinity;
+ unsigned int wakeup_cpu;
#endif
};
@@ -106,9 +108,19 @@ void wake_up(struct waitqueue_head *wq)
static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
{
char *cpu_info = (char *)get_cpu_info();
+ struct vcpu *curr = current;
ASSERT(wqv->esp == 0);
+ /* Save current VCPU affinity; force wakeup on *this* CPU only. */
+ wqv->wakeup_cpu = smp_processor_id();
+ wqv->saved_affinity = curr->cpu_affinity;
+ if ( vcpu_set_affinity(curr, cpumask_of(wqv->wakeup_cpu)) )
+ {
+ gdprintk(XENLOG_ERR, "Unable to set vcpu affinity\n");
+ domain_crash_synchronous();
+ }
+
asm volatile (
#ifdef CONFIG_X86_64
"push %%rax; push %%rbx; push %%rcx; push %%rdx; push %%rdi; "
@@ -144,6 +156,7 @@ static void __prepare_to_wait(struct wai
static void __finish_wait(struct waitqueue_vcpu *wqv)
{
wqv->esp = NULL;
+ (void)vcpu_set_affinity(current, &wqv->saved_affinity);
}
void check_wakeup_from_wait(void)
@@ -155,6 +168,20 @@ void check_wakeup_from_wait(void)
if ( likely(wqv->esp == NULL) )
return;
+ /* Check if we woke up on the wrong CPU. */
+ if ( unlikely(smp_processor_id() != wqv->wakeup_cpu) )
+ {
+ /* Re-set VCPU affinity and re-enter the scheduler. */
+ struct vcpu *curr = current;
+ wqv->saved_affinity = curr->cpu_affinity;
+ if ( vcpu_set_affinity(curr, cpumask_of(wqv->wakeup_cpu)) )
+ {
+ gdprintk(XENLOG_ERR, "Unable to set vcpu affinity\n");
+ domain_crash_synchronous();
+ }
+ wait(); /* takes us back into the scheduler */
+ }
+
asm volatile (
"mov %1,%%"__OP"sp; rep movsb; jmp *(%%"__OP"sp)"
: : "S" (wqv->stack), "D" (wqv->esp),

View File

@ -0,0 +1,64 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1322153786 -3600
# Node ID 9c6bea25f71233787a36893deaf0e811f2dcb8d8
# Parent 480531cab3f4468b1ec9b549bc84d66e420ce685
x86: small fixes to pcpu platform op handling
XENPF_get_cpuinfo should init the flags output field rather than only
modify it.
XENPF_cpu_online must check for the input CPU number to be in range.
XENPF_cpu_offline must also do that, and should also reject attempts to
offline CPU 0 (this fails in cpu_down() too, but preventing this here
appears more correct given that the code here calls
continue_hypercall_on_cpu(0, ...), which would be flawed if cpu_down()
would ever allow bringing down CPU 0 (and a distinct error code is
easier to deal with when debugging issues).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -449,13 +449,14 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
if ( (g_info->xen_cpuid >= NR_CPUS) ||
!cpu_present(g_info->xen_cpuid) )
{
- g_info->flags |= XEN_PCPU_FLAGS_INVALID;
+ g_info->flags = XEN_PCPU_FLAGS_INVALID;
}
else
{
g_info->apic_id = x86_cpu_to_apicid[g_info->xen_cpuid];
g_info->acpi_id = acpi_get_processor_id(g_info->xen_cpuid);
ASSERT(g_info->apic_id != BAD_APICID);
+ g_info->flags = 0;
if (cpu_online(g_info->xen_cpuid))
g_info->flags |= XEN_PCPU_FLAGS_ONLINE;
}
@@ -472,7 +473,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
{
int cpu = op->u.cpu_ol.cpuid;
- if ( !cpu_present(cpu) )
+ if ( cpu >= NR_CPUS || !cpu_present(cpu) )
{
ret = -EINVAL;
break;
@@ -493,7 +494,13 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
{
int cpu = op->u.cpu_ol.cpuid;
- if ( !cpu_present(cpu) )
+ if ( cpu == 0 )
+ {
+ ret = -EOPNOTSUPP;
+ break;
+ }
+
+ if ( cpu >= NR_CPUS || !cpu_present(cpu) )
{
ret = -EINVAL;
break;

View File

@ -1,8 +1,13 @@
# HG changeset patch
# Parent 401247fe2a24c4923a0106c5d8230fb16de0bb96
changeset: 24208:31fce41fc2b2
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:01:15 2011 +0100
files: tools/xenpaging/file_ops.c tools/xenpaging/policy_default.c tools/xenpaging/xenpaging.c
description:
xenpaging: remove filename from comment
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/file_ops.c | 1 -

View File

@ -1,5 +1,8 @@
# HG changeset patch
# Parent 138406814b338c07af349a477dd7602ecca8be70
changeset: 24209:fe8946916512
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:01:20 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: remove obsolete comment in resume path
Remove stale comment.
@ -7,6 +10,8 @@ If a page was populated several times the vcpu is paused and
xenpaging has to unpause it again.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/xenpaging.c | 1 -

View File

@ -1,14 +1,18 @@
# HG changeset patch
# Parent 5eb76b80baa127278e0fc1574bef22a79d9513f5
changeset: 24210:d1d54cdc4a7b
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:01:32 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: use PERROR to print errno
v3:
- adjust arguments for xc_mem_paging_enable() failures
v2:
- move changes to file_op() to different patch
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/xenpaging.c | 58 ++++++++++++++++++++++----------------------

View File

@ -1,7 +1,11 @@
# HG changeset patch
# Parent 7a4a6935bfa145b24d5183cbf43ce8cc140d9183
changeset: 24211:8ddac056a89e
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:01:39 2011 +0100
files: tools/xenpaging/file_ops.c
description:
xenpaging: simplify file_op
Catch lseek() errors.
Use -1 as return value and let caller read errno.
Remove const casts from buffer pointers, the page is writeable.
Use wrapper for write() which matches the read() prototype.
@ -9,6 +13,8 @@ Remove unused stdarg.h inclusion.
Remove unused macro.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/file_ops.c | 29 +++++++++--------------------

View File

@ -1,8 +1,13 @@
# HG changeset patch
# Parent 9c7e82499e983ad11b13dd41d2fa5f12072adecf
changeset: 24212:fbc31627adde
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:01:41 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: print gfn in failure case
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/xenpaging.c | 18 +++++++++---------

View File

@ -1,11 +1,16 @@
# HG changeset patch
# Parent c6014fd38d1f150dd433985f8388b4858ba5aaca
changeset: 24213:e3cbbad72382
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:02:22 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: update xenpaging_init
Move comment about xc_handle to the right place.
Allocate paging early and use calloc.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/xenpaging.c | 22 +++++++++++-----------

View File

@ -1,11 +1,16 @@
# HG changeset patch
# Parent f665912bc70e0b12e194cf1dd1d37bd22b29c54f
changeset: 24214:f06595abfa88
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:02:36 2011 +0100
files: tools/xenpaging/policy_default.c tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h
description:
xenpaging: remove xc_dominfo_t from paging_t
Remove xc_dominfo_t from paging_t, record only max_pages.
This value is used to setup internal data structures.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/policy_default.c | 8 ++++----

View File

@ -1,10 +1,15 @@
# HG changeset patch
# Parent 8e31f3194c87e1cdb41621caa5a41810ef787293
changeset: 24215:dc7dabe2fe99
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:02:38 2011 +0100
files: tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h
description:
xenpaging: track the number of paged-out pages
This change is required by subsequent changes.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/xenpaging.c | 8 ++++++++

View File

@ -1,3 +1,8 @@
changeset: 24216:4fe585c2a3e5
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:02:39 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: move page add/resume loops into its own function.
Move page resume loop into its own function.
@ -12,6 +17,8 @@ v2:
- check if victims allocation succeeded
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/xenpaging.c | 94 ++++++++++++++++++++++++++++----------------

View File

@ -1,11 +1,16 @@
# HG changeset patch
# Parent f08959fb7528e1724e26365973914ae3e0af78ea
changeset: 24217:b531f5ceddf0
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:02:39 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: improve mainloop exit handling
Remove the if/else logic to exit from the in case a signal arrives.
Update comments.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/xenpaging.c | 16 +++++++++-------

View File

@ -1,8 +1,13 @@
# HG changeset patch
# Parent 2ac53905d95e6d02f53c99f6e2fa38f7306b8800
changeset: 24218:a2b4ae2becdf
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:02:40 2011 +0100
files: tools/libxc/xc_bitops.h
description:
libxc: add bitmap_clear function
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/libxc/xc_bitops.h | 6 ++++++

View File

@ -1,5 +1,8 @@
# HG changeset patch
# Parent 5d87917314c0b4f13c987575d5329dfa215c5698
changeset: 24219:8eba32b9598c
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:02:41 2011 +0100
files: tools/xenpaging/policy_default.c
description:
xenpaging: retry unpageable gfns
Nomination of gfns can fail, but may succeed later.
@ -9,6 +12,8 @@ v2:
- print debug when clearing uncosumed happens
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/policy_default.c | 14 ++++++++++++++

View File

@ -1,11 +1,16 @@
# HG changeset patch
# Parent a30ec96cbaa43bc7abd90b7d974a8033265409c1
changeset: 24220:2087f21befc2
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:02:42 2011 +0100
files: tools/xenpaging/Makefile
description:
xenpaging: install into LIBEXEC dir
In preparation of upcoming libxl integration,
move xenpaging binary from /usr/sbin/ to /usr/lib/xen/bin/
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/Makefile | 4 ++--

View File

@ -1,6 +1,13 @@
changeset: 24221:cd5948592b10
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:02:43 2011 +0100
files: Config.mk config/StdGNU.mk tools/libxl/libxl.h tools/libxl/libxl_paths.c tools/xenpaging/Makefile
description:
xenpaging: add XEN_PAGING_DIR / libxl_xenpaging_dir_path()
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
Config.mk | 1 +

View File

@ -1,5 +1,8 @@
# HG changeset patch
# Parent f057eb06706e2bacaadb41cf80fa45001e786e69
changeset: 24222:286a741b4d86
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:02:45 2011 +0100
files: tools/xenpaging/policy_default.c tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h
description:
xenpaging: use guests tot_pages as working target
This change reverses the task of xenpaging. Before this change a fixed number
@ -7,6 +10,8 @@ of pages was paged out. With this change the guest will not have access to
more than the given number of pages at the same time.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/policy_default.c | 1

View File

@ -1,5 +1,8 @@
# HG changeset patch
# Parent 0d872bf1203dd36200477f688908797875035b50
changeset: 24223:9e3c2ef70c8a
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:02:47 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: watch the guests memory/target-tot_pages xenstore value
Subsequent patches will use xenstored to store the numbers of pages
@ -7,6 +10,8 @@ xenpaging is suppose to page-out.
Remove num_pages and use target_pages instead.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/xenpaging.c | 51 +++++++++++++++++++++++++++++++++++++++++++-

View File

@ -1,5 +1,8 @@
# HG changeset patch
# Parent 434f0b4da9148b101e184e0108be6c31f67038f4
changeset: 24224:7243fd87410e
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:02:48 2011 +0100
files: tools/xenpaging/xenpaging.c tools/xenpaging/xenpaging.h
description:
xenpaging: add cmdline interface for pager
Introduce a cmdline handling for the pager. This simplifies libxl support,
@ -17,6 +20,8 @@ options:
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/xenpaging.c | 139 ++++++++++++++++++++++++++++++++------------

View File

@ -1,5 +1,8 @@
# HG changeset patch
# Parent 79677f532a2406ca501250b50fa8b33965a8d7d7
changeset: 24225:d47d1ad56366
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 17:02:50 2011 +0100
files: tools/xenpaging/policy.h tools/xenpaging/policy_default.c tools/xenpaging/xenpaging.c
description:
xenpaging: improve policy mru list handling
Without this change it is not possible to page-out all guest pages, then
@ -17,6 +20,8 @@ is no need to adjust the mru list because dropping a page is not usage
of a page.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/policy.h | 2 ++
@ -95,7 +100,7 @@ Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -616,7 +616,14 @@ static int xenpaging_resume_page(xenpagi
@@ -615,7 +615,14 @@ static int xenpaging_resume_page(xenpagi
/* Notify policy of page being paged in */
if ( notify_policy )
{
@ -111,7 +116,7 @@ Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
/* Record number of resumed pages */
paging->num_paged_out--;
@@ -870,7 +877,7 @@ int main(int argc, char *argv[])
@@ -869,7 +876,7 @@ int main(int argc, char *argv[])
{
DPRINTF("drop_page ^ gfn %"PRIx64" pageslot %d\n", req.gfn, i);
/* Notify policy of page being dropped */

View File

@ -1,8 +1,13 @@
# HG changeset patch
# Parent 5b764d6fc1e8165d9012cc8866ba08332fb13021
changeset: 24226:c9b75ccd3ebf
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 18:26:15 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: add debug to show received watch event.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/xenpaging.c | 1 +

View File

@ -0,0 +1,28 @@
changeset: 24227:1027e7d13d02
user: Olaf Hering <olaf@aepfle.de>
date: Sun Nov 20 18:26:16 2011 +0100
files: tools/xenpaging/xenpaging.c
description:
xenpaging: restrict pagefile permissions
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
tools/xenpaging/xenpaging.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -795,7 +795,7 @@ int main(int argc, char *argv[])
xc_interface *xch;
int open_flags = O_CREAT | O_TRUNC | O_RDWR;
- mode_t open_mode = S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH;
+ mode_t open_mode = S_IRUSR | S_IWUSR;
int fd;
/* Initialise domain paging */

View File

@ -0,0 +1,69 @@
changeset: 24231:2a81ce2b2b93
user: Keir Fraser <keir@xen.org>
date: Fri Nov 25 20:27:11 2011 +0000
files: xen/common/wait.c xen/include/xen/wait.h
description:
waitqueue: Implement wake_up_{nr,one,all}.
Signed-off-by: Keir Fraser <keir@xen.org>
---
xen/common/wait.c | 14 ++++++++++++--
xen/include/xen/wait.h | 6 ++++--
2 files changed, 16 insertions(+), 4 deletions(-)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -87,13 +87,13 @@ void init_waitqueue_head(struct waitqueu
INIT_LIST_HEAD(&wq->list);
}
-void wake_up(struct waitqueue_head *wq)
+void wake_up_nr(struct waitqueue_head *wq, unsigned int nr)
{
struct waitqueue_vcpu *wqv;
spin_lock(&wq->lock);
- while ( !list_empty(&wq->list) )
+ while ( !list_empty(&wq->list) && nr-- )
{
wqv = list_entry(wq->list.next, struct waitqueue_vcpu, list);
list_del_init(&wqv->list);
@@ -103,6 +103,16 @@ void wake_up(struct waitqueue_head *wq)
spin_unlock(&wq->lock);
}
+void wake_up_one(struct waitqueue_head *wq)
+{
+ wake_up_nr(wq, 1);
+}
+
+void wake_up_all(struct waitqueue_head *wq)
+{
+ wake_up_nr(wq, UINT_MAX);
+}
+
#ifdef CONFIG_X86
static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
Index: xen-4.1.2-testing/xen/include/xen/wait.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/wait.h
+++ xen-4.1.2-testing/xen/include/xen/wait.h
@@ -28,8 +28,10 @@ struct waitqueue_head {
/* Dynamically initialise a waitqueue. */
void init_waitqueue_head(struct waitqueue_head *wq);
-/* Wake all VCPUs waiting on specified waitqueue. */
-void wake_up(struct waitqueue_head *wq);
+/* Wake VCPU(s) waiting on specified waitqueue. */
+void wake_up_nr(struct waitqueue_head *wq, unsigned int nr);
+void wake_up_one(struct waitqueue_head *wq);
+void wake_up_all(struct waitqueue_head *wq);
/* Wait on specified waitqueue until @condition is true. */
#define wait_event(wq, condition) \

View File

@ -0,0 +1,72 @@
changeset: 24232:95d4e2e0bed3
user: Keir Fraser <keir@xen.org>
date: Fri Nov 25 20:32:05 2011 +0000
files: xen/common/wait.c xen/include/xen/wait.h
description:
waitqueue: Hold a reference to a domain on a waitqueue.
Also allow waitqueues to be dynamically destroyed.
Signed-off-by: Keir Fraser <keir@xen.org>
---
xen/common/wait.c | 8 ++++++++
xen/include/xen/wait.h | 3 ++-
2 files changed, 10 insertions(+), 1 deletion(-)
Index: xen-4.1.2-testing/xen/common/wait.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/wait.c
+++ xen-4.1.2-testing/xen/common/wait.c
@@ -87,6 +87,11 @@ void init_waitqueue_head(struct waitqueu
INIT_LIST_HEAD(&wq->list);
}
+void destroy_waitqueue_head(struct waitqueue_head *wq)
+{
+ wake_up_all(wq);
+}
+
void wake_up_nr(struct waitqueue_head *wq, unsigned int nr)
{
struct waitqueue_vcpu *wqv;
@@ -98,6 +103,7 @@ void wake_up_nr(struct waitqueue_head *w
wqv = list_entry(wq->list.next, struct waitqueue_vcpu, list);
list_del_init(&wqv->list);
vcpu_unpause(wqv->vcpu);
+ put_domain(wqv->vcpu->domain);
}
spin_unlock(&wq->lock);
@@ -218,6 +224,7 @@ void prepare_to_wait(struct waitqueue_he
spin_lock(&wq->lock);
list_add_tail(&wqv->list, &wq->list);
vcpu_pause_nosync(curr);
+ get_knownalive_domain(curr->domain);
spin_unlock(&wq->lock);
}
@@ -236,6 +243,7 @@ void finish_wait(struct waitqueue_head *
{
list_del_init(&wqv->list);
vcpu_unpause(curr);
+ put_domain(curr->domain);
}
spin_unlock(&wq->lock);
}
Index: xen-4.1.2-testing/xen/include/xen/wait.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/wait.h
+++ xen-4.1.2-testing/xen/include/xen/wait.h
@@ -25,8 +25,9 @@ struct waitqueue_head {
.list = LIST_HEAD_INIT((name).list) \
}
-/* Dynamically initialise a waitqueue. */
+/* Dynamically initialise/destroy a waitqueue. */
void init_waitqueue_head(struct waitqueue_head *wq);
+void destroy_waitqueue_head(struct waitqueue_head *wq);
/* Wake VCPU(s) waiting on specified waitqueue. */
void wake_up_nr(struct waitqueue_head *wq, unsigned int nr);

View File

@ -0,0 +1,23 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1322645021 -3600
# Node ID 64088ba60263d3a623851b43a872c93c71cc3cbf
# Parent df7cec2c6c03f07932555954948ce7c8d09e88f4
x86/cpuidle: add Westmere-EX support to hw residencies reading logic
This is in accordance with
http://software.intel.com/en-us/articles/intel-processor-identification-with-cpuid-model-and-family-numbers/
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Haitao Shan <maillists.shan@gmail.com>
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -113,6 +113,7 @@ static void do_get_hw_residencies(void *
/* Westmere */
case 0x25:
case 0x2C:
+ case 0x2F:
GET_PC3_RES(hw_res->pc3);
GET_PC6_RES(hw_res->pc6);
GET_PC7_RES(hw_res->pc7);

View File

@ -0,0 +1,240 @@
changeset: 24269:2cbc53a24683
user: Olaf Hering <olaf@aepfle.de>
date: Wed Nov 30 07:08:53 2011 -0800
files: xen/arch/x86/hvm/hvm.c xen/arch/x86/mm/mem_event.c xen/arch/x86/mm/mem_sharing.c xen/arch/x86/mm/p2m.c xen/common/domain.c xen/include/xen/sched.h
description:
mem_event: move mem_event_domain out of struct domain
An upcoming change may increase the size of mem_event_domain. The result
is a build failure because struct domain gets larger than a page.
Allocate the room for the three mem_event_domain members at runtime.
v2:
- remove mem_ prefix from members of new struct
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Keir Fraser <keir@xen.org>
---
xen/arch/x86/hvm/hvm.c | 4 ++--
xen/arch/x86/mm/mem_event.c | 6 +++---
xen/arch/x86/mm/mem_sharing.c | 6 +++---
xen/arch/x86/mm/p2m.c | 18 +++++++++---------
xen/common/domain.c | 5 +++++
xen/include/xen/sched.h | 18 ++++++++++++------
6 files changed, 34 insertions(+), 23 deletions(-)
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3909,7 +3909,7 @@ static int hvm_memory_event_traps(long p
if ( (p & HVMPME_onchangeonly) && (value == old) )
return 1;
- rc = mem_event_check_ring(d, &d->mem_access);
+ rc = mem_event_check_ring(d, &d->mem_event->access);
if ( rc )
return rc;
@@ -3932,7 +3932,7 @@ static int hvm_memory_event_traps(long p
req.gla_valid = 1;
}
- mem_event_put_request(d, &d->mem_access, &req);
+ mem_event_put_request(d, &d->mem_event->access, &req);
return 1;
}
--- a/xen/arch/x86/mm/mem_event.c
+++ b/xen/arch/x86/mm/mem_event.c
@@ -252,7 +252,7 @@ int mem_event_domctl(struct domain *d, x
{
case XEN_DOMCTL_MEM_EVENT_OP_PAGING:
{
- struct mem_event_domain *med = &d->mem_paging;
+ struct mem_event_domain *med = &d->mem_event->paging;
rc = -EINVAL;
switch( mec->op )
@@ -297,7 +297,7 @@ int mem_event_domctl(struct domain *d, x
case XEN_DOMCTL_MEM_EVENT_OP_ACCESS:
{
- struct mem_event_domain *med = &d->mem_access;
+ struct mem_event_domain *med = &d->mem_event->access;
rc = -EINVAL;
switch( mec->op )
@@ -320,7 +320,7 @@ int mem_event_domctl(struct domain *d, x
case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE:
{
if ( med->ring_page )
- rc = mem_event_disable(&d->mem_access);
+ rc = mem_event_disable(med);
}
break;
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -322,12 +322,12 @@ static struct page_info* mem_sharing_all
req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
}
- if(mem_event_check_ring(d, &d->mem_share)) return page;
+ if(mem_event_check_ring(d, &d->mem_event->share)) return page;
req.gfn = gfn;
req.p2mt = p2m_ram_shared;
req.vcpu_id = v->vcpu_id;
- mem_event_put_request(d, &d->mem_share, &req);
+ mem_event_put_request(d, &d->mem_event->share, &req);
return page;
}
@@ -342,7 +342,7 @@ int mem_sharing_sharing_resume(struct do
mem_event_response_t rsp;
/* Get request off the ring */
- mem_event_get_response(&d->mem_share, &rsp);
+ mem_event_get_response(&d->mem_event->share, &rsp);
/* Unpause domain/vcpu */
if( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -2996,7 +2996,7 @@ void p2m_mem_paging_drop_page(struct p2m
struct domain *d = p2m->domain;
/* Check that there's space on the ring for this request */
- if ( mem_event_check_ring(d, &d->mem_paging) == 0)
+ if ( mem_event_check_ring(d, &d->mem_event->paging) == 0)
{
/* Send release notification to pager */
memset(&req, 0, sizeof(req));
@@ -3004,7 +3004,7 @@ void p2m_mem_paging_drop_page(struct p2m
req.gfn = gfn;
req.vcpu_id = v->vcpu_id;
- mem_event_put_request(d, &d->mem_paging, &req);
+ mem_event_put_request(d, &d->mem_event->paging, &req);
}
}
@@ -3039,7 +3039,7 @@ void p2m_mem_paging_populate(struct p2m_
struct domain *d = p2m->domain;
/* Check that there's space on the ring for this request */
- if ( mem_event_check_ring(d, &d->mem_paging) )
+ if ( mem_event_check_ring(d, &d->mem_event->paging) )
return;
memset(&req, 0, sizeof(req));
@@ -3070,7 +3070,7 @@ void p2m_mem_paging_populate(struct p2m_
else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
{
/* gfn is already on its way back and vcpu is not paused */
- mem_event_put_req_producers(&d->mem_paging);
+ mem_event_put_req_producers(&d->mem_event->paging);
return;
}
@@ -3079,7 +3079,7 @@ void p2m_mem_paging_populate(struct p2m_
req.p2mt = p2mt;
req.vcpu_id = v->vcpu_id;
- mem_event_put_request(d, &d->mem_paging, &req);
+ mem_event_put_request(d, &d->mem_event->paging, &req);
}
/**
@@ -3157,7 +3157,7 @@ void p2m_mem_paging_resume(struct p2m_do
mfn_t mfn;
/* Pull the response off the ring */
- mem_event_get_response(&d->mem_paging, &rsp);
+ mem_event_get_response(&d->mem_event->paging, &rsp);
/* Fix p2m entry if the page was not dropped */
if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
@@ -3210,7 +3210,7 @@ void p2m_mem_access_check(unsigned long
p2m_unlock(p2m);
/* Otherwise, check if there is a memory event listener, and send the message along */
- res = mem_event_check_ring(d, &d->mem_access);
+ res = mem_event_check_ring(d, &d->mem_event->access);
if ( res < 0 )
{
/* No listener */
@@ -3254,7 +3254,7 @@ void p2m_mem_access_check(unsigned long
req.vcpu_id = v->vcpu_id;
- mem_event_put_request(d, &d->mem_access, &req);
+ mem_event_put_request(d, &d->mem_event->access, &req);
/* VCPU paused, mem event request sent */
}
@@ -3264,7 +3264,7 @@ void p2m_mem_access_resume(struct p2m_do
struct domain *d = p2m->domain;
mem_event_response_t rsp;
- mem_event_get_response(&d->mem_access, &rsp);
+ mem_event_get_response(&d->mem_event->access, &rsp);
/* Unpause domain */
if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -298,6 +298,10 @@ struct domain *domain_create(
init_status |= INIT_gnttab;
poolid = 0;
+
+ d->mem_event = xzalloc(struct mem_event_per_domain);
+ if ( !d->mem_event )
+ goto fail;
}
if ( arch_domain_create(d, domcr_flags) != 0 )
@@ -329,6 +333,7 @@ struct domain *domain_create(
fail:
d->is_dying = DOMDYING_dead;
atomic_set(&d->refcnt, DOMAIN_DESTROYED);
+ xfree(d->mem_event);
if ( init_status & INIT_arch )
arch_domain_destroy(d);
if ( init_status & INIT_gnttab )
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -201,6 +201,16 @@ struct mem_event_domain
int xen_port;
};
+struct mem_event_per_domain
+{
+ /* Memory sharing support */
+ struct mem_event_domain share;
+ /* Memory paging support */
+ struct mem_event_domain paging;
+ /* Memory access support */
+ struct mem_event_domain access;
+};
+
struct domain
{
domid_t domain_id;
@@ -327,12 +337,8 @@ struct domain
/* Non-migratable and non-restoreable? */
bool_t disable_migrate;
- /* Memory sharing support */
- struct mem_event_domain mem_share;
- /* Memory paging support */
- struct mem_event_domain mem_paging;
- /* Memory access support */
- struct mem_event_domain mem_access;
+ /* Various mem_events */
+ struct mem_event_per_domain *mem_event;
/* Currently computed from union of all vcpu cpu-affinity masks. */
nodemask_t node_affinity;

View File

@ -0,0 +1,27 @@
changeset: 24270:08716a7f1b74
user: Keir Fraser <keir@xen.org>
date: Wed Nov 30 07:12:41 2011 -0800
files: xen/common/domain.c
description:
Free d->mem_event on domain destruction.
Signed-off-by: Keir Fraser <keir@xen.org>
---
xen/common/domain.c | 2 ++
1 file changed, 2 insertions(+)
Index: xen-4.1.2-testing/xen/common/domain.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/domain.c
+++ xen-4.1.2-testing/xen/common/domain.c
@@ -661,6 +661,8 @@ static void complete_domain_destroy(stru
/* Free page used by xen oprofile buffer. */
free_xenoprof_pages(d);
+ xfree(d->mem_event);
+
for ( i = d->max_vcpus - 1; i >= 0; i-- )
if ( (v = d->vcpu[i]) != NULL )
free_vcpu_struct(v);

View File

@ -0,0 +1,50 @@
changeset: 24272:62ff6a318c5d
user: Keir Fraser <keir@xen.org>
date: Wed Nov 30 16:59:58 2011 -0800
files: xen/common/page_alloc.c
description:
xenpaging: Fix c/s 23507:0a29c8c3ddf7 ("update machine_to_phys_mapping[] during page deallocation")
This patch clobbers page owner in free_heap_pages() before we are
finished using it. This means that a subsequent test to determine
whether it is safe to avoid safety TLB flushes incorrectly always
determines that it is safe to do so.
The fix is simple: we can defer the original patch's work until after
we are done with the page-owner field.
Thanks to Christian Limpach for spotting this one.
Signed-off-by: Keir Fraser <keir@xen.org>
---
xen/common/page_alloc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: xen-4.1.2-testing/xen/common/page_alloc.c
===================================================================
--- xen-4.1.2-testing.orig/xen/common/page_alloc.c
+++ xen-4.1.2-testing/xen/common/page_alloc.c
@@ -540,10 +540,6 @@ static void free_heap_pages(
for ( i = 0; i < (1 << order); i++ )
{
- /* This page is not a guest frame any more. */
- page_set_owner(&pg[i], NULL); /* set_gpfn_from_mfn snoops pg owner */
- set_gpfn_from_mfn(mfn + i, INVALID_M2P_ENTRY);
-
/*
* Cannot assume that count_info == 0, as there are some corner cases
* where it isn't the case and yet it isn't a bug:
@@ -567,6 +563,10 @@ static void free_heap_pages(
pg[i].u.free.need_tlbflush = (page_get_owner(&pg[i]) != NULL);
if ( pg[i].u.free.need_tlbflush )
pg[i].tlbflush_timestamp = tlbflush_current_time();
+
+ /* This page is not a guest frame any more. */
+ page_set_owner(&pg[i], NULL); /* set_gpfn_from_mfn snoops pg owner */
+ set_gpfn_from_mfn(mfn + i, INVALID_M2P_ENTRY);
}
avail[node][zone] += 1 << order;

View File

@ -0,0 +1,88 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1322725849 -3600
# Node ID 76ea126f21724b72c120aff59460f7bbe9e6960d
# Parent 07cf778d517fdf661a34027af653a489489bf222
x86/emulator: properly handle lzcnt and tzcnt
These instructions are prefix selected flavors of bsf and bsr
respectively, and hence the presences of the F3 prefix must be handled
in the emulation code in order to avoid running into problems on newer
CPUs.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -990,6 +990,9 @@ static bool_t vcpu_has(
return rc == X86EMUL_OKAY;
}
+#define vcpu_has_lzcnt() vcpu_has(0x80000001, ECX, 5, ctxt, ops)
+#define vcpu_has_bmi1() vcpu_has(0x00000007, EBX, 3, ctxt, ops)
+
#define vcpu_must_have(leaf, reg, bit) \
generate_exception_if(!vcpu_has(leaf, reg, bit, ctxt, ops), EXC_UD, -1)
#define vcpu_must_have_sse2() vcpu_must_have(0x00000001, EDX, 26)
@@ -4114,13 +4117,24 @@ x86_emulate(
dst.val = (uint8_t)src.val;
break;
- case 0xbc: /* bsf */ {
- int zf;
+ case 0xbc: /* bsf or tzcnt */ {
+ bool_t zf;
asm ( "bsf %2,%0; setz %b1"
: "=r" (dst.val), "=q" (zf)
- : "r" (src.val), "1" (0) );
+ : "r" (src.val) );
_regs.eflags &= ~EFLG_ZF;
- if ( zf )
+ if ( (rep_prefix == REPE_PREFIX) && vcpu_has_bmi1() )
+ {
+ _regs.eflags &= ~EFLG_CF;
+ if ( zf )
+ {
+ _regs.eflags |= EFLG_CF;
+ dst.val = op_bytes * 8;
+ }
+ else if ( !dst.val )
+ _regs.eflags |= EFLG_ZF;
+ }
+ else if ( zf )
{
_regs.eflags |= EFLG_ZF;
dst.type = OP_NONE;
@@ -4128,13 +4142,28 @@ x86_emulate(
break;
}
- case 0xbd: /* bsr */ {
- int zf;
+ case 0xbd: /* bsr or lzcnt */ {
+ bool_t zf;
asm ( "bsr %2,%0; setz %b1"
: "=r" (dst.val), "=q" (zf)
- : "r" (src.val), "1" (0) );
+ : "r" (src.val) );
_regs.eflags &= ~EFLG_ZF;
- if ( zf )
+ if ( (rep_prefix == REPE_PREFIX) && vcpu_has_lzcnt() )
+ {
+ _regs.eflags &= ~EFLG_CF;
+ if ( zf )
+ {
+ _regs.eflags |= EFLG_CF;
+ dst.val = op_bytes * 8;
+ }
+ else
+ {
+ dst.val = op_bytes * 8 - 1 - dst.val;
+ if ( !dst.val )
+ _regs.eflags |= EFLG_ZF;
+ }
+ }
+ else if ( zf )
{
_regs.eflags |= EFLG_ZF;
dst.type = OP_NONE;

View File

@ -0,0 +1,58 @@
# HG changeset patch
# User Liu, Jinsong <jinsong.liu@intel.com>
# Date 1322738484 -3600
# Node ID 1f6b58c8e1ba8d27dfb97f0da96d18d3ad163317
# Parent 89f7273681696022cc44db4f2ec5b22560482869
X86: expose Intel new features to dom0
This patch expose Intel new features to dom0, including
FMA/AVX2/BMI1/BMI2/LZCNT/MOVBE.
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -848,8 +848,11 @@ static void pv_cpuid(struct cpu_user_reg
break;
case 7:
if ( regs->ecx == 0 )
- b &= (cpufeat_mask(X86_FEATURE_FSGSBASE) |
- cpufeat_mask(X86_FEATURE_ERMS));
+ b &= (cpufeat_mask(X86_FEATURE_BMI1) |
+ cpufeat_mask(X86_FEATURE_AVX2) |
+ cpufeat_mask(X86_FEATURE_BMI2) |
+ cpufeat_mask(X86_FEATURE_ERMS) |
+ cpufeat_mask(X86_FEATURE_FSGSBASE));
else
b = 0;
a = c = d = 0;
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -93,6 +93,7 @@
#define X86_FEATURE_TM2 (4*32+ 8) /* Thermal Monitor 2 */
#define X86_FEATURE_SSSE3 (4*32+ 9) /* Supplemental Streaming SIMD Extensions-3 */
#define X86_FEATURE_CID (4*32+10) /* Context ID */
+#define X86_FEATURE_FMA (4*32+12) /* Fused Multiply Add */
#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */
#define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */
#define X86_FEATURE_PDCM (4*32+15) /* Perf/Debug Capability MSR */
@@ -100,6 +101,7 @@
#define X86_FEATURE_SSE4_1 (4*32+19) /* Streaming SIMD Extensions 4.1 */
#define X86_FEATURE_SSE4_2 (4*32+20) /* Streaming SIMD Extensions 4.2 */
#define X86_FEATURE_X2APIC (4*32+21) /* Extended xAPIC */
+#define X86_FEATURE_MOVBE (4*32+22) /* movbe instruction */
#define X86_FEATURE_POPCNT (4*32+23) /* POPCNT instruction */
#define X86_FEATURE_TSC_DEADLINE (4*32+24) /* "tdt" TSC Deadline Timer */
#define X86_FEATURE_XSAVE (4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */
@@ -144,7 +146,10 @@
/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 7 */
#define X86_FEATURE_FSGSBASE (7*32+ 0) /* {RD,WR}{FS,GS}BASE instructions */
+#define X86_FEATURE_BMI1 (7*32+ 3) /* 1st bit manipulation extensions */
+#define X86_FEATURE_AVX2 (7*32+ 5) /* AVX2 instructions */
#define X86_FEATURE_SMEP (7*32+ 7) /* Supervisor Mode Execution Protection */
+#define X86_FEATURE_BMI2 (7*32+ 8) /* 2nd bit manipulation extensions */
#define X86_FEATURE_ERMS (7*32+ 9) /* Enhanced REP MOVSB/STOSB */
#define cpu_has(c, bit) test_bit(bit, (c)->x86_capability)

View File

@ -0,0 +1,49 @@
# HG changeset patch
# User Liu, Jinsong <jinsong.liu@intel.com>
# Date 1322738563 -3600
# Node ID d9cb04ed55398ea4043c85573460afaf023aa1e9
# Parent 1f6b58c8e1ba8d27dfb97f0da96d18d3ad163317
X86: Disable PCID/INVPCID for dom0
PCID (Process-context identifier) is a facility by which a logical
processor may cache information for multiple linear-address spaces.
INVPCID is an new instruction to invalidate TLB. Refer latest Intel SDM
http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html
We disable PCID/INVPCID for dom0 and pv. Exposing them into dom0 and pv
may result in performance regression, and it would trigger GP or UD
depending on whether platform suppport INVPCID or not.
This patch disables PCID/INVPCID for dom0.
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -836,6 +836,7 @@ static void pv_cpuid(struct cpu_user_reg
__clear_bit(X86_FEATURE_CX16 % 32, &c);
__clear_bit(X86_FEATURE_XTPR % 32, &c);
__clear_bit(X86_FEATURE_PDCM % 32, &c);
+ __clear_bit(X86_FEATURE_PCID % 32, &c);
__clear_bit(X86_FEATURE_DCA % 32, &c);
if ( !xsave_enabled(current) )
{
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -97,6 +97,7 @@
#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */
#define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */
#define X86_FEATURE_PDCM (4*32+15) /* Perf/Debug Capability MSR */
+#define X86_FEATURE_PCID (4*32+17) /* Process Context ID */
#define X86_FEATURE_DCA (4*32+18) /* Direct Cache Access */
#define X86_FEATURE_SSE4_1 (4*32+19) /* Streaming SIMD Extensions 4.1 */
#define X86_FEATURE_SSE4_2 (4*32+20) /* Streaming SIMD Extensions 4.2 */
@@ -151,6 +152,7 @@
#define X86_FEATURE_SMEP (7*32+ 7) /* Supervisor Mode Execution Protection */
#define X86_FEATURE_BMI2 (7*32+ 8) /* 2nd bit manipulation extensions */
#define X86_FEATURE_ERMS (7*32+ 9) /* Enhanced REP MOVSB/STOSB */
+#define X86_FEATURE_INVPCID (7*32+10) /* Invalidate Process Context ID */
#define cpu_has(c, bit) test_bit(bit, (c)->x86_capability)
#define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability)

View File

@ -0,0 +1,38 @@
# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1322749036 0
# Node ID a06cda9fb25f2d7b7b5c7da170813e4a8bb0cd67
# Parent 75f4e4d9f039ea656051e6dfd73e40d4cb32896b
x86/mm: Don't lose track of the log dirty bitmap
hap_log_dirty_init unconditionally sets the top of the log dirty
bitmap to INVALID_MFN. If there had been a bitmap allocated, it is
then leaked, and the host crashes on an ASSERT when the domain is
cleaned up.
Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Tim Deegan <tim@xen.org>
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -665,7 +665,6 @@ void paging_log_dirty_init(struct domain
d->arch.paging.log_dirty.enable_log_dirty = enable_log_dirty;
d->arch.paging.log_dirty.disable_log_dirty = disable_log_dirty;
d->arch.paging.log_dirty.clean_dirty_bitmap = clean_dirty_bitmap;
- d->arch.paging.log_dirty.top = _mfn(INVALID_MFN);
}
/* This function fress log dirty bitmap resources. */
@@ -686,6 +685,11 @@ int paging_domain_init(struct domain *d,
if ( (rc = p2m_init(d)) != 0 )
return rc;
+ /* This must be initialized separately from the rest of the
+ * log-dirty init code as that can be called more than once and we
+ * don't want to leak any active log-dirty bitmaps */
+ d->arch.paging.log_dirty.top = _mfn(INVALID_MFN);
+
/* The order of the *_init calls below is important, as the later
* ones may rewrite some common fields. Shadow pagetables are the
* default... */

View File

@ -0,0 +1,105 @@
changeset: 24318:f25a004a6de8
user: Andres Lagar-Cavilla <andres@lagarcavilla.org>
date: Thu Dec 01 17:21:24 2011 +0000
files: xen/arch/x86/mm.c
description:
x86/mm: Fix checks during foreign mapping of paged pages
Check that the valid mfn is the one we are mapping, not the
mfn of the page table of the foreign domain.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---
xen/arch/x86/mm.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/mm.c
@@ -3492,8 +3492,9 @@ int do_mmu_update(
{
l1_pgentry_t l1e = l1e_from_intpte(req.val);
p2m_type_t l1e_p2mt;
+ unsigned long l1emfn = mfn_x(
gfn_to_mfn(p2m_get_hostp2m(pg_owner),
- l1e_get_pfn(l1e), &l1e_p2mt);
+ l1e_get_pfn(l1e), &l1e_p2mt));
if ( p2m_is_paged(l1e_p2mt) )
{
@@ -3502,7 +3503,8 @@ int do_mmu_update(
rc = -ENOENT;
break;
}
- else if ( p2m_ram_paging_in_start == l1e_p2mt && !mfn_valid(mfn) )
+ else if ( p2m_ram_paging_in_start == l1e_p2mt &&
+ !mfn_valid(l1emfn) )
{
rc = -ENOENT;
break;
@@ -3534,7 +3536,8 @@ int do_mmu_update(
{
l2_pgentry_t l2e = l2e_from_intpte(req.val);
p2m_type_t l2e_p2mt;
- gfn_to_mfn(p2m_get_hostp2m(pg_owner), l2e_get_pfn(l2e), &l2e_p2mt);
+ unsigned long l2emfn = mfn_x(
+ gfn_to_mfn(p2m_get_hostp2m(pg_owner), l2e_get_pfn(l2e), &l2e_p2mt));
if ( p2m_is_paged(l2e_p2mt) )
{
@@ -3543,7 +3546,8 @@ int do_mmu_update(
rc = -ENOENT;
break;
}
- else if ( p2m_ram_paging_in_start == l2e_p2mt && !mfn_valid(mfn) )
+ else if ( p2m_ram_paging_in_start == l2e_p2mt &&
+ !mfn_valid(l2emfn) )
{
rc = -ENOENT;
break;
@@ -3563,7 +3567,8 @@ int do_mmu_update(
{
l3_pgentry_t l3e = l3e_from_intpte(req.val);
p2m_type_t l3e_p2mt;
- gfn_to_mfn(p2m_get_hostp2m(pg_owner), l3e_get_pfn(l3e), &l3e_p2mt);
+ unsigned long l3emfn = mfn_x(
+ gfn_to_mfn(p2m_get_hostp2m(pg_owner), l3e_get_pfn(l3e), &l3e_p2mt));
if ( p2m_is_paged(l3e_p2mt) )
{
@@ -3572,7 +3577,8 @@ int do_mmu_update(
rc = -ENOENT;
break;
}
- else if ( p2m_ram_paging_in_start == l3e_p2mt && !mfn_valid(mfn) )
+ else if ( p2m_ram_paging_in_start == l3e_p2mt &&
+ !mfn_valid(l3emfn) )
{
rc = -ENOENT;
break;
@@ -3592,8 +3598,9 @@ int do_mmu_update(
{
l4_pgentry_t l4e = l4e_from_intpte(req.val);
p2m_type_t l4e_p2mt;
+ unsigned long l4emfn = mfn_x(
gfn_to_mfn(p2m_get_hostp2m(pg_owner),
- l4e_get_pfn(l4e), &l4e_p2mt);
+ l4e_get_pfn(l4e), &l4e_p2mt));
if ( p2m_is_paged(l4e_p2mt) )
{
@@ -3602,7 +3609,8 @@ int do_mmu_update(
rc = -ENOENT;
break;
}
- else if ( p2m_ram_paging_in_start == l4e_p2mt && !mfn_valid(mfn) )
+ else if ( p2m_ram_paging_in_start == l4e_p2mt &&
+ !mfn_valid(l4emfn) )
{
rc = -ENOENT;
break;

View File

@ -0,0 +1,139 @@
changeset: 24327:8529bca7a3f0
parent: 24322:6bac46816504
user: Andres Lagar-Cavilla <andres@lagarcavilla.org>
date: Thu Dec 01 18:14:24 2011 +0000
files: xen/arch/x86/mm/mem_event.c xen/arch/x86/mm/mem_paging.c xen/arch/x86/mm/p2m.c xen/include/asm-x86/p2m.h xen/include/public/domctl.h
description:
After preparing a page for page-in, allow immediate fill-in of the page contents
p2m_mem_paging_prep ensures that an mfn is backing the paged-out gfn, and
transitions to the next state in the paging state machine for that page.
Foreign mappings of the gfn will now succeed. This is the key idea, as
it allows the pager to now map the gfn and fill in its contents.
Unfortunately, it also allows any other foreign mapper to map the gfn and read
its contents. This is particularly dangerous when the populate is launched
by a foreign mapper in the first place, which will be actively retrying the
map operation and might race with the pager. Qemu-dm being a prime example.
Fix the race by allowing a buffer to be optionally passed in the prep
operation, and having the hypervisor memcpy from that buffer into the newly
prepped page before promoting the gfn type.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---
xen/arch/x86/mm/mem_event.c | 2 +-
xen/arch/x86/mm/mem_paging.c | 2 +-
xen/arch/x86/mm/p2m.c | 32 ++++++++++++++++++++++++++++++--
xen/include/asm-x86/p2m.h | 2 +-
xen/include/public/domctl.h | 8 ++++++--
5 files changed, 39 insertions(+), 7 deletions(-)
--- a/xen/arch/x86/mm/mem_event.c
+++ b/xen/arch/x86/mm/mem_event.c
@@ -45,7 +45,7 @@ static int mem_event_enable(struct domai
struct domain *dom_mem_event = current->domain;
struct vcpu *v = current;
unsigned long ring_addr = mec->ring_addr;
- unsigned long shared_addr = mec->shared_addr;
+ unsigned long shared_addr = mec->u.shared_addr;
l1_pgentry_t l1e;
unsigned long gfn;
p2m_type_t p2mt;
--- a/xen/arch/x86/mm/mem_paging.c
+++ b/xen/arch/x86/mm/mem_paging.c
@@ -50,7 +50,7 @@ int mem_paging_domctl(struct domain *d,
case XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP:
{
unsigned long gfn = mec->gfn;
- rc = p2m_mem_paging_prep(p2m, gfn);
+ rc = p2m_mem_paging_prep(p2m, gfn, mec->u.buffer);
}
break;
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -3093,13 +3093,20 @@ void p2m_mem_paging_populate(struct p2m_
* mfn if populate was called for gfn which was nominated but not evicted. In
* this case only the p2mt needs to be forwarded.
*/
-int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn)
+int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn, uint64_t buffer)
{
struct page_info *page;
p2m_type_t p2mt;
p2m_access_t a;
mfn_t mfn;
- int ret;
+ int ret, page_extant = 1;
+ const void *user_ptr = (const void *) buffer;
+
+ if ( user_ptr )
+ /* Sanity check the buffer and bail out early if trouble */
+ if ( (buffer & (PAGE_SIZE - 1)) ||
+ (!access_ok(user_ptr, PAGE_SIZE)) )
+ return -EINVAL;
p2m_lock(p2m);
@@ -3119,6 +3126,28 @@ int p2m_mem_paging_prep(struct p2m_domai
if ( unlikely(page == NULL) )
goto out;
mfn = page_to_mfn(page);
+ page_extant = 0;
+ }
+
+ /* If we were given a buffer, now is the time to use it */
+ if ( !page_extant && user_ptr )
+ {
+ void *guest_map;
+ int rc;
+
+ ASSERT( mfn_valid(mfn) );
+ guest_map = map_domain_page(mfn_x(mfn));
+ rc = copy_from_user(guest_map, user_ptr, PAGE_SIZE);
+ unmap_domain_page(guest_map);
+ if ( rc )
+ {
+ gdprintk(XENLOG_ERR, "Failed to load paging-in gfn %lx domain %u "
+ "bytes left %d\n",
+ gfn, p2m->domain->domain_id, rc);
+ ret = -EFAULT;
+ put_page(page); /* Don't leak pages */
+ goto out;
+ }
}
/* Fix p2m mapping */
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -524,7 +524,7 @@ void p2m_mem_paging_drop_page(struct p2m
/* Start populating a paged out frame */
void p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn);
/* Prepare the p2m for paging a frame in */
-int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn);
+int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn, uint64_t buffer);
/* Resume normal operation (in case a domain was paused) */
void p2m_mem_paging_resume(struct p2m_domain *p2m);
#else
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -741,8 +741,12 @@ struct xen_domctl_mem_event_op {
uint32_t op; /* XEN_DOMCTL_MEM_EVENT_OP_*_* */
uint32_t mode; /* XEN_DOMCTL_MEM_EVENT_OP_* */
- /* OP_ENABLE */
- uint64_aligned_t shared_addr; /* IN: Virtual address of shared page */
+ union {
+ /* OP_ENABLE IN: Virtual address of shared page */
+ uint64_aligned_t shared_addr;
+ /* PAGING_PREP IN: buffer to immediately fill page in */
+ uint64_aligned_t buffer;
+ } u;
uint64_aligned_t ring_addr; /* IN: Virtual address of ring page */
/* Other OPs */

View File

@ -0,0 +1,86 @@
changeset: 24328:8ad47b48047d
user: Andres Lagar-Cavilla <andres@lagarcavilla.org>
date: Thu Dec 01 18:14:24 2011 +0000
files: tools/libxc/xc_mem_event.c tools/libxc/xc_mem_paging.c tools/libxc/xenctrl.h
description:
Tools: Libxc wrappers to automatically fill in page oud page contents on prepare
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
---
tools/libxc/xc_mem_event.c | 4 ++--
tools/libxc/xc_mem_paging.c | 23 +++++++++++++++++++++++
tools/libxc/xenctrl.h | 2 ++
3 files changed, 27 insertions(+), 2 deletions(-)
Index: xen-4.1.2-testing/tools/libxc/xc_mem_event.c
===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_mem_event.c
+++ xen-4.1.2-testing/tools/libxc/xc_mem_event.c
@@ -24,7 +24,7 @@
#include "xc_private.h"
int xc_mem_event_control(xc_interface *xch, domid_t domain_id, unsigned int op,
- unsigned int mode, void *shared_page,
+ unsigned int mode, void *page,
void *ring_page, unsigned long gfn)
{
DECLARE_DOMCTL;
@@ -34,7 +34,7 @@ int xc_mem_event_control(xc_interface *x
domctl.u.mem_event_op.op = op;
domctl.u.mem_event_op.mode = mode;
- domctl.u.mem_event_op.shared_addr = (unsigned long)shared_page;
+ domctl.u.mem_event_op.u.shared_addr = (unsigned long)page;
domctl.u.mem_event_op.ring_addr = (unsigned long)ring_page;
domctl.u.mem_event_op.gfn = gfn;
Index: xen-4.1.2-testing/tools/libxc/xc_mem_paging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_mem_paging.c
+++ xen-4.1.2-testing/tools/libxc/xc_mem_paging.c
@@ -65,6 +65,29 @@ int xc_mem_paging_prep(xc_interface *xch
NULL, NULL, gfn);
}
+int xc_mem_paging_load(xc_interface *xch, domid_t domain_id,
+ unsigned long gfn, void *buffer)
+{
+ int rc;
+
+ if ( !buffer )
+ return -EINVAL;
+
+ if ( ((unsigned long) buffer) & (XC_PAGE_SIZE - 1) )
+ return -EINVAL;
+
+ if ( mlock(buffer, XC_PAGE_SIZE) )
+ return -errno;
+
+ rc = xc_mem_event_control(xch, domain_id,
+ XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP,
+ XEN_DOMCTL_MEM_EVENT_OP_PAGING,
+ buffer, NULL, gfn);
+
+ (void)munlock(buffer, XC_PAGE_SIZE);
+ return rc;
+}
+
int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id, unsigned long gfn)
{
return xc_mem_event_control(xch, domain_id,
Index: xen-4.1.2-testing/tools/libxc/xenctrl.h
===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xenctrl.h
+++ xen-4.1.2-testing/tools/libxc/xenctrl.h
@@ -1742,6 +1742,8 @@ int xc_mem_paging_nominate(xc_interface
unsigned long gfn);
int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, unsigned long gfn);
int xc_mem_paging_prep(xc_interface *xch, domid_t domain_id, unsigned long gfn);
+int xc_mem_paging_load(xc_interface *xch, domid_t domain_id,
+ unsigned long gfn, void *buffer);
int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id,
unsigned long gfn);

View File

@ -0,0 +1,100 @@
changeset: 24329:a8f5faa127c4
user: Andres Lagar-Cavilla <andres@lagarcavilla.org>
date: Thu Dec 01 18:14:24 2011 +0000
files: tools/xenpaging/xenpaging.c
description:
Teach xenpaging to use the new and non-racy xc_mem_paging_load interface
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Tim Deegan <tim@xen.org>
---
tools/xenpaging/xenpaging.c | 43 +++++++++++++++++++++----------------------
1 file changed, 21 insertions(+), 22 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c
@@ -45,6 +45,7 @@ static char *dom_path;
static char watch_token[16];
static char *filename;
static int interrupted;
+static void *paging_buffer = NULL;
static void unlink_pagefile(void)
{
@@ -438,6 +439,13 @@ static xenpaging_t *xenpaging_init(int a
goto err;
}
+ paging_buffer = init_page();
+ if ( !paging_buffer )
+ {
+ ERROR("Creating page aligned load buffer");
+ goto err;
+ }
+
return paging;
err:
@@ -649,10 +657,20 @@ static int xenpaging_populate_page(xenpa
unsigned char oom = 0;
DPRINTF("populate_page < gfn %"PRI_xen_pfn" pageslot %d\n", gfn, i);
+
+ /* Read page */
+ ret = read_page(fd, paging_buffer, i);
+ if ( ret != 0 )
+ {
+ ERROR("Error reading page");
+ goto out;
+ }
+
do
{
/* Tell Xen to allocate a page for the domain */
- ret = xc_mem_paging_prep(xch, paging->mem_event.domain_id, gfn);
+ ret = xc_mem_paging_load(xch, paging->mem_event.domain_id, gfn,
+ paging_buffer);
if ( ret != 0 )
{
if ( errno == ENOMEM )
@@ -662,33 +680,14 @@ static int xenpaging_populate_page(xenpa
sleep(1);
continue;
}
- PERROR("Error preparing %"PRI_xen_pfn" for page-in", gfn);
- goto out_map;
+ PERROR("Error loading %"PRI_xen_pfn" during page-in", gfn);
+ goto out;
}
}
while ( ret && !interrupted );
- /* Map page */
- ret = -EFAULT;
- page = xc_map_foreign_pages(xch, paging->mem_event.domain_id,
- PROT_READ | PROT_WRITE, &gfn, 1);
- if ( page == NULL )
- {
- PERROR("Error mapping page %"PRI_xen_pfn": page is null", gfn);
- goto out_map;
- }
-
- /* Read page */
- ret = read_page(fd, page, i);
- if ( ret != 0 )
- {
- PERROR("Error reading page %"PRI_xen_pfn"", gfn);
- goto out;
- }
out:
- munmap(page, PAGE_SIZE);
- out_map:
return ret;
}

View File

@ -0,0 +1,89 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1322836274 28800
# Node ID 72f4e4cb7440c6ab64d4c08dfdc3158112cc95ac
# Parent 109b99239b21275ee2249873dcdb9a413741142d
tools/x86_64: Fix cpuid() inline asm to not clobber stack's red zone
Pushing stuff onto the stack on x86-64 when we do not specify
-mno-red-zone is unsafe. Since the complicated asm is due to register
pressure on i386, we simply implement an all-new simpler alternative
for x86-64.
Signed-off-by: Keir Fraser <keir@xen.org>
Acked-by: Jan Beulich <jbeulich@novell.com>
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1322844002 28800
# Node ID 491c3ebf1d371d03fdd0aabe82b0f422037c67ba
# Parent 72f4e4cb7440c6ab64d4c08dfdc3158112cc95ac
tools/libxc: Fix x86_32 build breakage in previous changeset.
Signed-off-by: Keir Fraser <keir@xen.org>
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -42,23 +42,23 @@ static int hypervisor_is_64bit(xc_interf
static void cpuid(const unsigned int *input, unsigned int *regs)
{
unsigned int count = (input[1] == XEN_CPUID_INPUT_UNUSED) ? 0 : input[1];
- asm (
#ifdef __i386__
+ /* Use the stack to avoid reg constraint failures with some gcc flags */
+ asm (
"push %%ebx; push %%edx\n\t"
-#else
- "push %%rbx; push %%rdx\n\t"
-#endif
"cpuid\n\t"
"mov %%ebx,4(%4)\n\t"
"mov %%edx,12(%4)\n\t"
-#ifdef __i386__
"pop %%edx; pop %%ebx\n\t"
-#else
- "pop %%rdx; pop %%rbx\n\t"
-#endif
: "=a" (regs[0]), "=c" (regs[2])
: "0" (input[0]), "1" (count), "S" (regs)
: "memory" );
+#else
+ asm (
+ "cpuid"
+ : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
+ : "0" (input[0]), "2" (count) );
+#endif
}
/* Get the manufacturer brand name of the host processor. */
--- a/tools/misc/xen-detect.c
+++ b/tools/misc/xen-detect.c
@@ -35,18 +35,21 @@
static void cpuid(uint32_t idx, uint32_t *regs, int pv_context)
{
- asm volatile (
#ifdef __i386__
-#define R(x) "%%e"#x"x"
-#else
-#define R(x) "%%r"#x"x"
-#endif
- "push "R(a)"; push "R(b)"; push "R(c)"; push "R(d)"\n\t"
+ /* Use the stack to avoid reg constraint failures with some gcc flags */
+ asm volatile (
+ "push %%eax; push %%ebx; push %%ecx; push %%edx\n\t"
"test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
"mov %%eax,(%2); mov %%ebx,4(%2)\n\t"
"mov %%ecx,8(%2); mov %%edx,12(%2)\n\t"
- "pop "R(d)"; pop "R(c)"; pop "R(b)"; pop "R(a)"\n\t"
+ "pop %%edx; pop %%ecx; pop %%ebx; pop %%eax\n\t"
: : "a" (idx), "c" (pv_context), "S" (regs) : "memory" );
+#else
+ asm volatile (
+ "test %5,%5 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
+ : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
+ : "0" (idx), "1" (pv_context), "2" (0) );
+#endif
}
static int check_for_xen(int pv_context)

View File

@ -0,0 +1,49 @@
References: bnc#711219
# HG changeset patch
# User Xudong Hao <xudong.hao@intel.com>
# Date 1323113706 0
# Node ID 832fa3f3543298a7125cd5f996d1e28dd7ba47b1
# Parent 60ea36c0512b779f291bb6c007e1f05c16054ec2
tools/firmware: remove "_PS0/3" Method
Do not expose the ACPI power management "_PS0/3" Method to guest
firmware. According to section 3.4 of the APCI specification 4.0, PCI
device control the device power through its own specification but not
through APCI.
Qemu pushes "_PS0/3" to guest will cause a mess between ACPI PM and
PCI PM as a result of incorrect ACPI table shipped with the guest
BIOS, it may cause a failure of PCI device PM state transition(from
PCI_UNKNOWN to PCI_D0).
Signed-off-by: Xudong Hao <xudong.hao@intel.com>
Signed-off-by: Haitao Shan <haitao.shan@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
--- a/tools/firmware/hvmloader/acpi/mk_dsdt.c
+++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c
@@ -251,8 +251,6 @@ int main(int argc, char **argv)
* the ACPI event:
* _EJ0: eject a device
* _STA: return a device's status, e.g. enabled or removed
- * Other methods are optional:
- * _PS0/3: put them here for debug purpose
*
* Eject button would generate a general-purpose event, then the
* control method for this event uses Notify() to inform OSPM which
@@ -271,14 +269,6 @@ int main(int argc, char **argv)
stmt("Name", "_ADR, 0x%08x", ((slot & ~7) << 13) | (slot & 7));
/* _SUN == dev */
stmt("Name", "_SUN, 0x%08x", slot >> 3);
- push_block("Method", "_PS0, 0");
- stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
- stmt("Store", "0x80, \\_GPE.DPT2");
- pop_block();
- push_block("Method", "_PS3, 0");
- stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
- stmt("Store", "0x83, \\_GPE.DPT2");
- pop_block();
push_block("Method", "_EJ0, 1");
stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
stmt("Store", "0x88, \\_GPE.DPT2");

View File

@ -0,0 +1,29 @@
# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1323114166 0
# Node ID 9961a6d5356a57685b06f65133c6ade5041e3356
# Parent 832fa3f3543298a7125cd5f996d1e28dd7ba47b1
KEXEC: fix kexec_get_range_compat to fail vocally.
Fail with -ERANGE rather than silently truncating 64bit values (a
physical address and size) into 32bit integers for dom0 to consume.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Simplify the bitwise arithmetic a bit.
Signed-off-by: Keir Fraser <keir@xen.org>
--- a/xen/common/kexec.c
+++ b/xen/common/kexec.c
@@ -395,6 +395,10 @@ static int kexec_get_range_compat(XEN_GU
ret = kexec_get_range_internal(&range);
+ /* Dont silently truncate physical addresses or sizes. */
+ if ( (range.start | range.size) & ~(unsigned long)(~0u) )
+ return -ERANGE;
+
if ( ret == 0 ) {
XLAT_kexec_range(&compat_range, &range);
if ( unlikely(copy_to_guest(uarg, &compat_range, 1)) )

View File

@ -0,0 +1,94 @@
# HG changeset patch
# User Liu, Jinsong <jinsong.liu@intel.com>
# Date 1323170838 0
# Node ID a0befa32e927cc147aaee9bce42c51f53580a875
# Parent 9961a6d5356a57685b06f65133c6ade5041e3356
X86: expose Intel new features to pv/hvm
Intel recently release some new features, including
FMA/AVX2/BMI1/BMI2/LZCNT/MOVBE.
Refer to http://software.intel.com/file/36945
This patch expose these new features to pv and hvm.
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
--- a/tools/libxc/xc_cpufeature.h
+++ b/tools/libxc/xc_cpufeature.h
@@ -74,6 +74,7 @@
#define X86_FEATURE_TM2 8 /* Thermal Monitor 2 */
#define X86_FEATURE_SSSE3 9 /* Supplemental Streaming SIMD Exts-3 */
#define X86_FEATURE_CID 10 /* Context ID */
+#define X86_FEATURE_FMA 12 /* Fused Multiply Add */
#define X86_FEATURE_CX16 13 /* CMPXCHG16B */
#define X86_FEATURE_XTPR 14 /* Send Task Priority Messages */
#define X86_FEATURE_PDCM 15 /* Perf/Debug Capability MSR */
@@ -81,6 +82,7 @@
#define X86_FEATURE_SSE4_1 19 /* Streaming SIMD Extensions 4.1 */
#define X86_FEATURE_SSE4_2 20 /* Streaming SIMD Extensions 4.2 */
#define X86_FEATURE_X2APIC 21 /* x2APIC */
+#define X86_FEATURE_MOVBE 22 /* movbe instruction */
#define X86_FEATURE_POPCNT 23 /* POPCNT instruction */
#define X86_FEATURE_TSC_DEADLINE 24 /* "tdt" TSC Deadline Timer */
#define X86_FEATURE_AES 25 /* AES acceleration instructions */
@@ -125,7 +127,10 @@
/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx) */
#define X86_FEATURE_FSGSBASE 0 /* {RD,WR}{FS,GS}BASE instructions */
+#define X86_FEATURE_BMI1 3 /* 1st group bit manipulation extensions */
+#define X86_FEATURE_AVX2 5 /* AVX2 instructions */
#define X86_FEATURE_SMEP 7 /* Supervisor Mode Execution Protection */
+#define X86_FEATURE_BMI2 8 /* 2nd group bit manipulation extensions */
#define X86_FEATURE_ERMS 9 /* Enhanced REP MOVSB/STOSB */
#endif /* __LIBXC_CPUFEATURE_H */
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -148,7 +148,8 @@ static void intel_xc_cpuid_policy(
int is_64bit = hypervisor_is_64bit(xch) && is_pae;
/* Only a few features are advertised in Intel's 0x80000001. */
- regs[2] &= (is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0);
+ regs[2] &= (is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0) |
+ bitmaskof(X86_FEATURE_ABM);
regs[3] &= ((is_pae ? bitmaskof(X86_FEATURE_NX) : 0) |
(is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) |
(is_64bit ? bitmaskof(X86_FEATURE_SYSCALL) : 0) |
@@ -256,9 +257,11 @@ static void xc_cpuid_hvm_policy(
regs[2] &= (bitmaskof(X86_FEATURE_XMM3) |
bitmaskof(X86_FEATURE_PCLMULQDQ) |
bitmaskof(X86_FEATURE_SSSE3) |
+ bitmaskof(X86_FEATURE_FMA) |
bitmaskof(X86_FEATURE_CX16) |
bitmaskof(X86_FEATURE_SSE4_1) |
bitmaskof(X86_FEATURE_SSE4_2) |
+ bitmaskof(X86_FEATURE_MOVBE) |
bitmaskof(X86_FEATURE_POPCNT) |
bitmaskof(X86_FEATURE_AES) |
bitmaskof(X86_FEATURE_F16C) |
@@ -303,7 +306,10 @@ static void xc_cpuid_hvm_policy(
case 0x00000007: /* Intel-defined CPU features */
if ( input[1] == 0 ) {
- regs[1] &= (bitmaskof(X86_FEATURE_SMEP) |
+ regs[1] &= (bitmaskof(X86_FEATURE_BMI1) |
+ bitmaskof(X86_FEATURE_AVX2) |
+ bitmaskof(X86_FEATURE_SMEP) |
+ bitmaskof(X86_FEATURE_BMI2) |
bitmaskof(X86_FEATURE_ERMS) |
bitmaskof(X86_FEATURE_FSGSBASE));
} else
@@ -427,8 +433,11 @@ static void xc_cpuid_pv_policy(
case 7:
if ( input[1] == 0 )
- regs[1] &= (bitmaskof(X86_FEATURE_FSGSBASE) |
- bitmaskof(X86_FEATURE_ERMS));
+ regs[1] &= (bitmaskof(X86_FEATURE_BMI1) |
+ bitmaskof(X86_FEATURE_AVX2) |
+ bitmaskof(X86_FEATURE_BMI2) |
+ bitmaskof(X86_FEATURE_ERMS) |
+ bitmaskof(X86_FEATURE_FSGSBASE));
else
regs[1] = 0;
regs[0] = regs[2] = regs[3] = 0;

View File

@ -0,0 +1,39 @@
# HG changeset patch
# User Liu, Jinsong <jinsong.liu@intel.com>
# Date 1323170884 0
# Node ID d313582d4fa2157332f1d50e599aebca36c41b3b
# Parent a0befa32e927cc147aaee9bce42c51f53580a875
X86: Disable PCID/INVPCID for pv
This patch disable PCID/INVPCID for pv.
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
--- a/tools/libxc/xc_cpufeature.h
+++ b/tools/libxc/xc_cpufeature.h
@@ -78,6 +78,7 @@
#define X86_FEATURE_CX16 13 /* CMPXCHG16B */
#define X86_FEATURE_XTPR 14 /* Send Task Priority Messages */
#define X86_FEATURE_PDCM 15 /* Perf/Debug Capability MSR */
+#define X86_FEATURE_PCID 17 /* Process Context ID */
#define X86_FEATURE_DCA 18 /* Direct Cache Access */
#define X86_FEATURE_SSE4_1 19 /* Streaming SIMD Extensions 4.1 */
#define X86_FEATURE_SSE4_2 20 /* Streaming SIMD Extensions 4.2 */
@@ -132,5 +133,6 @@
#define X86_FEATURE_SMEP 7 /* Supervisor Mode Execution Protection */
#define X86_FEATURE_BMI2 8 /* 2nd group bit manipulation extensions */
#define X86_FEATURE_ERMS 9 /* Enhanced REP MOVSB/STOSB */
+#define X86_FEATURE_INVPCID 10 /* Invalidate Process Context ID */
#endif /* __LIBXC_CPUFEATURE_H */
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -427,6 +427,7 @@ static void xc_cpuid_pv_policy(
}
clear_bit(X86_FEATURE_XTPR, regs[2]);
clear_bit(X86_FEATURE_PDCM, regs[2]);
+ clear_bit(X86_FEATURE_PCID, regs[2]);
clear_bit(X86_FEATURE_DCA, regs[2]);
set_bit(X86_FEATURE_HYPERVISOR, regs[2]);
break;

View File

@ -0,0 +1,109 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1323765911 -3600
# Node ID 868d82faf6511de3b3edce18cc6a9e1c938f0b8f
# Parent 7ca56cca09ade16645fb4806be2c5b2b0bc3332b
x86, amd: Disable GartTlbWlkErr when BIOS forgets it
This patch disables GartTlbWlk errors on AMD Fam10h CPUs if the BIOS
forgets to do is (or is just too old). Letting these errors enabled
can cause a sync-flood on the CPU causing a reboot.
The AMD BKDG recommends disabling GART TLB Wlk Error completely.
Based on a Linux patch from Joerg Roedel <joerg.roedel@amd.com>; see e.g.
https://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=patch;h=5bbc097d890409d8eff4e3f1d26f11a9d6b7c07e
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/cpu/mcheck/amd_f10.c
+++ b/xen/arch/x86/cpu/mcheck/amd_f10.c
@@ -46,6 +46,7 @@
#include <asm/msr.h>
#include "mce.h"
+#include "mce_quirks.h"
#include "x86_mca.h"
@@ -91,9 +92,14 @@ amd_f10_handler(struct mc_info *mi, uint
/* AMD Family10 machine check */
enum mcheck_type amd_f10_mcheck_init(struct cpuinfo_x86 *c)
{
+ enum mcequirk_amd_flags quirkflag = mcequirk_lookup_amd_quirkdata(c);
+
if (amd_k8_mcheck_init(c) == mcheck_none)
return mcheck_none;
+ if (quirkflag == MCEQUIRK_F10_GART)
+ mcequirk_amd_apply(quirkflag);
+
x86_mce_callback_register(amd_f10_handler);
return mcheck_amd_famXX;
--- a/xen/arch/x86/cpu/mcheck/mce_amd_quirks.c
+++ b/xen/arch/x86/cpu/mcheck/mce_amd_quirks.c
@@ -29,6 +29,8 @@ static const struct mce_quirkdata mce_am
MCEQUIRK_K7_BANK0 },
{ 0xf /* cpu family */, ANY /* all models */, ANY /* all steppings */,
MCEQUIRK_K8_GART },
+ { 0x10 /* cpu family */, ANY /* all models */, ANY /* all steppings */,
+ MCEQUIRK_F10_GART },
};
enum mcequirk_amd_flags
@@ -54,6 +56,8 @@ mcequirk_lookup_amd_quirkdata(struct cpu
int mcequirk_amd_apply(enum mcequirk_amd_flags flags)
{
+ u64 val;
+
switch (flags) {
case MCEQUIRK_K7_BANK0:
return 1; /* first bank */
@@ -67,6 +71,10 @@ int mcequirk_amd_apply(enum mcequirk_amd
wrmsrl(MSR_IA32_MC4_CTL, ~(1ULL << 10));
wrmsrl(MSR_IA32_MC4_STATUS, 0ULL);
break;
+ case MCEQUIRK_F10_GART:
+ if (rdmsr_safe(MSR_AMD64_MCx_MASK(4), val) == 0)
+ wrmsr_safe(MSR_AMD64_MCx_MASK(4), val | (1 << 10));
+ break;
}
return 0;
--- a/xen/arch/x86/cpu/mcheck/mce_quirks.h
+++ b/xen/arch/x86/cpu/mcheck/mce_quirks.h
@@ -33,8 +33,9 @@ struct mce_quirkdata {
*/
enum mcequirk_amd_flags {
- MCEQUIRK_K7_BANK0 = 0x1,
- MCEQUIRK_K8_GART = 0x2,
+ MCEQUIRK_K7_BANK0 = 1,
+ MCEQUIRK_K8_GART,
+ MCEQUIRK_F10_GART
};
enum mcequirk_intel_flags {
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -98,6 +98,8 @@
#define CMCI_EN (1UL<<30)
#define CMCI_THRESHOLD_MASK 0x7FFF
+#define MSR_AMD64_MC0_MASK 0xc0010044
+
#define MSR_IA32_MC1_CTL 0x00000404
#define MSR_IA32_MC1_CTL2 0x00000281
#define MSR_IA32_MC1_STATUS 0x00000405
@@ -151,6 +153,8 @@
#define MSR_IA32_MCx_ADDR(x) (MSR_IA32_MC0_ADDR + 4*(x))
#define MSR_IA32_MCx_MISC(x) (MSR_IA32_MC0_MISC + 4*(x))
+#define MSR_AMD64_MCx_MASK(x) (MSR_AMD64_MC0_MASK + (x))
+
#define MSR_P6_PERFCTR0 0x000000c1
#define MSR_P6_PERFCTR1 0x000000c2
#define MSR_P6_EVNTSEL0 0x00000186

View File

@ -0,0 +1,155 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1323766131 -3600
# Node ID 3f4ffde189f228d88e534865023fd795f77f0d05
# Parent 77528dbced3ea74901be6b1aeddedda22bfdaf63
x86: add platform hypercall to retrieve pCPU-s' family, model, and stepping
With the recent hotplug changes to the Xen part of the microcode
loading, this allows the kernel driver to avoid unnecessary calls into
the hypervisor during pCPU hot-enabling: Knowing that the hypervisor
retains the data for already booted CPUs, only data for CPUs with a
different signature needs to be passed down. Since the microcode
loading code can be pretty verbose, avoiding to invoke it can make the
log much easier to look at in case of problems.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -469,6 +469,42 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
}
break;
+ case XENPF_get_cpu_version:
+ {
+ struct xenpf_pcpu_version *ver = &op->u.pcpu_version;
+
+ if ( !get_cpu_maps() )
+ {
+ ret = -EBUSY;
+ break;
+ }
+
+ if ( (ver->xen_cpuid >= NR_CPUS) || !cpu_online(ver->xen_cpuid) )
+ {
+ memset(ver->vendor_id, 0, sizeof(ver->vendor_id));
+ ver->family = 0;
+ ver->model = 0;
+ ver->stepping = 0;
+ }
+ else
+ {
+ const struct cpuinfo_x86 *c = &cpu_data[ver->xen_cpuid];
+
+ memcpy(ver->vendor_id, c->x86_vendor_id, sizeof(ver->vendor_id));
+ ver->family = c->x86;
+ ver->model = c->x86_model;
+ ver->stepping = c->x86_mask;
+ }
+
+ ver->max_present = cpumask_last(&cpu_present_map);
+
+ put_cpu_maps();
+
+ if ( copy_field_to_guest(u_xenpf_op, op, u.pcpu_version) )
+ ret = -EFAULT;
+ }
+ break;
+
case XENPF_cpu_online:
{
int cpu = op->u.cpu_ol.cpuid;
--- a/xen/arch/x86/x86_64/platform_hypercall.c
+++ b/xen/arch/x86/x86_64/platform_hypercall.c
@@ -3,7 +3,7 @@
*/
#include <xen/config.h>
-#include <xen/types.h>
+#include <xen/lib.h>
#include <compat/platform.h>
DEFINE_XEN_GUEST_HANDLE(compat_platform_op_t);
@@ -26,8 +26,13 @@ DEFINE_XEN_GUEST_HANDLE(compat_platform_
#define xen_processor_power_t compat_processor_power_t
#define set_cx_pminfo compat_set_cx_pminfo
-#define xenpf_pcpuinfo compat_pf_pcpuinfo
-#define xenpf_pcpuinfo_t compat_pf_pcpuinfo_t
+#define xen_pf_pcpuinfo xenpf_pcpuinfo
+CHECK_pf_pcpuinfo;
+#undef xen_pf_pcpuinfo
+
+#define xen_pf_pcpu_version xenpf_pcpu_version
+CHECK_pf_pcpu_version;
+#undef xen_pf_pcpu_version
#define xenpf_enter_acpi_sleep compat_pf_enter_acpi_sleep
--- a/xen/include/public/platform.h
+++ b/xen/include/public/platform.h
@@ -425,6 +425,21 @@ struct xenpf_pcpuinfo {
typedef struct xenpf_pcpuinfo xenpf_pcpuinfo_t;
DEFINE_XEN_GUEST_HANDLE(xenpf_pcpuinfo_t);
+#define XENPF_get_cpu_version 48
+struct xenpf_pcpu_version {
+ /* IN */
+ uint32_t xen_cpuid;
+ /* OUT */
+ /* The maxium cpu_id that is present */
+ uint32_t max_present;
+ char vendor_id[12];
+ uint32_t family;
+ uint32_t model;
+ uint32_t stepping;
+};
+typedef struct xenpf_pcpu_version xenpf_pcpu_version_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_pcpu_version_t);
+
#define XENPF_cpu_online 56
#define XENPF_cpu_offline 57
struct xenpf_cpu_ol
@@ -468,6 +483,7 @@ struct xen_platform_op {
struct xenpf_getidletime getidletime;
struct xenpf_set_processor_pminfo set_pminfo;
struct xenpf_pcpuinfo pcpu_info;
+ struct xenpf_pcpu_version pcpu_version;
struct xenpf_cpu_ol cpu_ol;
struct xenpf_cpu_hotadd cpu_add;
struct xenpf_mem_hotadd mem_add;
--- a/xen/include/xlat.lst
+++ b/xen/include/xlat.lst
@@ -61,6 +61,17 @@
! memory_reservation memory.h
! pod_target memory.h
? physdev_pci_mmcfg_reserved physdev.h
+! pct_register platform.h
+! power_register platform.h
+? processor_csd platform.h
+! processor_cx platform.h
+! processor_flags platform.h
+! processor_performance platform.h
+! processor_power platform.h
+? processor_px platform.h
+! psd_package platform.h
+? xenpf_pcpuinfo platform.h
+? xenpf_pcpu_version platform.h
! sched_poll sched.h
? sched_remote_shutdown sched.h
? sched_shutdown sched.h
@@ -73,12 +84,3 @@
! vcpu_set_singleshot_timer vcpu.h
? xenoprof_init xenoprof.h
? xenoprof_passive xenoprof.h
-! power_register platform.h
-? processor_csd platform.h
-! processor_cx platform.h
-! processor_flags platform.h
-! processor_power platform.h
-! pct_register platform.h
-? processor_px platform.h
-! psd_package platform.h
-! processor_performance platform.h

View File

@ -0,0 +1,143 @@
References: bnc#736824
# HG changeset patch
# User Christoph Egger <Christoph.Egger@amd.com>
# Date 1323943209 -3600
# Node ID ca5f588bd203c9207e0988fcc80f43d83eed5420
# Parent 25f8952313ae683f41b634163f62651185d7be38
x86/ucode: fix for AMD Fam15 CPUs
Remove hardcoded maximum size a microcode patch can have. This is
dynamic now.
The microcode patch for family15h can be larger than 2048 bytes and
gets silently truncated.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- 2011-12-14.orig/xen/arch/x86/microcode_amd.c 2011-12-15 14:55:15.000000000 +0100
+++ 2011-12-14/xen/arch/x86/microcode_amd.c 2011-12-15 14:59:47.000000000 +0100
@@ -27,18 +27,10 @@
#include <asm/processor.h>
#include <asm/microcode.h>
-#define pr_debug(x...) ((void)0)
-
#define UCODE_MAGIC 0x00414d44
#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000
#define UCODE_UCODE_TYPE 0x00000001
-#define UCODE_MAX_SIZE (2048)
-#define DEFAULT_UCODE_DATASIZE (896)
-#define MC_HEADER_SIZE (sizeof(struct microcode_header_amd))
-#define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE)
-#define DWSIZE (sizeof(uint32_t))
-
/* serialize access to the physical write */
static DEFINE_SPINLOCK(microcode_update_lock);
@@ -99,7 +91,7 @@ static int microcode_fits(void *mc, int
}
if ( mc_header->patch_id <= uci->cpu_sig.rev )
- return -EINVAL;
+ return 0;
printk(KERN_DEBUG "microcode: CPU%d found a matching microcode "
"update with version 0x%x (current=0x%x)\n",
@@ -147,8 +139,12 @@ static int apply_microcode(int cpu)
return 0;
}
-static int get_next_ucode_from_buffer_amd(void *mc, const void *buf,
- size_t size, unsigned long *offset)
+static int get_next_ucode_from_buffer_amd(
+ void **mc,
+ size_t *mc_size,
+ const void *buf,
+ size_t size,
+ unsigned long *offset)
{
struct microcode_header_amd *mc_header;
size_t total_size;
@@ -181,8 +177,17 @@ static int get_next_ucode_from_buffer_am
return -EINVAL;
}
- memset(mc, 0, UCODE_MAX_SIZE);
- memcpy(mc, (const void *)(&bufp[off + 8]), total_size);
+ if ( *mc_size < total_size )
+ {
+ xfree(*mc);
+ *mc = xmalloc_bytes(total_size);
+ if ( !*mc )
+ return -ENOMEM;
+ *mc_size = total_size;
+ }
+ else if ( *mc_size > total_size )
+ memset(*mc + total_size, 0, *mc_size - total_size);
+ memcpy(*mc, mc_header, total_size);
*offset = off + total_size + 8;
@@ -236,10 +241,10 @@ static int cpu_request_microcode(int cpu
{
const uint32_t *buf_pos;
unsigned long offset = 0;
- int error = 0;
- int ret;
+ int error;
struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu);
void *mc;
+ size_t mc_size;
/* We should bind the task to the CPU */
BUG_ON(cpu != raw_smp_processor_id());
@@ -260,7 +265,9 @@ static int cpu_request_microcode(int cpu
return -EINVAL;
}
- mc = xmalloc_bytes(UCODE_MAX_SIZE);
+ /* Size of 1st microcode patch in bytes */
+ mc_size = buf_pos[offset / sizeof(*buf_pos) + 1];
+ mc = xmalloc_bytes(mc_size);
if ( mc == NULL )
{
printk(KERN_ERR "microcode: error! "
@@ -276,24 +284,33 @@ static int cpu_request_microcode(int cpu
* It's possible the data file has multiple matching ucode,
* lets keep searching till the latest version
*/
- while ( (ret = get_next_ucode_from_buffer_amd(mc, buf, size, &offset)) == 0)
+ while ( (error = get_next_ucode_from_buffer_amd(&mc, &mc_size, buf, size,
+ &offset)) == 0 )
{
+ uci->mc.mc_amd = mc;
+
error = microcode_fits(mc, cpu);
if (error <= 0)
continue;
error = apply_microcode(cpu);
if (error == 0)
+ {
+ error = 1;
break;
+ }
}
/* On success keep the microcode patch for
* re-apply on resume.
*/
- if (error) {
+ if ( error <= 0 )
+ {
xfree(mc);
mc = NULL;
}
+ else
+ error = 0;
uci->mc.mc_amd = mc;
out:

View File

@ -0,0 +1,23 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1323955725 -3600
# Node ID 99caac2e35df41cbece606f663cb5570a62613c3
# Parent ca5f588bd203c9207e0988fcc80f43d83eed5420
x86/AMD: use correct shift count when merging model and stepping
... for legacy errata matching.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -216,7 +216,7 @@ int cpu_has_amd_erratum(const struct cpu
}
/* OSVW unavailable or ID unknown, match family-model-stepping range */
- ms = (cpu->x86_model << 8) | cpu->x86_mask;
+ ms = (cpu->x86_model << 4) | cpu->x86_mask;
while ((range = va_arg(ap, int))) {
if ((cpu->x86 == AMD_MODEL_RANGE_FAMILY(range)) &&
(ms >= AMD_MODEL_RANGE_START(range)) &&

View File

@ -0,0 +1,85 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1324046740 -3600
# Node ID 1452fb248cd513832cfbbd1100b9b72a0dde7ea6
# Parent 01c8b27e3d7d4ad2b469be9922bb04b5eb0195e8
x86/emulator: workaround for AMD erratum 573
The only cases where we might end up emulating fsincos (as any other
x87 operations without memory operands) are
- when a HVM guest is in real mode (not applicable on AMD)
- between two half page table updates in PAE mode (unlikely, and not
doing the emulation here does affect only performance, not
correctness)
- when a guest maliciously (or erroneously) modifies an (MMIO or page
table update) instruction under emulation (unspecified behavior)
Hence, in order to avoid the erratum to cause harm to the entire host,
don't emulate fsincos on the affected AMD CPU families.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/tools/tests/x86_emulator/x86_emulate.c
+++ b/tools/tests/x86_emulator/x86_emulate.c
@@ -3,5 +3,7 @@
#include <string.h>
#include <public/xen.h>
+#define cpu_has_amd_erratum(nr) 0
+
#include "x86_emulate/x86_emulate.h"
#include "x86_emulate/x86_emulate.c"
--- a/xen/arch/x86/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate.c
@@ -10,8 +10,15 @@
*/
#include <asm/x86_emulate.h>
+#include <asm/processor.h> /* current_cpu_info */
+#include <asm/amd.h> /* cpu_has_amd_erratum() */
/* Avoid namespace pollution. */
#undef cmpxchg
+#undef cpuid
+#undef wbinvd
+
+#define cpu_has_amd_erratum(nr) \
+ cpu_has_amd_erratum(&current_cpu_data, AMD_ERRATUM_##nr)
#include "x86_emulate/x86_emulate.c"
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2621,6 +2621,9 @@ x86_emulate(
case 0xd9: /* FPU 0xd9 */
switch ( modrm )
{
+ case 0xfb: /* fsincos */
+ fail_if(cpu_has_amd_erratum(573));
+ /* fall through */
case 0xc0 ... 0xc7: /* fld %stN */
case 0xc8 ... 0xcf: /* fxch %stN */
case 0xd0: /* fnop */
@@ -2646,7 +2649,6 @@ x86_emulate(
case 0xf8: /* fprem */
case 0xf9: /* fyl2xp1 */
case 0xfa: /* fsqrt */
- case 0xfb: /* fsincos */
case 0xfc: /* frndint */
case 0xfd: /* fscale */
case 0xfe: /* fsin */
--- a/xen/include/asm-x86/amd.h
+++ b/xen/include/asm-x86/amd.h
@@ -138,6 +138,12 @@
AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf), \
AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf))
+#define AMD_ERRATUM_573 \
+ AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x0f, 0x0, 0x0, 0xff, 0xf), \
+ AMD_MODEL_RANGE(0x10, 0x0, 0x0, 0xff, 0xf), \
+ AMD_MODEL_RANGE(0x11, 0x0, 0x0, 0xff, 0xf), \
+ AMD_MODEL_RANGE(0x12, 0x0, 0x0, 0xff, 0xf))
+
struct cpuinfo_x86;
int cpu_has_amd_erratum(const struct cpuinfo_x86 *, int, ...);

28
24429-mceinj-tool.patch Normal file
View File

@ -0,0 +1,28 @@
# HG changeset patch
# User Liu, Jinsong <jinsong.liu@intel.com>
# Date 1324219200 0
# Node ID 9587ccc2ae3192fd5625a87fa58e840377471867
# Parent 5b4b7e565ab82b06940889f2be7e30042b2881fc
X86-MCE: fix a bug of xen-mceinj tool
Fix a bug of xen-mceinj tool which used to test mce by software way.
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
--- a/tools/tests/mce-test/tools/xen-mceinj.c
+++ b/tools/tests/mce-test/tools/xen-mceinj.c
@@ -134,8 +134,12 @@ static int mca_cpuinfo(xc_interface *xc_
{
struct xen_mc mc;
+ memset(&mc, 0, sizeof(struct xen_mc));
+
mc.cmd = XEN_MC_physcpuinfo;
- if (xc_mca_op(xc_handle, &mc))
+ mc.interface_version = XEN_MCA_INTERFACE_VERSION;
+
+ if (!xc_mca_op(xc_handle, &mc))
return mc.u.mc_physcpuinfo.ncpus;
else
return 0;

View File

@ -0,0 +1,46 @@
# HG changeset patch
# User Gang Wei <gang.wei@intel.com>
# Date 1325153274 0
# Node ID a7b2610b8e5c9a15b1f5de9a3eabf7f19d0b4199
# Parent 2863b2f43a3bc9268885379d6fd55ed325b8c0a2
X86: Add a delay between INIT & SIPIs for tboot AP bring-up in X2APIC case
Without this delay, Xen could not bring APs up while working with
TXT/tboot, because tboot needs some time in APs to handle INIT before
becoming ready for receiving SIPIs (this delay was removed as part of
c/s 23724 by Tim Deegan).
Signed-off-by: Gang Wei <gang.wei@intel.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -42,6 +42,7 @@
#include <asm/msr.h>
#include <asm/mtrr.h>
#include <asm/time.h>
+#include <asm/tboot.h>
#include <mach_apic.h>
#include <mach_wakecpu.h>
#include <smpboot_hooks.h>
@@ -473,6 +474,18 @@ static int wakeup_secondary_cpu(int phys
send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
} while ( send_status && (timeout++ < 1000) );
}
+ else if ( tboot_in_measured_env() )
+ {
+ /*
+ * With tboot AP is actually spinning in a mini-guest before
+ * receiving INIT. Upon receiving INIT ipi, AP need time to VMExit,
+ * update VMCS to tracking SIPIs and VMResume.
+ *
+ * While AP is in root mode handling the INIT the CPU will drop
+ * any SIPIs
+ */
+ udelay(10);
+ }
/*
* Should we send STARTUP IPIs ?

View File

@ -0,0 +1,31 @@
References: bnc#735806
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1325492779 -3600
# Node ID 3a22ed3ec534799b3cab55b0dc0a7380e701ecbe
# Parent a7b2610b8e5c9a15b1f5de9a3eabf7f19d0b4199
x86/passthrough: don't leak guest IRQs
As unmap_domain_pirq_emuirq() fails on a never mapped pIRQ, it must not
be called for the non-emu-IRQ case (to prevent the entire unmap
operation failing).
Based on a suggestion from Stefano.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Yongjie Ren <yongjie.ren@intel.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -228,7 +228,8 @@ static int physdev_unmap_pirq(struct phy
if ( is_hvm_domain(d) )
{
spin_lock(&d->event_lock);
- ret = unmap_domain_pirq_emuirq(d, unmap->pirq);
+ if ( domain_pirq_to_emuirq(d, unmap->pirq) != IRQ_UNBOUND )
+ ret = unmap_domain_pirq_emuirq(d, unmap->pirq);
spin_unlock(&d->event_lock);
if ( unmap->domid == DOMID_SELF || ret )
goto free_domain;

View File

@ -0,0 +1,38 @@
# HG changeset patch
# User Yongan Liu<Liuyongan@huawei.com>
# Date 1325752199 -3600
# Node ID 02b92d035f6484ea33f03c4a59630d82e0469eeb
# Parent efaa28639a71524a693ba500624f8512e5795e18
x86/vIRQ: IRR and TMR race condition bug fix
In vlapic_set_irq, we set the IRR register before the TMR. And the IRR
might be serviced before setting TMR, and even worse EOI might occur
before TMR setting, in which case the vioapic_update_EOI won't be
called, and further prevent all the subsequent interrupt injecting.
Reorder setting the TMR and IRR will solve the problem.
Besides, KVM has fixed a similar bug in:
http://markmail.org/search/?q=APIC_TMR#query:APIC_TMR+page:1+mid:rphs4f7lkxjlldne+state:results
Signed-off-by: Yongan Liu<Liuyongan@huawei.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -142,14 +142,11 @@ static int vlapic_find_highest_irr(struc
int vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig)
{
- int ret;
-
- ret = !vlapic_test_and_set_irr(vec, vlapic);
if ( trig )
vlapic_set_vector(vec, &vlapic->regs->data[APIC_TMR]);
/* We may need to wake up target vcpu, besides set pending bit here */
- return ret;
+ return !vlapic_test_and_set_irr(vec, vlapic);
}
static int vlapic_find_highest_isr(struct vlapic *vlapic)

27
24456-x86-emul-lea.patch Normal file
View File

@ -0,0 +1,27 @@
# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1325778436 0
# Node ID 03781de56c31072266fb464e7dfeec133bcf0fb4
# Parent 94180a5a0c7c7d680ede2e54bd13f56ed43f452d
x86: emulate lea with two register operands correctly
An lea instruction with two register operands should raise an
undefined instruction exception.
Skype does such a instruction and will crash when starting if it does
not get the exception.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2100,6 +2100,7 @@ x86_emulate(
}
case 0x8d: /* lea */
+ generate_exception_if(ea.type != OP_MEM, EXC_UD, -1);
dst.val = ea.mem.off;
break;

30
24459-libxl-vifname.patch Normal file
View File

@ -0,0 +1,30 @@
# HG changeset patch
# User Wei Liu <wei.liu2@citrix.com>
# Date 1325783613 0
# Node ID caf9753d4cc100183eeda26d00c8c38f14215651
# Parent 19ac027a3c311159dc0f3696d6e571314f0bf0c3
libxl: write vifname in xenstore if set.
Simple fix to enable user to specify vif names.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Index: xen-4.1.2-testing/tools/libxl/libxl.c
===================================================================
--- xen-4.1.2-testing.orig/tools/libxl/libxl.c
+++ xen-4.1.2-testing/tools/libxl/libxl.c
@@ -1233,6 +1233,12 @@ int libxl_device_nic_add(libxl_ctx *ctx,
flexarray_append(back, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
nic->mac[0], nic->mac[1], nic->mac[2],
nic->mac[3], nic->mac[4], nic->mac[5]));
+
+ if (nic->ifname) {
+ flexarray_append(back, "vifname");
+ flexarray_append(back, nic->ifname);
+ }
+
if (nic->ip) {
flexarray_append(back, "ip");
flexarray_append(back, libxl__strdup(&gc, nic->ip));

View File

@ -0,0 +1,34 @@
changeset: 24466:fc78d16447b4
user: Andres Lagar-Cavilla <andres@lagarcavilla.org>
date: Tue Jan 10 15:35:01 2012 +0000
files: tools/libxc/xc_linux_osdep.c
description:
libxc: Only retry mapping pages when ENOENT is returned
If the return value from the ioctl() is not ENOENT, it's possible that err[i]
will not be updated and libxc will just loop forever. Although it's unlikely
that err[i] would not be updated after the ioctl() gets through at least once,
it's better to be defensive.
Signed-off-by: Adin Scannell <adin@scannell.ca>
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
tools/libxc/xc_linux_osdep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: xen-4.1.2-testing/tools/libxc/xc_linux_osdep.c
===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_linux_osdep.c
+++ xen-4.1.2-testing/tools/libxc/xc_linux_osdep.c
@@ -208,7 +208,7 @@ static void *linux_privcmd_map_foreign_b
do {
usleep(100);
rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
- } while ( rc < 0 && err[i] == -ENOENT );
+ } while ( rc < 0 && errno == ENOENT && err[i] == -ENOENT );
}
}

View File

@ -0,0 +1,45 @@
changeset: 24478:ef99b8571a6f
user: Olaf Hering <olaf@aepfle.de>
date: Thu Jan 05 19:40:40 2012 +0100
files: tools/libxl/libxl_create.c tools/python/xen/xend/XendDomainInfo.py
description:
libxl: add feature flag to xenstore for XS_RESET_WATCHES
Tell guest about availibilty of xenstoreds XS_RESET_WATCHES function.
Guests can not issue this command unconditionally because some buggy
toolstacks (such as EC2) do not ignore unknown commands properly.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
tools/libxl/libxl_create.c | 1 +
tools/python/xen/xend/XendDomainInfo.py | 1 +
2 files changed, 2 insertions(+)
Index: xen-4.1.2-testing/tools/libxl/libxl_create.c
===================================================================
--- xen-4.1.2-testing.orig/tools/libxl/libxl_create.c
+++ xen-4.1.2-testing/tools/libxl/libxl_create.c
@@ -382,6 +382,7 @@ retry_transaction:
libxl__xs_writev(&gc, t, libxl__sprintf(&gc, "%s/platform", dom_path), info->platformdata);
xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/control/platform-feature-multiprocessor-suspend", dom_path), "1", 1);
+ xs_write(ctx->xsh, t, libxl__sprintf(&gc, "%s/control/platform-feature-xs_reset_watches", dom_path), "1", 1);
if (!xs_transaction_end(ctx->xsh, t, 0)) {
if (errno == EAGAIN) {
t = 0;
Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1770,6 +1770,7 @@ class XendDomainInfo:
f('store/port', self.store_port)
f('store/ring-ref', self.store_mfn)
+ f('control/platform-feature-xs_reset_watches', True)
if arch.type == "x86":
f('control/platform-feature-multiprocessor-suspend', True)

View File

@ -0,0 +1,62 @@
changeset: 24566:d5b706214616
user: Olaf Hering <olaf@aepfle.de>
date: Thu Jan 26 11:04:59 2012 +0000
files: tools/libxc/xc_mem_paging.c
description:
tools/libxc: fix error handling in xc_mem_paging_load
xc_mem_paging_load() does not pass errors in errno and the actual
errno from xc_mem_event_control() is overwritten by munlock().
xenpaging_populate_page() needs to check errno, but with the switch to
xc_mem_paging_load() it could not receive ENOMEM anymore.
Update xc_mem_paging_load() to return -1 and preserve errno during
munlock().
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Keir Fraser <keir@xen.org>
---
tools/libxc/xc_mem_paging.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
Index: xen-4.1.2-testing/tools/libxc/xc_mem_paging.c
===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_mem_paging.c
+++ xen-4.1.2-testing/tools/libxc/xc_mem_paging.c
@@ -68,23 +68,28 @@ int xc_mem_paging_prep(xc_interface *xch
int xc_mem_paging_load(xc_interface *xch, domid_t domain_id,
unsigned long gfn, void *buffer)
{
- int rc;
+ int rc, old_errno;
+
+ errno = -EINVAL;
if ( !buffer )
- return -EINVAL;
+ return -1;
if ( ((unsigned long) buffer) & (XC_PAGE_SIZE - 1) )
- return -EINVAL;
+ return -1;
if ( mlock(buffer, XC_PAGE_SIZE) )
- return -errno;
+ return -1;
rc = xc_mem_event_control(xch, domain_id,
XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP,
XEN_DOMCTL_MEM_EVENT_OP_PAGING,
buffer, NULL, gfn);
- (void)munlock(buffer, XC_PAGE_SIZE);
+ old_errno = errno;
+ munlock(buffer, XC_PAGE_SIZE);
+ errno = old_errno;
+
return rc;
}

View File

@ -0,0 +1,33 @@
changeset: 24586:7a28b8b2d3ea
user: Andres Lagar-Cavilla <andres@lagarcavilla.org>
date: Thu Jan 26 13:21:27 2012 +0000
files: xen/arch/x86/mm/p2m.c
description:
x86/mm: Properly account for paged out pages
If we hit the page after nominate but before paging it out, don't decrement the
domain count of paged out pages.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---
xen/arch/x86/mm/p2m.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
@@ -3154,7 +3154,8 @@ int p2m_mem_paging_prep(struct p2m_domai
set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_in, a);
audit_p2m(p2m, 1);
- atomic_dec(&p2m->domain->paged_pages);
+ if ( !page_extant )
+ atomic_dec(&p2m->domain->paged_pages);
ret = 0;
out:

View File

@ -0,0 +1,44 @@
changeset: 24609:cdb1e4a38450
user: Olaf Hering <olaf@aepfle.de>
date: Fri Jan 27 18:32:55 2012 +0000
files: tools/libxc/xc_linux_osdep.c
description:
tools/libxc: handle fallback in linux_privcmd_map_foreign_bulk properly
If the first ioctl fails with ENOENT it means the command is known. If a
second attempt to map each gfn happens to fail then there is no need to
run the fallback code. Some gfns are paged and the fallback code would
not fix the failure. Instead return the EINVAL to the caller.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
tools/libxc/xc_linux_osdep.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: xen-4.1.2-testing/tools/libxc/xc_linux_osdep.c
===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_linux_osdep.c
+++ xen-4.1.2-testing/tools/libxc/xc_linux_osdep.c
@@ -193,6 +193,7 @@ static void *linux_privcmd_map_foreign_b
rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
+ /* Command was recognized, some gfn in arr are in paging state */
if ( rc < 0 && errno == ENOENT )
{
for ( i = rc = 0; rc == 0 && i < num; i++ )
@@ -211,8 +212,8 @@ static void *linux_privcmd_map_foreign_b
} while ( rc < 0 && errno == ENOENT && err[i] == -ENOENT );
}
}
-
- if ( rc < 0 && errno == EINVAL && (int)num > 0 )
+ /* Command was not recognized, use fall back */
+ else if ( rc < 0 && errno == EINVAL && (int)num > 0 )
{
/*
* IOCTL_PRIVCMD_MMAPBATCH_V2 is not supported - fall back to

View File

@ -0,0 +1,39 @@
changeset: 24610:255ae011567d
user: Olaf Hering <olaf@aepfle.de>
date: Fri Jan 27 19:03:37 2012 +0000
files: tools/xenpaging/file_ops.c
description:
xenpaging: make file_op largefile aware
lseek() takes an off_t, the used "int << shiftsize" does not automatically
convert the int into a larger type. This leads to write errors with pagefiles
larger than 2G. Fix this by shifting an off_t instead of an int.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
tools/xenpaging/file_ops.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/file_ops.c
===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/file_ops.c
+++ xen-4.1.2-testing/tools/xenpaging/file_ops.c
@@ -26,12 +26,12 @@
static int file_op(int fd, void *page, int i,
ssize_t (*fn)(int, void *, size_t))
{
- off_t seek_ret;
+ off_t offset = i;
int total = 0;
int bytes;
- seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET);
- if ( seek_ret == (off_t)-1 )
+ offset = lseek(fd, offset << PAGE_SHIFT, SEEK_SET);
+ if ( offset == (off_t)-1 )
return -1;
while ( total < PAGE_SIZE )

View File

@ -2,7 +2,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2930,7 +2930,7 @@ class XendDomainInfo:
@@ -2932,7 +2932,7 @@ class XendDomainInfo:
self.guest_bitsize = self.image.getBitSize()
# Make sure there's enough RAM available for the domain

View File

@ -26,13 +26,13 @@ from YaST) check-mark the "Xen Virtual Machine Host Server" pattern. If,
instead, you wish to install Xen manually later, click on the "Install
Hypervisor and Tools" icon in YaST.
If you want to install and manage VMs graphically, be sure the following
optional packages are also installed:
If you want to install and manage VMs graphically, be sure to install a
graphical desktop environment like KDE or GNOME. The following optional
packages are needed to manage VMs graphically. Note that "Install Hypervisor
and Tools" installs all the packages below:
vm-install (Optional, to install VMs)
python-gtk (Optional, to install VMs graphically)
virt-manager (Optional, to manage VMs graphically)
virt-viewer (Optional, to view VMs outside virt-manager)
tightvnc (Optional, to view VMs outside virt-manager)
Additional packages:
nbd-client (Optional, to access virtual disks stored on NBD servers)
@ -499,6 +499,14 @@ versions will be shipped with SUSE and via YaST Online Update. More frequent
http://forge.novell.com/modules/xfmod/project/?xenpreview
Upgrading the Host Operating System
-----------------------------------
When upgrading the host operating system from one major release to another
(for example, SLES 10 to SLES 11 or openSUSE 11.4 to openSUSE 12.1) or when
applying a service pack like SLES 11 SP2 to SLES 11 SP1 all running VMs must
be shut down before the upgrade process is begun.
Known Issues
------------
For a list of known issues and work-arounds, see

13
blktap-close-fifos.patch Normal file
View File

@ -0,0 +1,13 @@
Index: xen-4.1.2-testing/tools/blktap/drivers/blktapctrl.c
===================================================================
--- xen-4.1.2-testing.orig/tools/blktap/drivers/blktapctrl.c
+++ xen-4.1.2-testing/tools/blktap/drivers/blktapctrl.c
@@ -280,7 +280,7 @@ static int del_disktype(blkif_t *blkif)
* qemu-dm instance. We may close the file handle only if there is
* no other disk left for this domain.
*/
- if (dtypes[type]->use_ioemu)
+ if (dtypes[type]->use_ioemu && dtypes[type]->idnum != DISK_TYPE_AIO)
return !qemu_instance_has_disks(blkif->tappid);
/* Caller should close() if no single controller, or list is empty. */

View File

@ -0,0 +1,27 @@
Index: xen-4.0.2-testing/tools/blktap/drivers/blktapctrl.c
===================================================================
--- xen-4.0.2-testing.orig/tools/blktap/drivers/blktapctrl.c
+++ xen-4.0.2-testing/tools/blktap/drivers/blktapctrl.c
@@ -59,6 +59,9 @@
#include "list.h"
#include "xs_api.h" /* for xs_fire_next_watch() */
+#undef DPRINTF
+#define DPRINTF(_f, _a...) ((void)0)
+
#define PIDFILE "/var/run/blktapctrl.pid"
#define NUM_POLL_FDS 2
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
@@ -48,7 +48,7 @@
#define BLKTAP_CTRL_DIR "/var/run/tap"
/* If enabled, print debug messages to stderr */
-#if 1
+#if 0
#define DPRINTF(_f, _a...) fprintf(stderr, __FILE__ ":%d: " _f, __LINE__, ##_a)
#else
#define DPRINTF(_f, _a...) ((void)0)

View File

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

View File

@ -2,7 +2,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -3130,6 +3130,11 @@ class XendDomainInfo:
@@ -3132,6 +3132,11 @@ class XendDomainInfo:
self._cleanup_phantom_devs(paths)
self._cleanupVm()

View File

@ -0,0 +1,21 @@
Index: xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/e1000.c
===================================================================
--- xen-4.1.2-testing.orig/tools/ioemu-qemu-xen/hw/e1000.c
+++ xen-4.1.2-testing/tools/ioemu-qemu-xen/hw/e1000.c
@@ -444,6 +444,8 @@ process_tx_desc(E1000State *s, struct e1
bytes = split_size;
if (tp->size + bytes > msh)
bytes = msh - tp->size;
+
+ bytes = MIN(sizeof(tp->data) - tp->size, bytes);
cpu_physical_memory_read(addr, tp->data + tp->size, bytes);
if ((sz = tp->size + bytes) >= hdr && tp->size < hdr)
memmove(tp->header, tp->data, hdr);
@@ -459,6 +461,7 @@ process_tx_desc(E1000State *s, struct e1
// context descriptor TSE is not set, while data descriptor TSE is set
DBGOUT(TXERR, "TCP segmentaion Error\n");
} else {
+ split_size = MIN(sizeof(tp->data) - tp->size, split_size);
cpu_physical_memory_read(addr, tp->data + tp->size, split_size);
tp->size += split_size;
}

View File

@ -27,7 +27,7 @@ Index: xen-4.1.2-testing/tools/libxl/xl.c
default:
fprintf(stderr, "unknown global option\n");
exit(2);
@@ -107,6 +111,22 @@ int main(int argc, char **argv)
@@ -107,6 +111,18 @@ int main(int argc, char **argv)
exit(1);
}
opterr = 0;
@ -41,10 +41,6 @@ Index: xen-4.1.2-testing/tools/libxl/xl.c
+ "using libxenlight in\nconjunction with the legacy xend "
+ "toolstack. Use -f (force) to override\n");
+ exit(1);
+ } else {
+ fprintf(stderr, "WARNING: xend is running! It is not recommended "
+ "using libxenlight in\nconjunction with the legacy xend "
+ "toolstack.\n\n");
+ }
+ }

241
ioemu-9868-MSI-X.patch Normal file
View File

@ -0,0 +1,241 @@
# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1324565191 0
# Node ID 11ca857d983420a9f54e4d0e6919f8e6bd5fca48
# Parent 533ebc61dfef98d55f054c97ec30179660214852
qemu: clean up MSI-X table handling
This patch does cleaning up of QEMU MSI handling. The fixes are:
1. Changes made to MSI-X table mapping handling to eliminate the small
windows in which guest could have access to physical MSI-X table.
2. MSI-X table is mapped as read-only to QEMU, as masking of MSI-X is
already in Xen now.
3. For registers that coexists inside the MSI-X table (this could be
only PBA I think), value read from physical page would be returned.
Signed-off-by: Shan Haitao <maillists.shan@gmail.com>
Consolidated duplicate code into _pt_iomem_helper(). Fixed formatting.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Haitao Shan <haitao.shan@intel.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
committer: Ian Jackson <Ian.Jackson@eu.citrix.com>
--- a/tools/ioemu-qemu-xen/hw/pass-through.c
+++ b/tools/ioemu-qemu-xen/hw/pass-through.c
@@ -92,6 +92,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
+#include <assert.h>
extern int gfx_passthru;
int igd_passthru = 0;
@@ -1097,6 +1098,44 @@ uint8_t pci_intx(struct pt_dev *ptdev)
return r_val;
}
+static int _pt_iomem_helper(struct pt_dev *assigned_device, int i,
+ uint32_t e_base, uint32_t e_size, int op)
+{
+ if ( has_msix_mapping(assigned_device, i) )
+ {
+ uint32_t msix_last_pfn = (assigned_device->msix->mmio_base_addr - 1 +
+ assigned_device->msix->total_entries * 16) >> XC_PAGE_SHIFT;
+ uint32_t bar_last_pfn = (e_base + e_size - 1) >> XC_PAGE_SHIFT;
+ int ret = 0;
+
+ if ( assigned_device->msix->table_off )
+ ret = xc_domain_memory_mapping(xc_handle, domid,
+ e_base >> XC_PAGE_SHIFT,
+ assigned_device->bases[i].access.maddr >> XC_PAGE_SHIFT,
+ (assigned_device->msix->mmio_base_addr >> XC_PAGE_SHIFT)
+ - (e_base >> XC_PAGE_SHIFT), op);
+
+ if ( ret == 0 && msix_last_pfn != bar_last_pfn )
+ {
+ assert(msix_last_pfn < bar_last_pfn);
+ ret = xc_domain_memory_mapping(xc_handle, domid,
+ msix_last_pfn + 1,
+ (assigned_device->bases[i].access.maddr +
+ assigned_device->msix->table_off +
+ assigned_device->msix->total_entries * 16 +
+ XC_PAGE_SIZE - 1) >> XC_PAGE_SHIFT,
+ bar_last_pfn - msix_last_pfn, op);
+ }
+
+ return ret;
+ }
+
+ return xc_domain_memory_mapping(xc_handle, domid,
+ e_base >> XC_PAGE_SHIFT,
+ assigned_device->bases[i].access.maddr >> XC_PAGE_SHIFT,
+ (e_size + XC_PAGE_SIZE - 1) >> XC_PAGE_SHIFT, op);
+}
+
/* Being called each time a mmio region has been updated */
static void pt_iomem_map(PCIDevice *d, int i, uint32_t e_phys, uint32_t e_size,
int type)
@@ -1118,13 +1157,11 @@ static void pt_iomem_map(PCIDevice *d, i
if ( !first_map && old_ebase != -1 )
{
- add_msix_mapping(assigned_device, i);
- /* Remove old mapping */
- ret = xc_domain_memory_mapping(xc_handle, domid,
- old_ebase >> XC_PAGE_SHIFT,
- assigned_device->bases[i].access.maddr >> XC_PAGE_SHIFT,
- (e_size+XC_PAGE_SIZE-1) >> XC_PAGE_SHIFT,
- DPCI_REMOVE_MAPPING);
+ if ( has_msix_mapping(assigned_device, i) )
+ unregister_iomem(assigned_device->msix->mmio_base_addr);
+
+ ret = _pt_iomem_helper(assigned_device, i, old_ebase, e_size,
+ DPCI_REMOVE_MAPPING);
if ( ret != 0 )
{
PT_LOG("Error: remove old mapping failed!\n");
@@ -1135,22 +1172,26 @@ static void pt_iomem_map(PCIDevice *d, i
/* map only valid guest address */
if (e_phys != -1)
{
- /* Create new mapping */
- ret = xc_domain_memory_mapping(xc_handle, domid,
- assigned_device->bases[i].e_physbase >> XC_PAGE_SHIFT,
- assigned_device->bases[i].access.maddr >> XC_PAGE_SHIFT,
- (e_size+XC_PAGE_SIZE-1) >> XC_PAGE_SHIFT,
- DPCI_ADD_MAPPING);
+ if ( has_msix_mapping(assigned_device, i) )
+ {
+ assigned_device->msix->mmio_base_addr =
+ assigned_device->bases[i].e_physbase
+ + assigned_device->msix->table_off;
+
+ cpu_register_physical_memory(assigned_device->msix->mmio_base_addr,
+ (assigned_device->msix->total_entries * 16 + XC_PAGE_SIZE - 1)
+ & XC_PAGE_MASK,
+ assigned_device->msix->mmio_index);
+ }
+ ret = _pt_iomem_helper(assigned_device, i, e_phys, e_size,
+ DPCI_ADD_MAPPING);
if ( ret != 0 )
{
PT_LOG("Error: create new mapping failed!\n");
+ return;
}
- ret = remove_msix_mapping(assigned_device, i);
- if ( ret != 0 )
- PT_LOG("Error: remove MSI-X mmio mapping failed!\n");
-
if ( old_ebase != e_phys && old_ebase != -1 )
pt_msix_update_remap(assigned_device, i);
}
--- a/tools/ioemu-qemu-xen/hw/pt-msi.c
+++ b/tools/ioemu-qemu-xen/hw/pt-msi.c
@@ -284,15 +284,6 @@ void pt_disable_msi_translate(struct pt_
dev->msi_trans_en = 0;
}
-/* MSI-X virtulization functions */
-static void mask_physical_msix_entry(struct pt_dev *dev, int entry_nr, int mask)
-{
- void *phys_off;
-
- phys_off = dev->msix->phys_iomem_base + 16 * entry_nr + 12;
- *(uint32_t *)phys_off = mask;
-}
-
static int pt_msix_update_one(struct pt_dev *dev, int entry_nr)
{
struct msix_entry_info *entry = &dev->msix->msix_entry[entry_nr];
@@ -486,7 +477,6 @@ static void pci_msix_writel(void *opaque
{
if ( msix->enabled && !(val & 0x1) )
pt_msix_update_one(dev, entry_nr);
- mask_physical_msix_entry(dev, entry_nr, entry->io_mem[3] & 0x1);
}
}
@@ -519,7 +509,11 @@ static uint32_t pci_msix_readl(void *opa
entry_nr = (addr - msix->mmio_base_addr) / 16;
offset = ((addr - msix->mmio_base_addr) % 16) / 4;
- return msix->msix_entry[entry_nr].io_mem[offset];
+ if ( addr - msix->mmio_base_addr < msix->total_entries * 16 )
+ return msix->msix_entry[entry_nr].io_mem[offset];
+ else
+ return *(uint32_t *)(msix->phys_iomem_base +
+ (addr - msix->mmio_base_addr));
}
static CPUReadMemoryFunc *pci_msix_read[] = {
@@ -528,39 +522,12 @@ static CPUReadMemoryFunc *pci_msix_read[
pci_msix_readl
};
-int add_msix_mapping(struct pt_dev *dev, int bar_index)
+int has_msix_mapping(struct pt_dev *dev, int bar_index)
{
if ( !(dev->msix && dev->msix->bar_index == bar_index) )
return 0;
- return xc_domain_memory_mapping(xc_handle, domid,
- dev->msix->mmio_base_addr >> XC_PAGE_SHIFT,
- (dev->bases[bar_index].access.maddr
- + dev->msix->table_off) >> XC_PAGE_SHIFT,
- (dev->msix->total_entries * 16
- + XC_PAGE_SIZE -1) >> XC_PAGE_SHIFT,
- DPCI_ADD_MAPPING);
-}
-
-int remove_msix_mapping(struct pt_dev *dev, int bar_index)
-{
- if ( !(dev->msix && dev->msix->bar_index == bar_index) )
- return 0;
-
- dev->msix->mmio_base_addr = dev->bases[bar_index].e_physbase
- + dev->msix->table_off;
-
- cpu_register_physical_memory(dev->msix->mmio_base_addr,
- dev->msix->total_entries * 16,
- dev->msix->mmio_index);
-
- return xc_domain_memory_mapping(xc_handle, domid,
- dev->msix->mmio_base_addr >> XC_PAGE_SHIFT,
- (dev->bases[bar_index].access.maddr
- + dev->msix->table_off) >> XC_PAGE_SHIFT,
- (dev->msix->total_entries * 16
- + XC_PAGE_SIZE -1) >> XC_PAGE_SHIFT,
- DPCI_REMOVE_MAPPING);
+ return 1;
}
int pt_msix_init(struct pt_dev *dev, int pos)
@@ -616,7 +583,7 @@ int pt_msix_init(struct pt_dev *dev, int
PT_LOG("table_off = %x, total_entries = %d\n", table_off, total_entries);
dev->msix->table_offset_adjust = table_off & 0x0fff;
dev->msix->phys_iomem_base = mmap(0, total_entries * 16 + dev->msix->table_offset_adjust,
- PROT_WRITE | PROT_READ, MAP_SHARED | MAP_LOCKED,
+ PROT_READ, MAP_SHARED | MAP_LOCKED,
fd, dev->msix->table_base + table_off - dev->msix->table_offset_adjust);
dev->msix->phys_iomem_base = (void *)((char *)dev->msix->phys_iomem_base +
dev->msix->table_offset_adjust);
--- a/tools/ioemu-qemu-xen/hw/pt-msi.h
+++ b/tools/ioemu-qemu-xen/hw/pt-msi.h
@@ -107,10 +107,7 @@ void
pt_msix_disable(struct pt_dev *dev);
int
-remove_msix_mapping(struct pt_dev *dev, int bar_index);
-
-int
-add_msix_mapping(struct pt_dev *dev, int bar_index);
+has_msix_mapping(struct pt_dev *dev, int bar_index);
int
pt_msix_init(struct pt_dev *dev, int pos);

View File

@ -0,0 +1,57 @@
qemu-dm: fix unregister_iomem()
References: bnc#744014
This function (introduced quite a long time ago in
e7911109f4321e9ba0cc56a253b653600aa46bea - "disable qemu PCI
devices in HVM domains") appears to be completely broken, causing
the regression reported in
http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1805 (due to
the newly added caller of it in
56d7747a3cf811910c4cf865e1ebcb8b82502005 - "qemu: clean up
MSI-X table handling"). It's unclear how the function can ever have
fulfilled its purpose: the value returned by iomem_index() is *not* an
index into mmio[].
Additionally, fix two problems:
- unregister_iomem() must not clear mmio[].start, otherwise
cpu_register_physical_memory() won't be able to re-use the previous
slot, thus causing a leak
- cpu_unregister_io_memory() must not check mmio[].size, otherwise it
won't properly clean up entries (temporarily) squashed through
unregister_iomem()
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Yongjie Ren <yongjie.ren@intel.com>
--- a/tools/ioemu-qemu-xen/i386-dm/exec-dm.c
+++ b/tools/ioemu-qemu-xen/i386-dm/exec-dm.c
@@ -360,7 +360,7 @@ void cpu_unregister_io_memory(int io_tab
int io_index = io_table_address >> IO_MEM_SHIFT;
for (i = 0; i < mmio_cnt; i++) {
- if (mmio[i].size && mmio[i].io_index == io_index) {
+ if (mmio[i].io_index == io_index) {
mmio[i].start = mmio[i].size = 0;
break;
}
@@ -466,12 +466,16 @@ static int iomem_index(target_phys_addr_
void unregister_iomem(target_phys_addr_t start)
{
- int index = iomem_index(start);
- if (index) {
+ unsigned int index;
+
+ for (index = 0; index < mmio_cnt; index++)
+ if (start == mmio[index].start)
+ break;
+ if (index < mmio_cnt) {
fprintf(logfile, "squash iomem [%lx, %lx).\n",
(unsigned long)(mmio[index].start),
(unsigned long)(mmio[index].start + mmio[index].size));
- mmio[index].start = mmio[index].size = 0;
+ mmio[index].size = 0;
}
}

17
ipxe-enable-nics.patch Normal file
View File

@ -0,0 +1,17 @@
Index: xen-4.1.2-testing/tools/firmware/etherboot/Config
===================================================================
--- xen-4.1.2-testing.orig/tools/firmware/etherboot/Config
+++ xen-4.1.2-testing/tools/firmware/etherboot/Config
@@ -1,11 +1,8 @@
-NICS = rtl8139 8086100e
+NICS = rtl8139 8086100e eepro100 e1000 pcnet32 10ec8029
CFLAGS += -UPXE_DHCP_STRICT
CFLAGS += -DPXE_DHCP_STRICT
CFLAGS += -UNO_POST_PROMPT
CFLAGS += -DNO_POST_PROMPT
-
-CFLAGS += -UCONSOLE_SERIAL
-CFLAGS += -DCONSOLE_SERIAL=1

75
ipxe-gcc45-warnings.patch Normal file
View File

@ -0,0 +1,75 @@
Index: xen-4.1.2-testing/tools/firmware/etherboot/patches/ipxe-git-f7c5918b179b
===================================================================
--- /dev/null
+++ xen-4.1.2-testing/tools/firmware/etherboot/patches/ipxe-git-f7c5918b179b
@@ -0,0 +1,61 @@
+
+Subject: [drivers] Fix warnings identified by gcc 4.5
+From: Bruce Rogers brogers@novell.com Fri Apr 2 18:16:38 2010 -0600
+Date: Fri Apr 16 07:32:49 2010 -0400:
+Git: f7c5918b179be57fc7f352cb33664eb43de02c30
+
+In building gpxe for openSUSE Factory (part of kvm package), there were
+a few problems identified by the compiler. This patch addresses them.
+
+Signed-off-by: Bruce Rogers <brogers@novell.com>
+Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
+Signed-off-by: Marty Connor <mdc@etherboot.org>
+
+diff --git a/src/drivers/net/ath5k/ath5k_qcu.c b/src/drivers/net/ath5k/ath5k_qcu.c
+index a674b85..cb25029 100644
+--- a/src/drivers/net/ath5k/ath5k_qcu.c
++++ b/src/drivers/net/ath5k/ath5k_qcu.c
+@@ -268,7 +268,7 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah)
+ }
+
+ if (tq->tqi_ready_time &&
+- (tq->tqi_type != AR5K_TX_QUEUE_ID_CAB))
++ (tq->tqi_type != AR5K_TX_QUEUE_CAB))
+ ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_ready_time,
+ AR5K_QCU_RDYTIMECFG_INTVAL) |
+ AR5K_QCU_RDYTIMECFG_ENABLE,
+diff --git a/src/drivers/net/ns83820.c b/src/drivers/net/ns83820.c
+index 44d875f..c5f2153 100644
+--- a/src/drivers/net/ns83820.c
++++ b/src/drivers/net/ns83820.c
+@@ -687,7 +687,7 @@ static int ns83820_poll(struct nic *nic, int retrieve)
+ // rx_ring[entry].link = 0;
+ rx_ring[entry].cmdsts = cpu_to_le32(CMDSTS_OWN);
+
+- ns->cur_rx = ++ns->cur_rx % NR_RX_DESC;
++ ns->cur_rx = (ns->cur_rx + 1) % NR_RX_DESC;
+
+ if (ns->cur_rx == 0) /* We have wrapped the ring */
+ kick_rx();
+diff --git a/src/drivers/net/tulip.c b/src/drivers/net/tulip.c
+index e08e0d8..af30ec6 100644
+--- a/src/drivers/net/tulip.c
++++ b/src/drivers/net/tulip.c
+@@ -1171,7 +1171,7 @@ static int tulip_poll(struct nic *nic, int retrieve)
+ if (rx_ring[tp->cur_rx].status & 0x00008000) {
+ /* return the descriptor and buffer to receive ring */
+ rx_ring[tp->cur_rx].status = 0x80000000;
+- tp->cur_rx = (++tp->cur_rx) % RX_RING_SIZE;
++ tp->cur_rx = (tp->cur_rx + 1) % RX_RING_SIZE;
+ return 0;
+ }
+
+@@ -1180,7 +1180,7 @@ static int tulip_poll(struct nic *nic, int retrieve)
+
+ /* return the descriptor and buffer to receive ring */
+ rx_ring[tp->cur_rx].status = 0x80000000;
+- tp->cur_rx = (++tp->cur_rx) % RX_RING_SIZE;
++ tp->cur_rx = (tp->cur_rx + 1) % RX_RING_SIZE;
+
+ return 1;
+ }
Index: xen-4.1.2-testing/tools/firmware/etherboot/patches/series
===================================================================
--- xen-4.1.2-testing.orig/tools/firmware/etherboot/patches/series
+++ xen-4.1.2-testing/tools/firmware/etherboot/patches/series
@@ -1,3 +1,4 @@
boot_prompt_option.patch
gpxe-git-0edf2405b457
gpxe-git-a803ef3dfeac
+ipxe-git-f7c5918b179b

368
ipxe-ipv4-fragment.patch Normal file
View File

@ -0,0 +1,368 @@
Index: xen-4.1.2-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3
===================================================================
--- /dev/null 2010-05-08 03:31:08.000000000 -0600
+++ xen-4.1.2-testing/tools/firmware/etherboot/patches/ipxe-git-13186b64b6c3 2011-12-19 15:05:32.000000000 -0700
@@ -0,0 +1,354 @@
+commit 13186b64b6c3d5cbe9ed13bda1532e79b1afe81d
+Author: Michael Brown <mcb30@ipxe.org>
+Date: Sat Jul 16 01:15:53 2011 +0100
+
+ [ipv4] Fix fragment reassembly
+
+ Signed-off-by: Michael Brown <mcb30@ipxe.org>
+ Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
+
+diff -up a/src/include/gpxe/ip.h.orig-frag b/src/include/gpxe/ip.h
+--- a/src/include/gpxe/ip.h.orig-frag 2010-02-02 17:12:44.000000000 +0100
++++ b/src/include/gpxe/ip.h 2011-11-18 15:49:17.202660163 +0100
+@@ -32,9 +32,6 @@ struct net_protocol;
+ #define IP_TOS 0
+ #define IP_TTL 64
+
+-#define IP_FRAG_IOB_SIZE 1500
+-#define IP_FRAG_TIMEOUT 50
+-
+ /** An IPv4 packet header */
+ struct iphdr {
+ uint8_t verhdrlen;
+@@ -74,20 +71,16 @@ struct ipv4_miniroute {
+ struct in_addr gateway;
+ };
+
+-/* Fragment reassembly buffer */
+-struct frag_buffer {
+- /* Identification number */
+- uint16_t ident;
+- /* Source network address */
+- struct in_addr src;
+- /* Destination network address */
+- struct in_addr dest;
+- /* Reassembled I/O buffer */
+- struct io_buffer *frag_iob;
+- /* Reassembly timer */
+- struct retry_timer frag_timer;
++/* IPv4 fragment reassembly buffer */
++struct ipv4_fragment {
+ /* List of fragment reassembly buffers */
+ struct list_head list;
++ /** Reassembled packet */
++ struct io_buffer *iobuf;
++ /** Current offset */
++ size_t offset;
++ /** Reassembly timer */
++ struct retry_timer timer;
+ };
+
+ extern struct list_head ipv4_miniroutes;
+diff -up a/src/include/gpxe/retry.h.orig-frag b/src/include/gpxe/retry.h
+--- a/src/include/gpxe/retry.h.orig-frag 2010-02-02 17:12:44.000000000 +0100
++++ b/src/include/gpxe/retry.h 2011-11-18 15:59:25.258837891 +0100
+@@ -51,6 +51,19 @@ struct retry_timer {
+ void ( * expired ) ( struct retry_timer *timer, int over );
+ };
+
++/**
++ * Initialise a timer
++ *
++ * @v timer Retry timer
++ * @v expired Timer expired callback
++ */
++static inline __attribute__ (( always_inline )) void
++timer_init ( struct retry_timer *timer,
++ void ( * expired ) ( struct retry_timer *timer, int over ) )
++{
++ timer->expired = expired;
++}
++
+ extern void start_timer ( struct retry_timer *timer );
+ extern void start_timer_fixed ( struct retry_timer *timer,
+ unsigned long timeout );
+diff -up a/src/net/ipv4.c.orig-frag b/src/net/ipv4.c
+--- a/src/net/ipv4.c.orig-frag 2010-02-02 17:12:44.000000000 +0100
++++ b/src/net/ipv4.c 2011-11-18 15:49:17.203660142 +0100
+@@ -14,6 +14,7 @@
+ #include <gpxe/tcpip.h>
+ #include <gpxe/dhcp.h>
+ #include <gpxe/settings.h>
++#include <gpxe/timer.h>
+
+ /** @file
+ *
+@@ -32,7 +33,10 @@ struct net_protocol ipv4_protocol;
+ struct list_head ipv4_miniroutes = LIST_HEAD_INIT ( ipv4_miniroutes );
+
+ /** List of fragment reassembly buffers */
+-static LIST_HEAD ( frag_buffers );
++static LIST_HEAD ( ipv4_fragments );
++
++/** Fragment reassembly timeout */
++#define IP_FRAG_TIMEOUT ( TICKS_PER_SEC / 2 )
+
+ /**
+ * Add IPv4 minirouting table entry
+@@ -134,104 +138,126 @@ static struct ipv4_miniroute * ipv4_rout
+ }
+
+ /**
+- * Fragment reassembly counter timeout
++ * Expire fragment reassembly buffer
+ *
+- * @v timer Retry timer
+- * @v over If asserted, the timer is greater than @c MAX_TIMEOUT
++ * @v timer Retry timer
++ * @v fail Failure indicator
+ */
+-static void ipv4_frag_expired ( struct retry_timer *timer __unused,
+- int over ) {
+- if ( over ) {
+- DBG ( "Fragment reassembly timeout" );
+- /* Free the fragment buffer */
+- }
++static void ipv4_fragment_expired ( struct retry_timer *timer,
++ int fail __unused ) {
++ struct ipv4_fragment *frag =
++ container_of ( timer, struct ipv4_fragment, timer );
++ struct iphdr *iphdr = frag->iobuf->data;
++
++ DBG ( "IPv4 fragment %04x expired\n", ntohs ( iphdr->ident ) );
++ free_iob ( frag->iobuf );
++ list_del ( &frag->list );
++ free ( frag );
+ }
+
+ /**
+- * Free fragment buffer
++ * Find matching fragment reassembly buffer
+ *
+- * @v fragbug Fragment buffer
++ * @v iphdr IPv4 header
++ * @ret frag Fragment reassembly buffer, or NULL
+ */
+-static void free_fragbuf ( struct frag_buffer *fragbuf ) {
+- free ( fragbuf );
++static struct ipv4_fragment * ipv4_fragment ( struct iphdr *iphdr ) {
++ struct ipv4_fragment *frag;
++ struct iphdr *frag_iphdr;
++
++ list_for_each_entry ( frag, &ipv4_fragments, list ) {
++ frag_iphdr = frag->iobuf->data;
++
++ if ( ( iphdr->src.s_addr == frag_iphdr->src.s_addr ) &&
++ ( iphdr->ident == frag_iphdr->ident ) ) {
++ return frag;
++ }
++ }
++
++ return NULL;
+ }
+
+ /**
+ * Fragment reassembler
+ *
+- * @v iobuf I/O buffer, fragment of the datagram
+- * @ret frag_iob Reassembled packet, or NULL
++ * @v iobuf I/O buffer
++ * @ret iobuf Reassembled packet, or NULL
+ */
+-static struct io_buffer * ipv4_reassemble ( struct io_buffer * iobuf ) {
++static struct io_buffer * ipv4_reassemble ( struct io_buffer *iobuf ) {
+ struct iphdr *iphdr = iobuf->data;
+- struct frag_buffer *fragbuf;
+-
+- /**
+- * Check if the fragment belongs to any fragment series
+- */
+- list_for_each_entry ( fragbuf, &frag_buffers, list ) {
+- if ( fragbuf->ident == iphdr->ident &&
+- fragbuf->src.s_addr == iphdr->src.s_addr ) {
+- /**
+- * Check if the packet is the expected fragment
+- *
+- * The offset of the new packet must be equal to the
+- * length of the data accumulated so far (the length of
+- * the reassembled I/O buffer
+- */
+- if ( iob_len ( fragbuf->frag_iob ) ==
+- ( iphdr->frags & IP_MASK_OFFSET ) ) {
+- /**
+- * Append the contents of the fragment to the
+- * reassembled I/O buffer
+- */
+- iob_pull ( iobuf, sizeof ( *iphdr ) );
+- memcpy ( iob_put ( fragbuf->frag_iob,
+- iob_len ( iobuf ) ),
+- iobuf->data, iob_len ( iobuf ) );
+- free_iob ( iobuf );
+-
+- /** Check if the fragment series is over */
+- if ( ! ( iphdr->frags & IP_MASK_MOREFRAGS ) ) {
+- iobuf = fragbuf->frag_iob;
+- free_fragbuf ( fragbuf );
+- return iobuf;
+- }
+-
+- } else {
+- /* Discard the fragment series */
+- free_fragbuf ( fragbuf );
+- free_iob ( iobuf );
+- }
+- return NULL;
++ size_t offset = ( ( ntohs ( iphdr->frags ) & IP_MASK_OFFSET ) << 3 );
++ unsigned int more_frags = ( iphdr->frags & htons ( IP_MASK_MOREFRAGS ));
++ size_t hdrlen = ( ( iphdr->verhdrlen & IP_MASK_HLEN ) * 4 );
++ struct ipv4_fragment *frag;
++ size_t expected_offset;
++ struct io_buffer *new_iobuf;
++
++ /* Find matching fragment reassembly buffer, if any */
++ frag = ipv4_fragment ( iphdr );
++
++ /* Drop out-of-order fragments */
++ expected_offset = ( frag ? frag->offset : 0 );
++ if ( offset != expected_offset ) {
++ DBG ( "IPv4 dropping out-of-sequence fragment %04x (%zd+%zd, "
++ "expected %zd)\n", ntohs ( iphdr->ident ), offset,
++ ( iob_len ( iobuf ) - hdrlen ), expected_offset );
++ goto drop;
++ }
++
++ /* Create or extend fragment reassembly buffer as applicable */
++ if ( frag == NULL ) {
++
++ /* Create new fragment reassembly buffer */
++ frag = zalloc ( sizeof ( *frag ) );
++ if ( ! frag )
++ goto drop;
++ list_add ( &frag->list, &ipv4_fragments );
++ frag->iobuf = iobuf;
++ frag->offset = ( iob_len ( iobuf ) - hdrlen );
++ timer_init ( &frag->timer, ipv4_fragment_expired );
++
++ } else {
++
++ /* Extend reassembly buffer */
++ iob_pull ( iobuf, hdrlen );
++ new_iobuf = alloc_iob ( iob_len ( frag->iobuf ) +
++ iob_len ( iobuf ) );
++ if ( ! new_iobuf ) {
++ DBG ( "IPv4 could not extend reassembly buffer to "
++ "%zd bytes\n",
++ ( iob_len ( frag->iobuf ) + iob_len ( iobuf ) ) );
++ goto drop;
+ }
+- }
+-
+- /** Check if the fragment is the first in the fragment series */
+- if ( iphdr->frags & IP_MASK_MOREFRAGS &&
+- ( ( iphdr->frags & IP_MASK_OFFSET ) == 0 ) ) {
+-
+- /** Create a new fragment buffer */
+- fragbuf = ( struct frag_buffer* ) malloc ( sizeof( *fragbuf ) );
+- fragbuf->ident = iphdr->ident;
+- fragbuf->src = iphdr->src;
+-
+- /* Set up the reassembly I/O buffer */
+- fragbuf->frag_iob = alloc_iob ( IP_FRAG_IOB_SIZE );
+- iob_pull ( iobuf, sizeof ( *iphdr ) );
+- memcpy ( iob_put ( fragbuf->frag_iob, iob_len ( iobuf ) ),
++ memcpy ( iob_put ( new_iobuf, iob_len ( frag->iobuf ) ),
++ frag->iobuf->data, iob_len ( frag->iobuf ) );
++ memcpy ( iob_put ( new_iobuf, iob_len ( iobuf ) ),
+ iobuf->data, iob_len ( iobuf ) );
++ free_iob ( frag->iobuf );
++ frag->iobuf = new_iobuf;
++ frag->offset += iob_len ( iobuf );
+ free_iob ( iobuf );
++ iphdr = frag->iobuf->data;
++ iphdr->len = ntohs ( iob_len ( frag->iobuf ) );
+
+- /* Set the reassembly timer */
+- fragbuf->frag_timer.timeout = IP_FRAG_TIMEOUT;
+- fragbuf->frag_timer.expired = ipv4_frag_expired;
+- start_timer ( &fragbuf->frag_timer );
++ /* Stop fragment reassembly timer */
++ stop_timer ( &frag->timer );
+
+- /* Add the fragment buffer to the list of fragment buffers */
+- list_add ( &fragbuf->list, &frag_buffers );
++ /* If this is the final fragment, return it */
++ if ( ! more_frags ) {
++ iobuf = frag->iobuf;
++ list_del ( &frag->list );
++ free ( frag );
++ return iobuf;
++ }
+ }
+-
++
++ /* (Re)start fragment reassembly timer */
++ start_timer_fixed ( &frag->timer, IP_FRAG_TIMEOUT );
++
++ return NULL;
++
++ drop:
++ free_iob ( iobuf );
+ return NULL;
+ }
+
+@@ -432,37 +458,38 @@ static int ipv4_rx ( struct io_buffer *i
+ goto err;
+ }
+
++ /* Truncate packet to correct length */
++ iob_unput ( iobuf, ( iob_len ( iobuf ) - len ) );
++
+ /* Print IPv4 header for debugging */
+ DBG ( "IPv4 RX %s<-", inet_ntoa ( iphdr->dest ) );
+ DBG ( "%s len %d proto %d id %04x csum %04x\n",
+ inet_ntoa ( iphdr->src ), ntohs ( iphdr->len ), iphdr->protocol,
+ ntohs ( iphdr->ident ), ntohs ( iphdr->chksum ) );
+
+- /* Truncate packet to correct length, calculate pseudo-header
+- * checksum and then strip off the IPv4 header.
+- */
+- iob_unput ( iobuf, ( iob_len ( iobuf ) - len ) );
+- pshdr_csum = ipv4_pshdr_chksum ( iobuf, TCPIP_EMPTY_CSUM );
+- iob_pull ( iobuf, hdrlen );
+-
+- /* Fragment reassembly */
+- if ( ( iphdr->frags & htons ( IP_MASK_MOREFRAGS ) ) ||
+- ( ( iphdr->frags & htons ( IP_MASK_OFFSET ) ) != 0 ) ) {
+- /* Pass the fragment to ipv4_reassemble() which either
+- * returns a fully reassembled I/O buffer or NULL.
++ /* Perform fragment reassembly if applicable */
++ if ( iphdr->frags & htons ( IP_MASK_OFFSET | IP_MASK_MOREFRAGS ) ) {
++ /* Pass the fragment to ipv4_reassemble() which returns
++ * either a fully reassembled I/O buffer or NULL.
+ */
+ iobuf = ipv4_reassemble ( iobuf );
+ if ( ! iobuf )
+ return 0;
++ iphdr = iobuf->data;
++ hdrlen = ( ( iphdr->verhdrlen & IP_MASK_HLEN ) * 4 );
+ }
+
+- /* Construct socket addresses and hand off to transport layer */
++ /* Construct socket addresses, calculate pseudo-header
++ * checksum, and hand off to transport layer
++ */
+ memset ( &src, 0, sizeof ( src ) );
+ src.sin.sin_family = AF_INET;
+ src.sin.sin_addr = iphdr->src;
+ memset ( &dest, 0, sizeof ( dest ) );
+ dest.sin.sin_family = AF_INET;
+ dest.sin.sin_addr = iphdr->dest;
++ pshdr_csum = ipv4_pshdr_chksum ( iobuf, TCPIP_EMPTY_CSUM );
++ iob_pull ( iobuf, hdrlen );
+ if ( ( rc = tcpip_rx ( iobuf, iphdr->protocol, &src.st,
+ &dest.st, pshdr_csum ) ) != 0 ) {
+ DBG ( "IPv4 received packet rejected by stack: %s\n",
Index: xen-4.1.2-testing/tools/firmware/etherboot/patches/series
===================================================================
--- xen-4.1.2-testing.orig/tools/firmware/etherboot/patches/series
+++ xen-4.1.2-testing/tools/firmware/etherboot/patches/series
@@ -2,3 +2,4 @@ boot_prompt_option.patch
gpxe-git-0edf2405b457
gpxe-git-a803ef3dfeac
ipxe-git-f7c5918b179b
+ipxe-git-13186b64b6c3

View File

@ -1,3 +1,3 @@
%defattr (-,root,root)
/lib/modules/%2-%1
/etc/modprobe.d/xen_pvdrivers.conf
/etc/modprobe.d/xen_pvdrivers-%1.conf

View File

@ -18,7 +18,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
xc = xen.lowlevel.xc.xc()
xoptions = XendOptions.instance()
@@ -3299,33 +3299,38 @@ class XendDomainInfo:
@@ -3301,33 +3301,38 @@ class XendDomainInfo:
# This is a file, not a device. pygrub can cope with a
# file if it's raw, but if it's QCOW or other such formats
# used through blktap, then we need to mount it first.

View File

@ -699,7 +699,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
self._endRestore()
except:
log.exception('VM resume failed')
@@ -2369,7 +2367,7 @@ class XendDomainInfo:
@@ -2371,7 +2369,7 @@ class XendDomainInfo:
return self.getDeviceController(deviceClass).reconfigureDevice(
devid, devconfig)
@ -708,7 +708,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
"""Create the devices for a vm.
@raise: VmError for invalid devices
@@ -2418,7 +2416,7 @@ class XendDomainInfo:
@@ -2420,7 +2418,7 @@ class XendDomainInfo:
if self.image:
@ -717,7 +717,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
#if have pass-through devs, need the virtual pci slots info from qemu
self.pci_device_configure_boot()
@@ -3044,7 +3042,7 @@ class XendDomainInfo:
@@ -3046,7 +3044,7 @@ class XendDomainInfo:
self._introduceDomain()
self.image = image.create(self, self.info)
if self.image:

View File

@ -22,4 +22,4 @@ Index: xen-4.1.2-testing/tools/hotplug/Linux/init.d/xencommons
+
if ! `xenstore-read -s / >/dev/null 2>&1`
then
test -z "$XENSTORED_ROOTDIR" || XENSTORED_ROOTDIR="/var/lib/xenstored"
test -z "$XENSTORED_ROOTDIR" && XENSTORED_ROOTDIR="/var/lib/xenstored"

View File

@ -1,22 +0,0 @@
Index: xen-4.0.2-testing/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in
===================================================================
--- xen-4.0.2-testing.orig/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in
+++ xen-4.0.2-testing/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in
@@ -90,7 +90,7 @@ INCLUDE_CFLAGS = -I. -I${srcdir} -I$(src
GLOBAL_CFLAGS = ${MT_CFLAGS} ${MH_CFLAGS}
#PROFILE_CFLAGS = -pg
-WARN_CFLAGS = -Wall
+WARN_CFLAGS = -Wall -Wno-sequence-point
# CFLAGS is specifically reserved for setting from the command line
# when running make. I.E. "make CFLAGS=-Wmissing-prototypes".
@@ -260,7 +260,7 @@ linux-low.o: linux-low.c $(linux_low_h)
$(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< @USE_THREAD_DB@
linux-xen-low.o: linux-xen-low.c $(linux_low_h) $(server_h)
- $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< @USE_THREAD_DB@
+ $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) -I../../../../../include/ $< @USE_THREAD_DB@
linux-arm-low.o: linux-arm-low.c $(linux_low_h) $(server_h)
linux-i386-low.o: linux-i386-low.c $(linux_low_h) $(server_h)

View File

@ -1,7 +1,5 @@
Index: xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/platform_hypercall.c
+++ xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -23,7 +23,7 @@
#include <xen/cpu.h>
#include <asm/current.h>
@ -11,20 +9,18 @@ Index: xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c
#include <asm/edd.h>
#include <asm/mtrr.h>
#include <asm/io_apic.h>
@@ -63,6 +63,7 @@ long cpu_down_helper(void *data);
ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
{
ret_t ret = 0;
+ struct vcpu *v;
struct xen_platform_op curop, *op = &curop;
if ( !IS_PRIV(current->domain) )
@@ -522,6 +523,24 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
@@ -565,6 +565,42 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
op->u.mem_add.epfn,
op->u.mem_add.pxm);
break;
+
+ case XENPF_get_cpu_freq:
+ case XENPF_get_cpu_freq_min:
+ case XENPF_get_cpu_freq_max:
+ {
+ struct vcpu *v;
+ const struct cpufreq_policy *policy;
+
+ if ( op->u.get_cpu_freq.vcpu >= current->domain->max_vcpus ||
+ !(v = current->domain->vcpu[op->u.get_cpu_freq.vcpu]) )
+ {
@ -32,27 +28,39 @@ Index: xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c
+ break;
+ }
+
+ op->u.get_cpu_freq.freq = per_cpu(cpufreq_cpu_policy, v->processor)
+ ? cpufreq_driver->get
+ ? cpufreq_driver->get(v->processor)
+ : per_cpu(cpufreq_cpu_policy, v->processor)->cur
+ : 0;
+ policy = per_cpu(cpufreq_cpu_policy, v->processor);
+ switch ( op->cmd & -!!policy )
+ {
+ case XENPF_get_cpu_freq:
+ op->u.get_cpu_freq.freq = policy->cur;
+ break;
+ case XENPF_get_cpu_freq_min:
+ op->u.get_cpu_freq.freq = policy->min;
+ break;
+ case XENPF_get_cpu_freq_max:
+ op->u.get_cpu_freq.freq = policy->max;
+ break;
+ default:
+ op->u.get_cpu_freq.freq = 0;
+ break;
+ }
+ if ( copy_field_to_guest(u_xenpf_op, op, u.get_cpu_freq.freq) )
+ ret = -EFAULT;
+ break;
+ }
+ break;
+
default:
ret = -ENOSYS;
break;
Index: xen-4.1.2-testing/xen/include/public/platform.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/public/platform.h
+++ xen-4.1.2-testing/xen/include/public/platform.h
@@ -451,6 +451,14 @@ struct xenpf_mem_hotadd
--- a/xen/include/public/platform.h
+++ b/xen/include/public/platform.h
@@ -466,6 +466,16 @@ struct xenpf_mem_hotadd
uint32_t flags;
};
+#define XENPF_get_cpu_freq ('N' << 24)
+#define XENPF_get_cpu_freq_min (XENPF_get_cpu_freq + 1)
+#define XENPF_get_cpu_freq_max (XENPF_get_cpu_freq_min + 1)
+struct xenpf_get_cpu_freq {
+ /* IN variables */
+ uint32_t vcpu;
@ -63,7 +71,7 @@ Index: xen-4.1.2-testing/xen/include/public/platform.h
struct xen_platform_op {
uint32_t cmd;
uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
@@ -471,6 +479,7 @@ struct xen_platform_op {
@@ -487,6 +497,7 @@ struct xen_platform_op {
struct xenpf_cpu_ol cpu_ol;
struct xenpf_cpu_hotadd cpu_add;
struct xenpf_mem_hotadd mem_add;

View File

@ -1,8 +1,6 @@
Index: xen-4.1.2-testing/Config.mk
===================================================================
--- xen-4.1.2-testing.orig/Config.mk
+++ xen-4.1.2-testing/Config.mk
@@ -177,7 +177,7 @@ endif
--- a/Config.mk
+++ b/Config.mk
@@ -178,7 +178,7 @@ endif
# 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.
# CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
@ -11,7 +9,7 @@ Index: xen-4.1.2-testing/Config.mk
QEMU_TAG := xen-4.1.2
#QEMU_TAG ?= e073e69457b4d99b6da0b6536296e3498f7f6599
@@ -187,7 +187,7 @@ QEMU_TAG := xen-4.1.2
@@ -188,7 +188,7 @@ QEMU_TAG := xen-4.1.2
# Optional components
XENSTAT_XENTOP ?= y
VTPM_TOOLS ?= n
@ -20,10 +18,8 @@ Index: xen-4.1.2-testing/Config.mk
PYTHON_TOOLS ?= y
OCAML_TOOLS ?= y
CONFIG_MINITERM ?= n
Index: xen-4.1.2-testing/tools/Makefile
===================================================================
--- xen-4.1.2-testing.orig/tools/Makefile
+++ xen-4.1.2-testing/tools/Makefile
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -79,14 +79,16 @@ IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TAR
--interp-prefix=$(CROSS_SYS_ROOT)
endif
@ -54,10 +50,8 @@ Index: xen-4.1.2-testing/tools/Makefile
.PHONY: ioemu-dir-force-update
ioemu-dir-force-update:
Index: xen-4.1.2-testing/tools/libxc/Makefile
===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/Makefile
+++ xen-4.1.2-testing/tools/libxc/Makefile
--- a/tools/libxc/Makefile
+++ b/tools/libxc/Makefile
@@ -195,7 +195,7 @@ xc_dom_bzimageloader.opic: CFLAGS += $(c
libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(call zlib-options,l)
@ -67,10 +61,8 @@ Index: xen-4.1.2-testing/tools/libxc/Makefile
xenctrl_osdep_ENOSYS.so: $(OSDEP_PIC_OBJS) libxenctrl.so
$(CC) -g $(CFLAGS) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $(OSDEP_PIC_OBJS) -lxenctrl
Index: xen-4.1.2-testing/tools/firmware/etherboot/Makefile
===================================================================
--- xen-4.1.2-testing.orig/tools/firmware/etherboot/Makefile
+++ xen-4.1.2-testing/tools/firmware/etherboot/Makefile
--- a/tools/firmware/etherboot/Makefile
+++ b/tools/firmware/etherboot/Makefile
@@ -35,11 +35,13 @@ eb-roms.h: Config
mv -f $@.new $@

View File

@ -79,7 +79,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.1.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2332,6 +2332,10 @@ class XendDomainInfo:
@@ -2333,6 +2333,10 @@ class XendDomainInfo:
deviceClass, config = self.info['devices'].get(dev_uuid)
self._waitForDevice(deviceClass, config['devid'])
@ -90,7 +90,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
def _waitForDevice_destroy(self, deviceClass, devid, backpath):
return self.getDeviceController(deviceClass).waitForDevice_destroy(
devid, backpath)
@@ -3277,7 +3281,8 @@ class XendDomainInfo:
@@ -3278,7 +3282,8 @@ class XendDomainInfo:
from xen.xend import XendDomain
dom0 = XendDomain.instance().privilegedDomain()
mounted_vbd_uuid = dom0.create_vbd(vbd, disk);
@ -100,7 +100,7 @@ Index: xen-4.1.2-testing/tools/python/xen/xend/XendDomainInfo.py
fn = BOOTLOADER_LOOPBACK_DEVICE
try:
@@ -3287,10 +3292,10 @@ class XendDomainInfo:
@@ -3288,10 +3293,10 @@ class XendDomainInfo:
if mounted:
log.info("Unmounting %s from %s." %
(fn, BOOTLOADER_LOOPBACK_DEVICE))

View File

@ -0,0 +1,110 @@
# HG changeset patch
# Parent aa0d678fece208975984e8e59ca223c07fc50c06
tools/libxc: send page-in requests in batches in linux_privcmd_map_foreign_bulk
One of the bottlenecks with foreign page-in request is the poor retry
handling in linux_privcmd_map_foreign_bulk(). It sends one request per
paged gfn at a time and it waits until the gfn is accessible. This
causes long delays in mmap requests from qemu-dm and xc_save.
Instead of sending one request at a time, walk the entire gfn list and
send batches of mmap requests. They will eventually end up in the pagers
request ring (if it has room again), and will fill up this ring so that
in turn the pager can also process page-in in batches.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
tools/libxc/xc_linux_osdep.c | 72 ++++++++++++++++++++++++++++++++++---------
1 file changed, 57 insertions(+), 15 deletions(-)
Index: xen-4.1.2-testing/tools/libxc/xc_linux_osdep.c
===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_linux_osdep.c
+++ xen-4.1.2-testing/tools/libxc/xc_linux_osdep.c
@@ -167,6 +167,59 @@ static void *linux_privcmd_map_foreign_b
return addr;
}
+/*
+ * Retry mmap of paged gfns in batches
+ * retuns < 0 on fatal error
+ * returns 0 if all gfns left paging state
+ * returns > 0 if some gfns are still in paging state
+ *
+ * Walk all gfns are assemble blocks of gfns in paging state.
+ * This will keep the request ring full and avoids delays.
+ */
+static int retry_paged(int fd, uint32_t dom, void *addr,
+ const xen_pfn_t *arr, int *err, unsigned int num)
+{
+ privcmd_mmapbatch_v2_t ioctlx;
+ int rc, paged = 0, i = 0;
+
+ do
+ {
+ /* Skip gfns not in paging state */
+ if ( err[i] != -ENOENT )
+ {
+ i++;
+ continue;
+ }
+
+ paged++;
+
+ /* At least one gfn is still in paging state */
+ ioctlx.num = 1;
+ ioctlx.dom = dom;
+ ioctlx.addr = (unsigned long)addr + ((unsigned long)i<<XC_PAGE_SHIFT);
+ ioctlx.arr = arr + i;
+ ioctlx.err = err + i;
+
+ /* Assemble a batch of requests */
+ while ( ++i < num )
+ {
+ if ( err[i] != -ENOENT )
+ break;
+ ioctlx.num++;
+ }
+
+ /* Send request and abort on fatal error */
+ rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
+ if ( rc < 0 && errno != ENOENT )
+ goto out;
+
+ } while ( i < num );
+
+ rc = paged;
+out:
+ return rc;
+}
+
static void *linux_privcmd_map_foreign_bulk(xc_interface *xch, xc_osdep_handle h,
uint32_t dom, int prot,
const xen_pfn_t *arr, int *err, unsigned int num)
@@ -196,21 +249,10 @@ static void *linux_privcmd_map_foreign_b
/* Command was recognized, some gfn in arr are in paging state */
if ( rc < 0 && errno == ENOENT )
{
- for ( i = rc = 0; rc == 0 && i < num; i++ )
- {
- if ( err[i] != -ENOENT )
- continue;
-
- ioctlx.num = 1;
- ioctlx.dom = dom;
- ioctlx.addr = (unsigned long)addr + ((unsigned long)i<<XC_PAGE_SHIFT);
- ioctlx.arr = arr + i;
- ioctlx.err = err + i;
- do {
- usleep(100);
- rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
- } while ( rc < 0 && errno == ENOENT && err[i] == -ENOENT );
- }
+ do {
+ usleep(100);
+ rc = retry_paged(fd, dom, addr, arr, err, num);
+ } while ( rc > 0 );
}
/* Command was not recognized, use fall back */
else if ( rc < 0 && errno == EINVAL && (int)num > 0 )

View File

@ -12,7 +12,9 @@ usage () {
exit $R_USAGE
}
xm_cmd="xl -f"
xm_cmd="xm"
pidof -x /usr/sbin/xend >/dev/null 2>&1 || xm_cmd="xl"
######################################################################
# change the working direcory and source some common files
#

View File

@ -250,17 +250,6 @@
u8 bus, slot, func;
dev = entry->dev;
--- a/xen/arch/x86/microcode_amd.c
+++ b/xen/arch/x86/microcode_amd.c
@@ -150,7 +150,7 @@ static int apply_microcode(int cpu)
static int get_next_ucode_from_buffer_amd(void *mc, const void *buf,
size_t size, unsigned long *offset)
{
- struct microcode_header_amd *mc_header;
+ struct microcode_header_amd __attribute__((__unused__)) *mc_header;
size_t total_size;
const uint8_t *bufp = buf;
unsigned long off;
--- a/xen/common/cpupool.c
+++ b/xen/common/cpupool.c
@@ -356,7 +356,7 @@ int cpupool_add_domain(struct domain *d,
@ -296,7 +285,7 @@
--- a/xen/common/kexec.c
+++ b/xen/common/kexec.c
@@ -569,7 +569,8 @@ static int kexec_exec(XEN_GUEST_HANDLE(v
@@ -573,7 +573,8 @@ static int kexec_exec(XEN_GUEST_HANDLE(v
{
xen_kexec_exec_t exec;
xen_kexec_image_t *image;
@ -374,7 +363,7 @@
unsigned long long value;
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -2338,7 +2338,7 @@ p2m_remove_page(struct p2m_domain *p2m,
@@ -2339,7 +2339,7 @@ p2m_remove_page(struct p2m_domain *p2m,
unsigned int page_order)
{
unsigned long i;
@ -383,7 +372,7 @@
p2m_type_t t;
p2m_access_t a;
@@ -2407,7 +2407,7 @@ guest_physmap_mark_populate_on_demand(st
@@ -2408,7 +2408,7 @@ guest_physmap_mark_populate_on_demand(st
struct p2m_domain *p2m = p2m_get_hostp2m(d);
unsigned long i;
p2m_type_t ot;
@ -426,7 +415,7 @@
{
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -275,7 +275,7 @@ static void acpi_processor_ffh_cstate_en
@@ -276,7 +276,7 @@ static void acpi_processor_ffh_cstate_en
static void acpi_idle_do_entry(struct acpi_processor_cx *cx)
{
@ -471,7 +460,7 @@
union hypercall_input {
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4906,7 +4906,7 @@ static int ptwr_emulated_update(
@@ -4914,7 +4914,7 @@ static int ptwr_emulated_update(
{
unsigned long mfn;
unsigned long unaligned_addr = addr;
@ -591,7 +580,7 @@
if ( tmh->persistent_pool == NULL )
--- a/xen/arch/x86/cpu/mcheck/vmce.c
+++ b/xen/arch/x86/cpu/mcheck/vmce.c
@@ -574,7 +574,7 @@ int is_vmce_ready(struct mcinfo_bank *ba
@@ -571,7 +571,7 @@ int is_vmce_ready(struct mcinfo_bank *ba
*/
int unmmap_broken_page(struct domain *d, mfn_t mfn, unsigned long gfn)
{
@ -634,7 +623,7 @@
case 3: /* x86_32p */
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1854,7 +1854,11 @@ static int emulate_privileged_op(struct
@@ -1858,7 +1858,11 @@ static int emulate_privileged_op(struct
struct vcpu *v = current;
unsigned long *reg, eip = regs->eip;
u8 opcode, modrm_reg = 0, modrm_rm = 0, rep_prefix = 0, lock = 0, rex = 0;

View File

@ -1,3 +1,370 @@
-------------------------------------------------------------------
Thu Feb 2 17:11:28 MST 2012 - jfehlig@suse.com
- bnc#743414 - using vifname is ignored when defining a xen virtual
interface with xl/libxl
24459-libxl-vifname.patch
-------------------------------------------------------------------
Thu Feb 2 09:21:01 MST 2012 - carnold@novell.com
- bnc#740165 - VUL-0: kvm: qemu heap overflow in e1000 device
emulation (applicable to Xen qemu - CVE-2012-0029)
cve-2012-0029-qemu-xen-unstable.patch
-------------------------------------------------------------------
Wed Feb 1 08:26:58 MST 2012 - carnold@novell.com
- bnc#744014 - blank screen in SLES11 SP2 guest with a VF statically
assigned
ioemu-MSI-X-fix-unregister_iomem.patch
- Upstream patches from Jan
24453-x86-vIRQ-IRR-TMR-race.patch
24456-x86-emul-lea.patch
-------------------------------------------------------------------
Thu Jan 26 15:18:54 CET 2012 - ohering@suse.de
- fate#310510 - fix xenpaging
24586-x86-mm_Properly_account_for_paged_out_pages.patch
24609-tools-libxc_handle_fallback_in_linux_privcmd_map_foreign_bulk_properly.patch
24610-xenpaging_make_file_op_largefile_aware.patch
xen-unstable.misc.linux_privcmd_map_foreign_bulk.retry_paged.patch
xenpaging.speedup-page-out.resume_pages.find_next_bit_set.patch
xenpaging.speedup-page-out.evict_pages.free_slot_stack.patch
xenpaging.speedup-page-out.policy_choose_victim.patch
update xenpaging.error-handling.patch, flush qemu cache not so often
-------------------------------------------------------------------
Thu Jan 26 13:24:22 CET 2012 - ohering@suse.de
- fate#310510 - fix xenpaging
24566-tools-libxc_fix_error_handling_in_xc_mem_paging_load.patch
-------------------------------------------------------------------
Tue Jan 24 15:43:27 CET 2012 - ohering@suse.de
- fate#310510 - fix xenpaging
24466-libxc_Only_retry_mapping_pages_when_ENOENT_is_returned.patch
-------------------------------------------------------------------
Mon Jan 23 13:41:42 MST 2012 - carnold@novell.com
- The xen kmp packages fail on the 09-check-packaged-twice script.
Rename xen_pvdrivers.conf to xen_pvdrivers-<kernel flavor>.conf
-------------------------------------------------------------------
Fri Jan 20 21:28:42 CET 2012 - ohering@suse.de
- fate#310510 - fix xenpaging
xenpaging.speedup-page-in.gfn_to_slot.patch
-------------------------------------------------------------------
Wed Jan 18 09:42:54 MST 2012 - carnold@novell.com
- bnc#739585 - L3: Xen block-attach fails after repeated attach/detach
blktap-close-fifos.patch
blktap-disable-debug-printf.patch
-------------------------------------------------------------------
Fri Jan 13 10:37:53 MST 2012 - jfehlig@suse.com
- bnc#741159 - Fix default setting of XENSTORED_ROOTDIR in
xencommons init script
xencommons-xenstored-root.patch
-------------------------------------------------------------------
Thu Jan 12 06:49:57 MST 2012 - carnold@novell.com
- bnc#740625 - xen: cannot interact with xend after upgrade (SLES)
- bnc#738694 - xen: cannot interact with xend after upgrade (os12.1)
- Other README changes included.
README.SuSE
-------------------------------------------------------------------
Tue Jan 10 17:30:20 CET 2012 - ohering@suse.de
- bnc#694863 - kexec fails in xen
24478-libxl_add_feature_flag_to_xenstore_for_XS_RESET_WATCHES.patch
-------------------------------------------------------------------
Mon Jan 9 16:10:19 CET 2012 - ohering@suse.de
- fate#310510 - fix xenpaging
xenpaging.speedup-page-out.patch
-------------------------------------------------------------------
Tue Jan 3 08:26:42 MST 2012 - carnold@novell.com
- bnc#735806 - VF doesn't work after hot-plug for many times
24448-x86-pt-irq-leak.patch
- Upstream patches from Jan
24261-x86-cpuidle-Westmere-EX.patch
24417-amd-erratum-573.patch
24429-mceinj-tool.patch
24447-x86-TXT-INIT-SIPI-delay.patch
ioemu-9868-MSI-X.patch
-------------------------------------------------------------------
Mon Jan 2 10:05:57 CET 2012 - ohering@suse.de
- bnc#732884 - remove private runlevel 4 from init scripts
xen.no-default-runlevel-4.patch
-------------------------------------------------------------------
Mon Dec 19 15:22:13 MST 2011 - carnold@novell.com
- bnc#727515 - Fragmented packets hang network boot of HVM guest
ipxe-gcc45-warnings.patch
ipxe-ipv4-fragment.patch
ipxe-enable-nics.patch
-------------------------------------------------------------------
Mon Dec 19 12:43:11 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
update xenpaging.autostart.patch, make changes with mem-swap-target
permanent
update xenpaging.doc.patch, mention issues with live migration
-------------------------------------------------------------------
Thu Dec 15 17:53:51 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
add xenpaging.evict_mmap_readonly.patch
update xenpaging.error-handling.patch, reduce debug output
-------------------------------------------------------------------
Thu Dec 15 08:35:27 MST 2011 - carnold@novell.com
- bnc#736824 - Microcode patches for AMD's 15h processors panic the
system
24189-x86-p2m-pod-locking.patch
24412-x86-AMD-errata-model-shift.patch
24411-x86-ucode-AMD-Fam15.patch
-------------------------------------------------------------------
Wed Dec 14 10:08:24 MST 2011 - carnold@novell.com
- bnc#711219 - SR-IOV VF doesn't work in SLES11 sp2 guest
24357-firmware-no-_PS0-_PS3.patch
- Upstream patches from Jan
24153-x86-emul-feature-checks.patch
24275-x86-emul-lzcnt.patch
24277-x86-dom0-features.patch
24278-x86-dom0-no-PCID.patch
24282-x86-log-dirty-bitmap-leak.patch
24359-x86-domU-features.patch
24360-x86-pv-domU-no-PCID.patch
24389-amd-fam10-gart-tlb-walk-err.patch
24391-x86-pcpu-version.patch
-------------------------------------------------------------------
Thu Dec 8 14:19:49 CET 2011 - ohering@suse.de
- bnc#729208 - xenpaging=-1 doesn't work
xenpaging.doc.patch
-------------------------------------------------------------------
Thu Dec 8 08:41:36 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
readd xenpaging.qemu.flush-cache.patch
-------------------------------------------------------------------
Wed Dec 7 11:01:43 MST 2011 - jfehlig@suse.com
- bnc#732782 - L3: xm create hangs when maxmen value is enclosed
in "quotes"
xm-create-maxmem.patch
-------------------------------------------------------------------
Wed Dec 7 10:44:06 MST 2011 - carnold@novell.com
- Upstream patches / changes from Jan
Added 24358-kexec-compat-overflow.patch
Removed 24341-x86-64-mmcfg_remove___initdata_annotation_overlooked_in_23749e8d1c8f074ba.patch
Removed 24345-tools-libxc_Fix_x86_32_build_breakage_in_previous_changeset..patch
-------------------------------------------------------------------
Wed Dec 7 16:42:44 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
24178-debug_Add_domain-vcpu_pause_count_info_to_d_key..patch
Use wait queues for paging, improve foreign mappings.
xenpaging.versioned-interface.patch
xenpaging.mmap-before-nominate.patch
xenpaging.p2m_is_paged.patch
xenpaging.evict_fail_fast_forward.patch
xenpaging.error-handling.patch
xenpaging.mem_event-use-wait_queue.patch
xenpaging.waitqueue-paging.patch
Remove obsolete patch, not needed with wait queue usage
xenpaging.HVMCOPY_gfn_paged_out.patch
-------------------------------------------------------------------
Wed Dec 7 16:23:49 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
Fix incorrect backport, remove double memset, use xzalloc
24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch
-------------------------------------------------------------------
Wed Dec 7 12:08:31 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
fix typo in nominate, use lock instead of double unlock
23905-xenpaging_fix_locking_in_p2m_mem_paging_functions.patch
-------------------------------------------------------------------
Wed Dec 7 11:07:23 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
24327-After_preparing_a_page_for_page-in_allow_immediate_fill-in_of_the_page_contents.patch
24328-Tools_Libxc_wrappers_to_automatically_fill_in_page_oud_page_contents_on_prepare.patch
24329-Teach_xenpaging_to_use_the_new_and_non-racy_xc_mem_paging_load_interface.patch
-------------------------------------------------------------------
Tue Dec 6 11:14:51 MST 2011 - jfehlig@suse.com
- bnc#734826 - xm rename doesn't work anymore
Updated xend-migration-domname-fix.patch
-------------------------------------------------------------------
Fri Dec 2 20:35:29 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch
24270-Free_d-mem_event_on_domain_destruction..patch
-------------------------------------------------------------------
Fri Dec 2 20:25:24 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch
-------------------------------------------------------------------
Fri Dec 2 20:21:48 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
23949-constify_vcpu_set_affinitys_second_parameter.patch
-------------------------------------------------------------------
Fri Dec 2 19:36:33 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch
24106-mem_event_check_capabilities_only_once.patch
-------------------------------------------------------------------
Fri Dec 2 19:02:05 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch
-------------------------------------------------------------------
Fri Dec 2 18:46:14 CET 2011 - ohering@suse.de
- bnc#727081 - xend domains don't work anymore since update from 12.1 beta to 12.1 RC 1
24344-tools-x86_64_Fix_cpuid_inline_asm_to_not_clobber_stacks_red_zone.patch
24345-tools-libxc_Fix_x86_32_build_breakage_in_previous_changeset..patch
-------------------------------------------------------------------
Fri Dec 2 18:42:16 CET 2011 - ohering@suse.de
- bnc#733449 - Panic in mcfg_ioremap when booting xen-dbg.gz on Xeon E3-1230
24341-x86-64-mmcfg_remove___initdata_annotation_overlooked_in_23749e8d1c8f074ba.patch
-------------------------------------------------------------------
Fri Dec 2 18:21:46 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
backport waitqueue changes from xen-unstable
24104-waitqueue_Double_size_of_x86_shadow_stack..patch
24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch
24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch
24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch
24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch
24231-waitqueue_Implement_wake_up_nroneall..patch
24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch
-------------------------------------------------------------------
Fri Dec 2 17:32:34 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
24227-xenpaging_restrict_pagefile_permissions.patch
-------------------------------------------------------------------
Fri Dec 2 17:29:35 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
merge upstream version of our existing patches:
24218-libxc_add_bitmap_clear_function.patch
remove old versions:
xenpaging.bitmap_clear.patch
-------------------------------------------------------------------
Fri Dec 2 17:04:56 CET 2011 - ohering@suse.de
- fate#310510 - fix xenpaging
merge upstream version of our existing patches:
24138-xenpaging_munmap_all_pages_after_page-in.patch
24208-xenpaging_remove_filename_from_comment.patch
24209-xenpaging_remove_obsolete_comment_in_resume_path.patch
24210-xenpaging_use_PERROR_to_print_errno.patch
24211-xenpaging_simplify_file_op.patch
24212-xenpaging_print_gfn_in_failure_case.patch
24213-xenpaging_update_xenpaging_init.patch
24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch
24215-xenpaging_track_the_number_of_paged-out_pages.patch
24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch
24217-xenpaging_improve_mainloop_exit_handling.patch
24219-xenpaging_retry_unpageable_gfns.patch
24220-xenpaging_install_into_LIBEXEC_dir.patch
24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch
24222-xenpaging_use_guests_tot_pages_as_working_target.patch
24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch
24224-xenpaging_add_cmdline_interface_for_pager.patch
24225-xenpaging_improve_policy_mru_list_handling.patch
24226-xenpaging_add_debug_to_show_received_watch_event..patch
remove old versions:
xenpaging.XEN_PAGING_DIR.patch
xenpaging.add_evict_pages.patch
xenpaging.cmdline-interface.patch
xenpaging.encapsulate_domain_info.patch
xenpaging.file_op-return-code.patch
xenpaging.install-to-libexec.patch
xenpaging.low_target_policy_nomru.patch
xenpaging.main-loop-exit-handling.patch
xenpaging.misleading-comment.patch
xenpaging.page_in-munmap-size.patch
xenpaging.print-gfn.patch
xenpaging.record-numer-paged-out-pages.patch
xenpaging.reset-uncomsumed.patch
xenpaging.stale-comments.patch
xenpaging.target-tot_pages.patch
xenpaging.use-PERROR.patch
xenpaging.watch-target-tot_pages.patch
xenpaging.watch_event-DPRINTF.patch
xenpaging.xc_interface_open-comment.patch
-------------------------------------------------------------------
Wed Nov 30 10:48:50 MST 2011 - jfehlig@suse.com
- bnc#733348 - Use 'xm' in various scripts if xend is running.
Modified xmclone.sh and xen-updown.sh
- Only emit xl warning when xend is running and -f (force) flag
is not specified.
Modified disable-xl-when-using-xend.patch
-------------------------------------------------------------------
Wed Nov 30 09:43:34 MST 2011 - carnold@novell.com
- Upstream patches from Jan
24190-hap-log-dirty-disable-rc.patch
24193-hap-track-dirty-vram-rc.patch
24201-x86-pcpu-platform-op.patch
-------------------------------------------------------------------
Tue Nov 22 17:57:07 MST 2011 - carnold@novell.com

View File

@ -0,0 +1,77 @@
Related to bnc#732884
Runlevel 4 is for local sysadmin.
He is responsible to create all required symlinks in this private runlevel.
---
tools/hotplug/Linux/init.d/xen-watchdog | 2 +-
tools/hotplug/Linux/init.d/xencommons | 2 +-
tools/hotplug/Linux/init.d/xend | 2 +-
tools/hotplug/Linux/init.d/xendomains | 2 +-
tools/xenballoon/xenballoond.init | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
Index: xen-4.1.2-testing/tools/hotplug/Linux/init.d/xen-watchdog
===================================================================
--- xen-4.1.2-testing.orig/tools/hotplug/Linux/init.d/xen-watchdog
+++ xen-4.1.2-testing/tools/hotplug/Linux/init.d/xen-watchdog
@@ -10,7 +10,7 @@
# Should-Start: xend
# Required-Stop: $syslog $remote_fs
# Should-Stop: xend
-# Default-Start: 2 3 4 5
+# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop xen-watchdog
# Description: Run domain watchdog daemon.
Index: xen-4.1.2-testing/tools/hotplug/Linux/init.d/xencommons
===================================================================
--- xen-4.1.2-testing.orig/tools/hotplug/Linux/init.d/xencommons
+++ xen-4.1.2-testing/tools/hotplug/Linux/init.d/xencommons
@@ -12,7 +12,7 @@
# Should-Start:
# Required-Stop: $syslog $remote_fs
# Should-Stop:
-# Default-Start: 2 3 4 5
+# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop xenstored and xenconsoled
# Description: Starts and stops the daemons neeeded for xl/xend
Index: xen-4.1.2-testing/tools/hotplug/Linux/init.d/xend
===================================================================
--- xen-4.1.2-testing.orig/tools/hotplug/Linux/init.d/xend
+++ xen-4.1.2-testing/tools/hotplug/Linux/init.d/xend
@@ -12,7 +12,7 @@
# Should-Start:
# Required-Stop: $syslog $remote_fs xenstored xenconsoled
# Should-Stop:
-# Default-Start: 2 3 4 5
+# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop xend
# Description: Starts and stops the Xen control daemon.
Index: xen-4.1.2-testing/tools/hotplug/Linux/init.d/xendomains
===================================================================
--- xen-4.1.2-testing.orig/tools/hotplug/Linux/init.d/xendomains
+++ xen-4.1.2-testing/tools/hotplug/Linux/init.d/xendomains
@@ -20,7 +20,7 @@
# Should-Start: xend
# Required-Stop: $syslog $remote_fs xenstored xenconsoled
# Should-Stop: xend
-# Default-Start: 2 3 4 5
+# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop secondary xen domains
# Description: Start / stop domains automatically when domain 0
Index: xen-4.1.2-testing/tools/xenballoon/xenballoond.init
===================================================================
--- xen-4.1.2-testing.orig/tools/xenballoon/xenballoond.init
+++ xen-4.1.2-testing/tools/xenballoon/xenballoond.init
@@ -14,7 +14,7 @@
# Should-Start:
# Required-Stop: $syslog $remote_fs
# Should-Stop:
-# Default-Start: 3 4 5
+# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Start/stop xenballoond
# Description: Starts and stops the Xen ballooning daemon.

296
xen.spec
View File

@ -1,7 +1,7 @@
#
# spec file for package xen
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -15,9 +15,6 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: xen
ExclusiveArch: %ix86 x86_64
%define xvers 4.1
@ -52,6 +49,7 @@ BuildRequires: curl-devel
BuildRequires: dev86
BuildRequires: graphviz
BuildRequires: latex2html
BuildRequires: libbz2-devel
BuildRequires: libjpeg-devel
BuildRequires: libxml2-devel
BuildRequires: ncurses-devel
@ -61,7 +59,6 @@ BuildRequires: pciutils-devel
BuildRequires: python-devel
BuildRequires: texinfo
BuildRequires: transfig
BuildRequires: libbz2-devel
%if %suse_version >= 1120
BuildRequires: xz-devel
%endif
@ -81,9 +78,11 @@ BuildRequires: tetex
%ifarch x86_64
%if %{?with_gcc46}0
BuildRequires: gcc46
BuildRequires: libgcc46 libgcc46-32bit
BuildRequires: libgcc46
BuildRequires: libgcc46-32bit
%endif
BuildRequires: glibc-32bit glibc-devel-32bit
BuildRequires: glibc-32bit
BuildRequires: glibc-devel-32bit
BuildRequires: gcc-32bit
BuildRequires: gcc43-32bit
%define max_cpus 256
@ -94,15 +93,17 @@ BuildRequires: gcc43-32bit
%endif
BuildRequires: glibc-devel
%if %{?with_kmp}0
BuildRequires: kernel-source kernel-syms module-init-tools xorg-x11
BuildRequires: kernel-source
BuildRequires: kernel-syms
BuildRequires: module-init-tools
BuildRequires: xorg-x11
%endif
Version: 4.1.2_08
Release: 1
License: GPLv2+
Group: System/Kernel
AutoReqProv: on
Version: 4.1.2_13
Release: 0
PreReq: %insserv_prereq %fillup_prereq
Summary: Xen Virtualization: Hypervisor (aka VMM aka Microkernel)
License: GPL-2.0+
Group: System/Kernel
Source0: xen-4.1.2-testing-src.tar.bz2
Source1: stubdom.tar.bz2
Source2: xen-utils-0.1.tar.bz2
@ -257,6 +258,7 @@ Patch23908: 23908-p2m_query-modify_p2mt_with_p2m_lock_held.patch
Patch23925: 23925-x86-AMD-ARAT-Fam12.patch
Patch23933: 23933-pt-bus2bridge-update.patch
Patch23943: 23943-xenpaging_clear_page_content_after_evict.patch
Patch23949: 23949-constify_vcpu_set_affinitys_second_parameter.patch
Patch23953: 23953-xenpaging_handle_evict_failures.patch
Patch23955: 23955-x86-pv-cpuid-xsave.patch
Patch23957: 23957-cpufreq-error-paths.patch
@ -264,17 +266,90 @@ Patch23978: 23978-xenpaging_check_p2mt_in_p2m_mem_paging_functions.patch
Patch23979: 23979-xenpaging_document_p2m_mem_paging_functions.patch
Patch23980: 23980-xenpaging_disallow_paging_in_a_PoD_guest.patch
Patch23993: 23993-x86-microcode-amd-fix-23871.patch
Patch24104: 24104-waitqueue_Double_size_of_x86_shadow_stack..patch
Patch24105: 24105-xenpaging_compare_domain_pointer_in_p2m_mem_paging_populate.patch
Patch24106: 24106-mem_event_check_capabilities_only_once.patch
Patch24116: 24116-x86-continuation-cancel.patch
Patch24123: 24123-x86-cpuidle-quiesce.patch
Patch24124: 24124-x86-microcode-amd-quiesce.patch
Patch24137: 24137-revert-23666.patch
Patch24138: 24138-xenpaging_munmap_all_pages_after_page-in.patch
Patch24144: 24144-cpufreq-turbo-crash.patch
Patch24148: 24148-shadow-pgt-dying-op-performance.patch
Patch24153: 24153-x86-emul-feature-checks.patch
Patch24155: 24155-x86-ioapic-EOI-after-migration.patch
Patch24156: 24156-x86-ioapic-shared-vectors.patch
Patch24157: 24157-x86-xstate-init.patch
Patch24168: 24168-x86-vioapic-clear-remote_irr.patch
Patch24171: 24171-x86waitqueue_Allocate_whole_page_for_shadow_stack..patch
Patch24178: 24178-debug_Add_domain-vcpu_pause_count_info_to_d_key..patch
Patch24189: 24189-x86-p2m-pod-locking.patch
Patch24190: 24190-hap-log-dirty-disable-rc.patch
Patch24193: 24193-hap-track-dirty-vram-rc.patch
Patch24195: 24195-waitqueue_Detect_saved-stack_overflow_and_crash_the_guest..patch
Patch24196: 24196-waitqueue_Reorder_prepare_to_wait_so_that_vcpu_is_definitely_on_the.patch
Patch24197: 24197-x86-waitqueue_Because_we_have_per-cpu_stacks_we_must_wake_up_on_teh.patch
Patch24201: 24201-x86-pcpu-platform-op.patch
Patch24208: 24208-xenpaging_remove_filename_from_comment.patch
Patch24209: 24209-xenpaging_remove_obsolete_comment_in_resume_path.patch
Patch24210: 24210-xenpaging_use_PERROR_to_print_errno.patch
Patch24211: 24211-xenpaging_simplify_file_op.patch
Patch24212: 24212-xenpaging_print_gfn_in_failure_case.patch
Patch24213: 24213-xenpaging_update_xenpaging_init.patch
Patch24214: 24214-xenpaging_remove_xc_dominfo_t_from_paging_t.patch
Patch24215: 24215-xenpaging_track_the_number_of_paged-out_pages.patch
Patch24216: 24216-xenpaging_move_page_add-resume_loops_into_its_own_function..patch
Patch24217: 24217-xenpaging_improve_mainloop_exit_handling.patch
Patch24218: 24218-libxc_add_bitmap_clear_function.patch
Patch24219: 24219-xenpaging_retry_unpageable_gfns.patch
Patch24220: 24220-xenpaging_install_into_LIBEXEC_dir.patch
Patch24221: 24221-xenpaging_add_XEN_PAGING_DIR_-_libxl_xenpaging_dir_path.patch
Patch24222: 24222-xenpaging_use_guests_tot_pages_as_working_target.patch
Patch24223: 24223-xenpaging_watch_the_guests_memory-target-tot_pages_xenstore_value.patch
Patch24224: 24224-xenpaging_add_cmdline_interface_for_pager.patch
Patch24225: 24225-xenpaging_improve_policy_mru_list_handling.patch
Patch24226: 24226-xenpaging_add_debug_to_show_received_watch_event..patch
Patch24227: 24227-xenpaging_restrict_pagefile_permissions.patch
Patch24231: 24231-waitqueue_Implement_wake_up_nroneall..patch
Patch24232: 24232-waitqueue_Hold_a_reference_to_a_domain_on_a_waitqueue..patch
Patch24261: 24261-x86-cpuidle-Westmere-EX.patch
Patch24269: 24269-mem_event_move_mem_event_domain_out_of_struct_domain.patch
Patch24270: 24270-Free_d-mem_event_on_domain_destruction..patch
Patch24272: 24272-xenpaging_Fix_c-s_235070a29c8c3ddf7_update_machine_to_phys_mapping_during_page_deallocation.patch
Patch24275: 24275-x86-emul-lzcnt.patch
Patch24277: 24277-x86-dom0-features.patch
Patch24278: 24278-x86-dom0-no-PCID.patch
Patch24282: 24282-x86-log-dirty-bitmap-leak.patch
Patch24318: 24318-x86-mm_Fix_checks_during_foreign_mapping_of_paged_pages.patch
Patch24344: 24344-tools-x86_64_Fix_cpuid_inline_asm_to_not_clobber_stacks_red_zone.patch
Patch24327: 24327-After_preparing_a_page_for_page-in_allow_immediate_fill-in_of_the_page_contents.patch
Patch24328: 24328-Tools_Libxc_wrappers_to_automatically_fill_in_page_oud_page_contents_on_prepare.patch
Patch24329: 24329-Teach_xenpaging_to_use_the_new_and_non-racy_xc_mem_paging_load_interface.patch
Patch24357: 24357-firmware-no-_PS0-_PS3.patch
Patch24358: 24358-kexec-compat-overflow.patch
Patch24359: 24359-x86-domU-features.patch
Patch24360: 24360-x86-pv-domU-no-PCID.patch
Patch24389: 24389-amd-fam10-gart-tlb-walk-err.patch
Patch24391: 24391-x86-pcpu-version.patch
Patch24411: 24411-x86-ucode-AMD-Fam15.patch
Patch24412: 24412-x86-AMD-errata-model-shift.patch
Patch24417: 24417-amd-erratum-573.patch
Patch24429: 24429-mceinj-tool.patch
Patch24447: 24447-x86-TXT-INIT-SIPI-delay.patch
Patch24448: 24448-x86-pt-irq-leak.patch
Patch24453: 24453-x86-vIRQ-IRR-TMR-race.patch
Patch24456: 24456-x86-emul-lea.patch
Patch24459: 24459-libxl-vifname.patch
Patch24466: 24466-libxc_Only_retry_mapping_pages_when_ENOENT_is_returned.patch
Patch24478: 24478-libxl_add_feature_flag_to_xenstore_for_XS_RESET_WATCHES.patch
Patch24566: 24566-tools-libxc_fix_error_handling_in_xc_mem_paging_load.patch
Patch24586: 24586-x86-mm_Properly_account_for_paged_out_pages.patch
Patch24609: 24609-tools-libxc_handle_fallback_in_linux_privcmd_map_foreign_bulk_properly.patch
Patch24610: 24610-xenpaging_make_file_op_largefile_aware.patch
# Upstream qemu patches
Patch100: ioemu-9868-MSI-X.patch
Patch101: ioemu-MSI-X-fix-unregister_iomem.patch
Patch102: cve-2012-0029-qemu-xen-unstable.patch
# Our patches
Patch300: xen-config.diff
Patch301: xend-config.diff
@ -314,12 +389,11 @@ Patch351: xend-core-dump-loc.diff
Patch352: blktap.patch
Patch353: xen-qemu-iscsi-fix.patch
Patch354: xen-api-auth.patch
Patch355: tools-gdbserver-build.diff
Patch356: ioemu-vnc-resize.patch
Patch357: ioemu-debuginfo.patch
Patch358: vif-bridge-no-iptables.patch
Patch359: xenconsole-no-multiple-connections.patch
Patch360: disable-xl-when-using-xend.patch
Patch355: ioemu-vnc-resize.patch
Patch356: ioemu-debuginfo.patch
Patch357: vif-bridge-no-iptables.patch
Patch358: xenconsole-no-multiple-connections.patch
Patch359: disable-xl-when-using-xend.patch
# Needs to go upstream
Patch370: checkpoint-rename.patch
Patch371: xm-save-check-file.patch
@ -331,8 +405,10 @@ Patch376: xend-devid-or-name.patch
Patch377: suspend_evtchn_lock.patch
Patch378: log-guest-console.patch
Patch379: xend-migration-domname-fix.patch
Patch380: xm-create-maxmem.patch
# Sent upstream and tentatively ACK'ed, but not yet committed
Patch380: 2XXXX-vif-bridge.patch
Patch381: 2XXXX-vif-bridge.patch
Patch382: xencommons-xenstored-root.patch
# Patches for snapshot support
Patch400: snapshot-ioemu-save.patch
Patch401: snapshot-ioemu-restore.patch
@ -382,6 +458,11 @@ Patch456: xend-vcpu-affinity-fix.patch
Patch457: xenstored.XS_RESET_WATCHES.patch
Patch458: xen-cpupool-xl-config-format.patch
Patch459: xl-create-pv-with-qcow2-img.patch
Patch460: ipxe-gcc45-warnings.patch
Patch461: ipxe-ipv4-fragment.patch
Patch462: ipxe-enable-nics.patch
Patch463: blktap-close-fifos.patch
Patch464: blktap-disable-debug-printf.patch
# Jim's domain lock patch
Patch480: xend-domain-lock.patch
Patch481: xend-domain-lock-sfex.patch
@ -403,30 +484,26 @@ Patch650: disable_emulated_device.diff
Patch651: ioemu-disable-scsi.patch
Patch652: ioemu-disable-emulated-ide-if-pv.patch
Patch700: hv_extid_compatibility.patch
Patch701: xen.no-default-runlevel-4.patch
# FATE 310510
Patch1107: xenpaging.stale-comments.patch
Patch1108: xenpaging.misleading-comment.patch
Patch1109: xenpaging.use-PERROR.patch
Patch1110: xenpaging.file_op-return-code.patch
Patch1111: xenpaging.print-gfn.patch
Patch1112: xenpaging.xc_interface_open-comment.patch
Patch1113: xenpaging.encapsulate_domain_info.patch
Patch1114: xenpaging.record-numer-paged-out-pages.patch
Patch1115: xenpaging.add_evict_pages.patch
Patch1116: xenpaging.main-loop-exit-handling.patch
Patch1117: xenpaging.bitmap_clear.patch
Patch1118: xenpaging.reset-uncomsumed.patch
Patch1119: xenpaging.install-to-libexec.patch
Patch1120: xenpaging.XEN_PAGING_DIR.patch
Patch1121: xenpaging.target-tot_pages.patch
Patch1122: xenpaging.watch-target-tot_pages.patch
Patch1123: xenpaging.cmdline-interface.patch
Patch1125: xenpaging.watch_event-DPRINTF.patch
Patch1100: xenpaging.versioned-interface.patch
Patch1101: xenpaging.mmap-before-nominate.patch
Patch1102: xenpaging.p2m_is_paged.patch
Patch1103: xenpaging.evict_fail_fast_forward.patch
Patch1104: xenpaging.error-handling.patch
Patch1105: xenpaging.mem_event-use-wait_queue.patch
Patch1106: xenpaging.waitqueue-paging.patch
Patch1107: xenpaging.evict_mmap_readonly.patch
Patch1126: xenpaging.guest-memusage.patch
Patch1127: xenpaging.page_in-munmap-size.patch
Patch1128: xenpaging.low_target_policy_nomru.patch
Patch1129: xenpaging.autostart.patch
Patch1130: xenpaging.HVMCOPY_gfn_paged_out.patch
Patch1130: xenpaging.doc.patch
Patch1131: xenpaging.speedup-page-out.patch
Patch1132: xenpaging.speedup-page-in.gfn_to_slot.patch
Patch1134: xen-unstable.misc.linux_privcmd_map_foreign_bulk.retry_paged.patch
Patch1135: xenpaging.speedup-page-out.resume_pages.find_next_bit_set.patch
Patch1136: xenpaging.speedup-page-out.policy_choose_victim.patch
Patch1137: xenpaging.speedup-page-out.evict_pages.free_slot_stack.patch
Patch1142: xenpaging.qemu.flush-cache.patch
# xenalyze
Patch20000: xenalyze.gcc46.patch
# Build patch
@ -494,11 +571,9 @@ Authors:
...
%package libs
License: GPLv2+
Summary: Xen Virtualization: Libraries
Group: System/Kernel
#Requires: xen = %{version}
AutoReqProv: on
%description libs
Xen is a virtual machine monitor for x86 that supports execution of
@ -546,7 +621,6 @@ Authors:
%if %{?with_dom0_support}0
%package tools
License: GPLv2+
Summary: Xen Virtualization: Control tools for domain 0
Group: System/Kernel
Requires: xen-libs = %{version}
@ -554,7 +628,6 @@ Requires: bridge-utils multipath-tools python python-curses python-openssl
# subpackage existed in 10.3
Provides: xen-tools-ioemu = 3.2
Obsoletes: xen-tools-ioemu <= 3.2
AutoReqProv: on
%description tools
Xen is a virtual machine monitor for x86 that supports execution of
@ -604,11 +677,9 @@ Authors:
%endif
%package tools-domU
License: GPLv2+
Summary: Xen Virtualization: Control tools for domain U
Group: System/Kernel
Conflicts: xen-tools
AutoReqProv: on
%description tools-domU
Xen is a virtual machine monitor for x86 that supports execution of
@ -625,7 +696,6 @@ Authors:
Ian Pratt <ian.pratt@cl.cam.ac.uk>
%package devel
License: GPLv2+
Summary: Xen Virtualization: Headers and libraries for development
Group: System/Kernel
Requires: xen-libs = %{version}
@ -676,9 +746,8 @@ Authors:
%if %{?with_kmp}0
%package KMP
License: GPLv2+
Group: System/Kernel
Summary: Xen para-virtual device drivers for fully virtualized guests
Group: System/Kernel
Conflicts: xen
%description KMP
@ -727,7 +796,6 @@ Xen, but is not available for release due to license restrictions.
%if %{?with_dom0_support}0
%package doc-html
License: GPLv2+
Summary: Xen Virtualization: HTML documentation
Group: Documentation/HTML
@ -746,7 +814,6 @@ Authors:
Ian Pratt <ian.pratt@cl.cam.ac.uk>
%package doc-pdf
License: GPLv2+
Summary: Xen Virtualization: PDF documentation
Group: Documentation/Other
@ -886,6 +953,7 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
%patch23925 -p1
%patch23933 -p1
%patch23943 -p1
%patch23949 -p1
%patch23953 -p1
%patch23955 -p1
%patch23957 -p1
@ -893,17 +961,91 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
%patch23979 -p1
%patch23980 -p1
%patch23993 -p1
%patch24104 -p1
%patch24105 -p1
%patch24106 -p1
%patch24116 -p1
%patch24123 -p1
%patch24124 -p1
%patch24137 -p1
%patch24138 -p1
%patch24144 -p1
%patch24148 -p1
%patch24153 -p1
%patch24155 -p1
%patch24156 -p1
%patch24157 -p1
%patch24168 -p1
# Upstream patches
%patch24171 -p1
%patch24178 -p1
%patch24189 -p1
%patch24190 -p1
%patch24193 -p1
%patch24195 -p1
%patch24196 -p1
%patch24197 -p1
%patch24201 -p1
%patch24208 -p1
%patch24209 -p1
%patch24210 -p1
%patch24211 -p1
%patch24212 -p1
%patch24213 -p1
%patch24214 -p1
%patch24215 -p1
%patch24216 -p1
%patch24217 -p1
%patch24218 -p1
%patch24219 -p1
%patch24220 -p1
%patch24221 -p1
%patch24222 -p1
%patch24223 -p1
%patch24224 -p1
%patch24225 -p1
%patch24226 -p1
%patch24227 -p1
%patch24231 -p1
%patch24232 -p1
%patch24261 -p1
%patch24269 -p1
%patch24270 -p1
%patch24272 -p1
%patch24275 -p1
%patch24277 -p1
%patch24278 -p1
%patch24282 -p1
%patch24318 -p1
%patch24344 -p1
%patch24327 -p1
%patch24328 -p1
%patch24329 -p1
%patch24357 -p1
%patch24358 -p1
%patch24359 -p1
%patch24360 -p1
%patch24389 -p1
%patch24391 -p1
%patch24411 -p1
%patch24412 -p1
%patch24417 -p1
%patch24429 -p1
%patch24447 -p1
%patch24448 -p1
%patch24453 -p1
%patch24456 -p1
%patch24459 -p1
%patch24466 -p1
%patch24478 -p1
%patch24566 -p1
%patch24586 -p1
%patch24609 -p1
%patch24610 -p1
# Qemu
%patch100 -p1
%patch101 -p1
%patch102 -p1
# Our patches
%patch300 -p1
%patch301 -p1
%patch302 -p1
@ -942,12 +1084,11 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
%patch352 -p1
%patch353 -p1
%patch354 -p1
###%patch355 -p1 gdbserver
%patch355 -p1
%patch356 -p1
%patch357 -p1
%patch358 -p1
%patch359 -p1
%patch360 -p1
%patch370 -p1
%patch371 -p1
%patch372 -p1
@ -959,6 +1100,8 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
%patch378 -p1
%patch379 -p1
%patch380 -p1
%patch381 -p1
%patch382 -p1
%patch400 -p1
%patch401 -p1
%patch402 -p1
@ -1005,6 +1148,11 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
%patch457 -p1
%patch458 -p1
%patch459 -p1
%patch460 -p1
%patch461 -p1
%patch462 -p1
%patch463 -p1
%patch464 -p1
%patch480 -p1
%patch481 -p1
%patch500 -p1
@ -1024,30 +1172,26 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
%patch651 -p1
%patch652 -p1
%patch700 -p1
%patch701 -p1
# FATE 310510
%patch1100 -p1
%patch1101 -p1
%patch1102 -p1
%patch1103 -p1
%patch1104 -p1
%patch1105 -p1
%patch1106 -p1
%patch1107 -p1
%patch1108 -p1
%patch1109 -p1
%patch1110 -p1
%patch1111 -p1
%patch1112 -p1
%patch1113 -p1
%patch1114 -p1
%patch1115 -p1
%patch1116 -p1
%patch1117 -p1
%patch1118 -p1
%patch1119 -p1
%patch1120 -p1
%patch1121 -p1
%patch1122 -p1
%patch1123 -p1
%patch1125 -p1
%patch1126 -p1
%patch1127 -p1
%patch1128 -p1
%patch1129 -p1
%patch1130 -p1
%patch1131 -p1
%patch1132 -p1
%patch1134 -p1
%patch1135 -p1
%patch1136 -p1
%patch1137 -p1
%patch1142 -p1
#
%patch99998 -p1
%patch99999 -p1
@ -1153,12 +1297,12 @@ make -C tools/misc/serial-split install \
%if %{?with_kmp}0
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d
for flavor in %flavors_to_build; do
make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
M=$PWD/obj/$flavor
install -m644 %SOURCE20 $RPM_BUILD_ROOT/etc/modprobe.d/xen_pvdrivers-$flavor.conf
done
mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d
install -m644 %SOURCE20 $RPM_BUILD_ROOT/etc/modprobe.d/xen_pvdrivers.conf
%endif
%if %{?with_dom0_support}0
# Stubdom

Some files were not shown because too many files have changed in this diff Show More