Sync with sles11sp2 fixes.
OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=166
This commit is contained in:
parent
a0e0589e8d
commit
837bb1d292
38
24453-x86-vIRQ-IRR-TMR-race.patch
Normal file
38
24453-x86-vIRQ-IRR-TMR-race.patch
Normal 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
27
24456-x86-emul-lea.patch
Normal 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
30
24459-libxl-vifname.patch
Normal 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));
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
33
24586-x86-mm_Properly_account_for_paged_out_pages.patch
Normal file
33
24586-x86-mm_Properly_account_for_paged_out_pages.patch
Normal 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:
|
@ -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
|
39
24610-xenpaging_make_file_op_largefile_aware.patch
Normal file
39
24610-xenpaging_make_file_op_largefile_aware.patch
Normal 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 )
|
27
blktap-disable-debug-printf.patch
Normal file
27
blktap-disable-debug-printf.patch
Normal 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)
|
21
cve-2012-0029-qemu-xen-unstable.patch
Normal file
21
cve-2012-0029-qemu-xen-unstable.patch
Normal 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;
|
||||
}
|
57
ioemu-MSI-X-fix-unregister_iomem.patch
Normal file
57
ioemu-MSI-X-fix-unregister_iomem.patch
Normal 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;
|
||||
}
|
||||
}
|
||||
|
@ -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 )
|
56
xen.changes
56
xen.changes
@ -1,14 +1,70 @@
|
||||
-------------------------------------------------------------------
|
||||
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
|
||||
|
25
xen.spec
25
xen.spec
@ -15,7 +15,6 @@
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
Name: xen
|
||||
ExclusiveArch: %ix86 x86_64
|
||||
%define xvers 4.1
|
||||
@ -99,7 +98,7 @@ BuildRequires: kernel-syms
|
||||
BuildRequires: module-init-tools
|
||||
BuildRequires: xorg-x11
|
||||
%endif
|
||||
Version: 4.1.2_12
|
||||
Version: 4.1.2_13
|
||||
Release: 0
|
||||
PreReq: %insserv_prereq %fillup_prereq
|
||||
Summary: Xen Virtualization: Hypervisor (aka VMM aka Microkernel)
|
||||
@ -338,7 +337,12 @@ 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
|
||||
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
|
||||
# Our patches
|
||||
@ -453,6 +457,7 @@ 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
|
||||
@ -488,6 +493,11 @@ Patch1126: xenpaging.guest-memusage.patch
|
||||
Patch1129: xenpaging.autostart.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
|
||||
@ -1017,7 +1027,12 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
|
||||
%patch24429 -p1
|
||||
%patch24447 -p1
|
||||
%patch24448 -p1
|
||||
%patch24466 -p1
|
||||
%patch24478 -p1
|
||||
%patch24566 -p1
|
||||
%patch24586 -p1
|
||||
%patch24609 -p1
|
||||
%patch24610 -p1
|
||||
# Qemu
|
||||
%patch100 -p1
|
||||
# Our patches
|
||||
@ -1127,6 +1142,7 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
|
||||
%patch461 -p1
|
||||
%patch462 -p1
|
||||
%patch463 -p1
|
||||
%patch464 -p1
|
||||
%patch480 -p1
|
||||
%patch481 -p1
|
||||
%patch500 -p1
|
||||
@ -1160,6 +1176,11 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
|
||||
%patch1129 -p1
|
||||
%patch1130 -p1
|
||||
%patch1131 -p1
|
||||
%patch1132 -p1
|
||||
%patch1134 -p1
|
||||
%patch1135 -p1
|
||||
%patch1136 -p1
|
||||
%patch1137 -p1
|
||||
%patch1142 -p1
|
||||
#
|
||||
%patch99998 -p1
|
||||
|
@ -20,8 +20,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
xen/include/public/mem_event.h | 2 -
|
||||
3 files changed, 33 insertions(+), 23 deletions(-)
|
||||
|
||||
--- a/tools/xenpaging/xenpaging.c
|
||||
+++ b/tools/xenpaging/xenpaging.c
|
||||
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
|
||||
@@ -569,29 +569,35 @@ static int xenpaging_evict_page(xenpagin
|
||||
xc_interface *xch = paging->xc_handle;
|
||||
void *page;
|
||||
@ -93,7 +95,7 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
{
|
||||
xc_interface *xch = paging->xc_handle;
|
||||
- int j = 0;
|
||||
+ int flushed = 0;
|
||||
+ static int num_paged_out;
|
||||
int ret;
|
||||
|
||||
do
|
||||
@ -104,12 +106,12 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
- if ( ret != -ENOSPC )
|
||||
- ERROR("Error choosing victim");
|
||||
- goto out;
|
||||
+ if ( !flushed ) {
|
||||
+ if ( num_paged_out != paging->num_paged_out ) {
|
||||
+ DPRINTF("Flushing qemu cache\n");
|
||||
+ xenpaging_mem_paging_flush_ioemu_cache(paging);
|
||||
+ flushed = 1;
|
||||
+ continue;
|
||||
+ num_paged_out = paging->num_paged_out;
|
||||
+ }
|
||||
+ ret = -ENOSPC;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
@ -130,8 +132,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
}
|
||||
}
|
||||
while ( ret );
|
||||
--- a/xen/arch/x86/mm/p2m.c
|
||||
+++ b/xen/arch/x86/mm/p2m.c
|
||||
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
|
||||
@@ -2863,19 +2863,17 @@ int p2m_mem_paging_nominate(struct p2m_d
|
||||
p2m_type_t p2mt;
|
||||
p2m_access_t a;
|
||||
@ -170,8 +174,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
/* Get the page so it doesn't get modified under Xen's feet */
|
||||
page = mfn_to_page(mfn);
|
||||
if ( unlikely(!get_page(page, d)) )
|
||||
--- a/xen/include/public/mem_event.h
|
||||
+++ b/xen/include/public/mem_event.h
|
||||
Index: xen-4.1.2-testing/xen/include/public/mem_event.h
|
||||
===================================================================
|
||||
--- xen-4.1.2-testing.orig/xen/include/public/mem_event.h
|
||||
+++ xen-4.1.2-testing/xen/include/public/mem_event.h
|
||||
@@ -49,7 +49,7 @@
|
||||
#define MEM_EVENT_REASON_INT3 5 /* int3 was hit: gla/gfn are RIP */
|
||||
#define MEM_EVENT_REASON_SINGLESTEP 6 /* single step was invoked: gla/gfn are RIP */
|
||||
|
@ -53,8 +53,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
xen/include/xen/sched.h | 17 +++-
|
||||
6 files changed, 179 insertions(+), 81 deletions(-)
|
||||
|
||||
--- a/xen/arch/x86/hvm/hvm.c
|
||||
+++ b/xen/arch/x86/hvm/hvm.c
|
||||
Index: xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c
|
||||
===================================================================
|
||||
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/hvm.c
|
||||
+++ xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c
|
||||
@@ -3915,8 +3915,8 @@ static int hvm_memory_event_traps(long p
|
||||
if ( (p & HVMPME_onchangeonly) && (value == old) )
|
||||
return 1;
|
||||
@ -66,8 +68,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
return rc;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
--- a/xen/arch/x86/mm/mem_event.c
|
||||
+++ b/xen/arch/x86/mm/mem_event.c
|
||||
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
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <asm/domain.h>
|
||||
@ -320,8 +324,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
}
|
||||
break;
|
||||
|
||||
--- a/xen/arch/x86/mm/mem_sharing.c
|
||||
+++ b/xen/arch/x86/mm/mem_sharing.c
|
||||
Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_sharing.c
|
||||
===================================================================
|
||||
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/mem_sharing.c
|
||||
+++ xen-4.1.2-testing/xen/arch/x86/mm/mem_sharing.c
|
||||
@@ -292,44 +292,32 @@ static void mem_sharing_audit(void)
|
||||
#endif
|
||||
|
||||
@ -343,15 +349,15 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
- req.type = MEM_EVENT_TYPE_SHARED;
|
||||
-
|
||||
- if(must_succeed)
|
||||
+ if ( v->domain != d )
|
||||
{
|
||||
- {
|
||||
- /* We do not support 'must_succeed' any more. External operations such
|
||||
- * as grant table mappings may fail with OOM condition!
|
||||
- */
|
||||
- BUG();
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
+ if ( v->domain != d )
|
||||
{
|
||||
- /* All foreign attempts to unshare pages should be handled through
|
||||
- * 'must_succeed' case. */
|
||||
- ASSERT(v->domain->domain_id == d->domain_id);
|
||||
@ -382,7 +388,7 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
}
|
||||
|
||||
unsigned int mem_sharing_get_nr_saved_mfns(void)
|
||||
@@ -692,14 +680,14 @@ gfn_found:
|
||||
@@ -692,14 +680,14 @@ gfn_found:
|
||||
if(ret == 0) goto private_page_found;
|
||||
|
||||
old_page = page;
|
||||
@ -399,8 +405,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
--- a/xen/arch/x86/mm/p2m.c
|
||||
+++ b/xen/arch/x86/mm/p2m.c
|
||||
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
|
||||
@@ -2988,21 +2988,13 @@ int p2m_mem_paging_evict(struct p2m_doma
|
||||
*/
|
||||
void p2m_mem_paging_drop_page(struct p2m_domain *p2m, unsigned long gfn)
|
||||
@ -445,7 +453,7 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3209,8 +3201,8 @@ void p2m_mem_paging_resume(struct p2m_do
|
||||
@@ -3210,8 +3202,8 @@ void p2m_mem_paging_resume(struct p2m_do
|
||||
if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
|
||||
vcpu_unpause(d->vcpu[rsp.vcpu_id]);
|
||||
|
||||
@ -456,7 +464,7 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
}
|
||||
|
||||
void p2m_mem_access_check(unsigned long gpa, bool_t gla_valid, unsigned long gla,
|
||||
@@ -3239,7 +3231,7 @@ void p2m_mem_access_check(unsigned long
|
||||
@@ -3240,7 +3232,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 */
|
||||
@ -465,7 +473,7 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
if ( res < 0 )
|
||||
{
|
||||
/* No listener */
|
||||
@@ -3249,7 +3241,7 @@ void p2m_mem_access_check(unsigned long
|
||||
@@ -3250,7 +3242,7 @@ void p2m_mem_access_check(unsigned long
|
||||
"Memory access permissions failure, no mem_event listener: pausing VCPU %d, dom %d\n",
|
||||
v->vcpu_id, d->domain_id);
|
||||
|
||||
@ -474,7 +482,7 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3299,9 +3291,11 @@ void p2m_mem_access_resume(struct p2m_do
|
||||
@@ -3300,9 +3292,11 @@ void p2m_mem_access_resume(struct p2m_do
|
||||
if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
|
||||
vcpu_unpause(d->vcpu[rsp.vcpu_id]);
|
||||
|
||||
@ -489,8 +497,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
}
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
--- a/xen/include/asm-x86/mem_event.h
|
||||
+++ b/xen/include/asm-x86/mem_event.h
|
||||
Index: xen-4.1.2-testing/xen/include/asm-x86/mem_event.h
|
||||
===================================================================
|
||||
--- xen-4.1.2-testing.orig/xen/include/asm-x86/mem_event.h
|
||||
+++ xen-4.1.2-testing/xen/include/asm-x86/mem_event.h
|
||||
@@ -24,13 +24,13 @@
|
||||
#ifndef __MEM_EVENT_H__
|
||||
#define __MEM_EVENT_H__
|
||||
@ -510,8 +520,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
|
||||
int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
|
||||
XEN_GUEST_HANDLE(void) u_domctl);
|
||||
--- a/xen/include/xen/sched.h
|
||||
+++ b/xen/include/xen/sched.h
|
||||
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
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <xen/cpumask.h>
|
||||
#include <xen/nodemask.h>
|
||||
|
85
xenpaging.speedup-page-in.gfn_to_slot.patch
Normal file
85
xenpaging.speedup-page-in.gfn_to_slot.patch
Normal file
@ -0,0 +1,85 @@
|
||||
xenpaging: use flat index for pagefile and page-in requests
|
||||
|
||||
This change is based on an idea by <hongkaixing@huawei.com> and
|
||||
<bicky.shi@huawei.com>.
|
||||
|
||||
Scanning the victims[] array is time consuming with a large number of
|
||||
target pages. Replace the loop to find the slot in the pagefile which
|
||||
holds the requested gfn with an index.
|
||||
|
||||
---
|
||||
tools/xenpaging/xenpaging.c | 13 ++++++++++---
|
||||
tools/xenpaging/xenpaging.h | 2 ++
|
||||
2 files changed, 12 insertions(+), 3 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
|
||||
@@ -626,6 +626,8 @@ static int xenpaging_evict_page(xenpagin
|
||||
/* Record number of evicted pages */
|
||||
paging->num_paged_out++;
|
||||
|
||||
+ paging->gfn_to_slot[victim->gfn] = i;
|
||||
+
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
@@ -805,7 +807,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
struct sigaction act;
|
||||
xenpaging_t *paging;
|
||||
- xenpaging_victim_t *victims;
|
||||
+ xenpaging_victim_t *victims = NULL;
|
||||
mem_event_request_t req;
|
||||
mem_event_response_t rsp;
|
||||
int num, prev_num = 0;
|
||||
@@ -838,6 +840,10 @@ int main(int argc, char *argv[])
|
||||
return 2;
|
||||
}
|
||||
|
||||
+ paging->gfn_to_slot = calloc(paging->max_pages, sizeof(int));
|
||||
+ if ( ! paging->gfn_to_slot )
|
||||
+ goto out;
|
||||
+
|
||||
/* Allocate upper limit of pages to allow growing and shrinking */
|
||||
victims = calloc(paging->max_pages, sizeof(xenpaging_victim_t));
|
||||
if ( !victims )
|
||||
@@ -882,10 +888,11 @@ int main(int argc, char *argv[])
|
||||
if ( test_and_clear_bit(req.gfn, paging->bitmap) )
|
||||
{
|
||||
/* Find where in the paging file to read from */
|
||||
- for ( i = 0; i < paging->max_pages; i++ )
|
||||
+ i = paging->gfn_to_slot[req.gfn];
|
||||
+ if ( victims[i].gfn != req.gfn || i > paging->max_pages )
|
||||
{
|
||||
- if ( victims[i].gfn == req.gfn )
|
||||
- break;
|
||||
+ ERROR("Expected gfn %lx in slot %d, got gfn %lx instead\n", req.gfn, i, victims[i].gfn);
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
if ( i >= paging->max_pages )
|
||||
@@ -1019,7 +1026,8 @@ int main(int argc, char *argv[])
|
||||
out:
|
||||
close(fd);
|
||||
unlink_pagefile();
|
||||
- free(victims);
|
||||
+ if ( victims != NULL )
|
||||
+ free(victims);
|
||||
|
||||
/* Tear down domain paging */
|
||||
rc1 = xenpaging_teardown(paging);
|
||||
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h
|
||||
===================================================================
|
||||
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h
|
||||
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h
|
||||
@@ -46,6 +46,8 @@ typedef struct xenpaging {
|
||||
|
||||
unsigned long *bitmap;
|
||||
|
||||
+ int *gfn_to_slot;
|
||||
+
|
||||
mem_event_t mem_event;
|
||||
/* number of pages for which data structures were allocated */
|
||||
int max_pages;
|
69
xenpaging.speedup-page-out.evict_pages.free_slot_stack.patch
Normal file
69
xenpaging.speedup-page-out.evict_pages.free_slot_stack.patch
Normal file
@ -0,0 +1,69 @@
|
||||
Scanning the victims array for a free slot is expensive.
|
||||
Remember the last slots freed during page-in requests and reuse them in evict_victims.
|
||||
---
|
||||
tools/xenpaging/xenpaging.c | 20 ++++++++++++++++++--
|
||||
tools/xenpaging/xenpaging.h | 2 ++
|
||||
2 files changed, 20 insertions(+), 2 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
|
||||
@@ -787,11 +787,23 @@ static int evict_victim(xenpaging_t *pag
|
||||
}
|
||||
|
||||
/* Evict a batch of pages and write them to a free slot in the paging file */
|
||||
-static int evict_pages(xenpaging_t *paging, int fd, xenpaging_victim_t *victims, int num_pages)
|
||||
+static void evict_pages(xenpaging_t *paging, int fd, xenpaging_victim_t *victims, int num_pages)
|
||||
{
|
||||
xc_interface *xch = paging->xc_handle;
|
||||
int rc, slot, num = 0;
|
||||
|
||||
+ while ( paging->stack_count > 0 && num < num_pages )
|
||||
+ {
|
||||
+ paging->stack_count--;
|
||||
+ slot = paging->free_slot_stack[paging->stack_count];
|
||||
+ rc = evict_victim(paging, &victims[slot], fd, slot);
|
||||
+ if ( rc == -ENOSPC )
|
||||
+ return;
|
||||
+ if ( rc == -EINTR )
|
||||
+ return;
|
||||
+ num++;
|
||||
+ }
|
||||
+
|
||||
for ( slot = 0; slot < paging->max_pages && num < num_pages; slot++ )
|
||||
{
|
||||
/* Slot is allocated */
|
||||
@@ -807,7 +819,6 @@ static int evict_pages(xenpaging_t *pagi
|
||||
DPRINTF("%d pages evicted\n", num);
|
||||
num++;
|
||||
}
|
||||
- return num;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@@ -939,6 +950,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Clear this pagefile slot */
|
||||
victims[i].gfn = INVALID_MFN;
|
||||
+ if ( paging->stack_count < XENPAGING_PAGEIN_QUEUE_SIZE )
|
||||
+ {
|
||||
+ paging->free_slot_stack[paging->stack_count] = i;
|
||||
+ paging->stack_count++;
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h
|
||||
===================================================================
|
||||
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h
|
||||
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h
|
||||
@@ -56,6 +56,8 @@ typedef struct xenpaging {
|
||||
int policy_mru_size;
|
||||
int use_poll_timeout;
|
||||
int debug;
|
||||
+ int stack_count;
|
||||
+ int free_slot_stack[XENPAGING_PAGEIN_QUEUE_SIZE];
|
||||
unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
|
||||
} xenpaging_t;
|
||||
|
83
xenpaging.speedup-page-out.policy_choose_victim.patch
Normal file
83
xenpaging.speedup-page-out.policy_choose_victim.patch
Normal file
@ -0,0 +1,83 @@
|
||||
Skip longs with all bits set.
|
||||
Iterate only once over the entire gfn range.
|
||||
---
|
||||
tools/xenpaging/policy_default.c | 55 ++++++++++++++++++++++++++-------------
|
||||
1 file changed, 38 insertions(+), 17 deletions(-)
|
||||
|
||||
Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c
|
||||
===================================================================
|
||||
--- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c
|
||||
+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c
|
||||
@@ -80,34 +80,55 @@ int policy_init(xenpaging_t *paging)
|
||||
int policy_choose_victim(xenpaging_t *paging, xenpaging_victim_t *victim)
|
||||
{
|
||||
xc_interface *xch = paging->xc_handle;
|
||||
- unsigned long wrap = current_gfn;
|
||||
+ unsigned long i;
|
||||
|
||||
- do
|
||||
+ /* One iteration over all possible gfns */
|
||||
+ for ( i = 0; i < max_pages; i++)
|
||||
{
|
||||
current_gfn++;
|
||||
if ( current_gfn >= max_pages )
|
||||
current_gfn = 0;
|
||||
- /* Could not nominate any gfn */
|
||||
- if ( wrap == current_gfn )
|
||||
+
|
||||
+ if ( (current_gfn & (BITS_PER_LONG - 1)) == 0 )
|
||||
{
|
||||
- paging->use_poll_timeout = 1;
|
||||
- /* Count wrap arounds */
|
||||
- unconsumed_cleared++;
|
||||
- /* Force retry every few seconds (depends on poll() timeout) */
|
||||
- if ( unconsumed_cleared > 123)
|
||||
+ /* All gfns busy */
|
||||
+ if ( ~bitmap[current_gfn >> ORDER_LONG] == 0 || ~unconsumed[current_gfn >> ORDER_LONG] == 0 )
|
||||
{
|
||||
- /* Force retry of unconsumed gfns */
|
||||
- bitmap_clear(unconsumed, max_pages);
|
||||
- unconsumed_cleared = 0;
|
||||
- DPRINTF("clearing unconsumed, wrap %lx", wrap);
|
||||
- /* One more round before returning ENOSPC */
|
||||
+ current_gfn += BITS_PER_LONG;
|
||||
+ i += BITS_PER_LONG;
|
||||
continue;
|
||||
}
|
||||
- victim->gfn = INVALID_MFN;
|
||||
- return -ENOSPC;
|
||||
}
|
||||
+
|
||||
+ /* gfn busy */
|
||||
+ if ( test_bit(current_gfn, bitmap) )
|
||||
+ continue;
|
||||
+
|
||||
+ /* gfn already tested */
|
||||
+ if ( test_bit(current_gfn, unconsumed) )
|
||||
+ continue;
|
||||
+
|
||||
+ /* gfn found */
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* Could not nominate any gfn */
|
||||
+ if ( i >= max_pages )
|
||||
+ {
|
||||
+ paging->use_poll_timeout = 1;
|
||||
+ /* Count wrap arounds */
|
||||
+ unconsumed_cleared++;
|
||||
+ /* Force retry every few seconds (depends on poll() timeout) */
|
||||
+ if ( unconsumed_cleared > 123)
|
||||
+ {
|
||||
+ /* Force retry of unconsumed gfns in next call */
|
||||
+ bitmap_clear(unconsumed, max_pages);
|
||||
+ unconsumed_cleared = 0;
|
||||
+ DPRINTF("clearing unconsumed, current_gfn %lx", current_gfn);
|
||||
+ }
|
||||
+ victim->gfn = INVALID_MFN;
|
||||
+ return -ENOSPC;
|
||||
}
|
||||
- while ( test_bit(current_gfn, bitmap) || test_bit(current_gfn, unconsumed) );
|
||||
|
||||
set_bit(current_gfn, unconsumed);
|
||||
victim->gfn = current_gfn;
|
@ -0,0 +1,23 @@
|
||||
|
||||
---
|
||||
tools/xenpaging/xenpaging.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
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
|
||||
@@ -721,6 +721,13 @@ static void resume_pages(xenpaging_t *pa
|
||||
|
||||
for ( i = 0; i < paging->max_pages && num < num_pages; i++ )
|
||||
{
|
||||
+ /* Skip empty longs */
|
||||
+ if ( (i & (BITS_PER_LONG - 1)) == 0 && paging->bitmap[i >> ORDER_LONG] == 0 )
|
||||
+ {
|
||||
+ i += BITS_PER_LONG;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
if ( test_bit(i, paging->bitmap) )
|
||||
{
|
||||
paging->pagein_queue[num] = i;
|
@ -34,9 +34,11 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
xen/include/asm-x86/p2m.h | 7 +
|
||||
5 files changed, 205 insertions(+), 30 deletions(-)
|
||||
|
||||
--- a/xen/arch/x86/hvm/hvm.c
|
||||
+++ b/xen/arch/x86/hvm/hvm.c
|
||||
@@ -442,6 +442,8 @@ int hvm_domain_initialise(struct domain
|
||||
Index: xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c
|
||||
===================================================================
|
||||
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/hvm.c
|
||||
+++ xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c
|
||||
@@ -442,6 +442,8 @@ int hvm_domain_initialise(struct domain
|
||||
spin_lock_init(&d->arch.hvm_domain.irq_lock);
|
||||
spin_lock_init(&d->arch.hvm_domain.uc_lock);
|
||||
|
||||
@ -45,8 +47,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
INIT_LIST_HEAD(&d->arch.hvm_domain.msixtbl_list);
|
||||
spin_lock_init(&d->arch.hvm_domain.msixtbl_list_lock);
|
||||
|
||||
--- a/xen/arch/x86/mm/p2m.c
|
||||
+++ b/xen/arch/x86/mm/p2m.c
|
||||
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
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <asm/p2m.h>
|
||||
#include <asm/hvm/vmx/vmx.h> /* ept_p2m_init() */
|
||||
@ -306,7 +310,7 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3197,12 +3358,11 @@ void p2m_mem_paging_resume(struct p2m_do
|
||||
@@ -3198,12 +3359,11 @@ void p2m_mem_paging_resume(struct p2m_do
|
||||
p2m_unlock(p2m);
|
||||
}
|
||||
|
||||
@ -322,8 +326,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
}
|
||||
|
||||
void p2m_mem_access_check(unsigned long gpa, bool_t gla_valid, unsigned long gla,
|
||||
--- a/xen/common/domctl.c
|
||||
+++ b/xen/common/domctl.c
|
||||
Index: xen-4.1.2-testing/xen/common/domctl.c
|
||||
===================================================================
|
||||
--- xen-4.1.2-testing.orig/xen/common/domctl.c
|
||||
+++ xen-4.1.2-testing/xen/common/domctl.c
|
||||
@@ -536,6 +536,9 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
|
||||
goto maxvcpu_out;
|
||||
}
|
||||
@ -334,8 +340,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
ret = 0;
|
||||
|
||||
maxvcpu_out:
|
||||
--- a/xen/include/asm-x86/hvm/domain.h
|
||||
+++ b/xen/include/asm-x86/hvm/domain.h
|
||||
Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/domain.h
|
||||
===================================================================
|
||||
--- xen-4.1.2-testing.orig/xen/include/asm-x86/hvm/domain.h
|
||||
+++ xen-4.1.2-testing/xen/include/asm-x86/hvm/domain.h
|
||||
@@ -87,6 +87,9 @@ struct hvm_domain {
|
||||
|
||||
struct viridian_domain viridian;
|
||||
@ -346,8 +354,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
bool_t hap_enabled;
|
||||
bool_t mem_sharing_enabled;
|
||||
bool_t qemu_mapcache_invalidate;
|
||||
--- a/xen/include/asm-x86/p2m.h
|
||||
+++ b/xen/include/asm-x86/p2m.h
|
||||
Index: xen-4.1.2-testing/xen/include/asm-x86/p2m.h
|
||||
===================================================================
|
||||
--- xen-4.1.2-testing.orig/xen/include/asm-x86/p2m.h
|
||||
+++ xen-4.1.2-testing/xen/include/asm-x86/p2m.h
|
||||
@@ -343,6 +343,8 @@ gfn_to_mfn_type_p2m(struct p2m_domain *p
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user