From 64f5943c90d1f8060cf6cf4660bf924bf619f63db7e6748da08182536edba343 Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Fri, 19 Nov 2010 20:15:50 +0000 Subject: [PATCH] - bnc#651822 - xm snapshot-xxx scripts lead to an XP SP3 HVM domU to chkdsk snapshot-xend.patch snapshot-ioemu-restore.patch - bnc#651957 - Xen: vm-install failed to start xenpaging.enabled.patch - fate#310510 - fix xenpaging xenpaging.signal_handling.patch - unlink pagefile in signal handler OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=84 --- bdrv_open2_flags_2.patch | 4 +- blktap-pv-cdrom.patch | 2 +- ioemu-bdrv-open-CACHE_WB.patch | 2 +- ioemu-blktap-barriers.patch | 12 +-- ioemu-blktap-image-format.patch | 6 +- ioemu-blktap-zero-size.patch | 2 +- snapshot-ioemu-restore.patch | 89 --------------------- snapshot-without-pv-fix.patch | 64 +++++++-------- snapshot-xend.patch | 15 +++- tapdisk-ioemu-shutdown-fix.patch | 6 +- xen.changes | 21 +++++ xen.spec | 101 ++++++++++++------------ xend-domain-lock.patch | 4 +- xenpaging.HVMCOPY_gfn_paged_out.patch | 38 +++++---- xenpaging.autostart.patch | 20 +---- xenpaging.enabled.patch | 36 +++++++++ xenpaging.guest_remove_page.patch | 13 +-- xenpaging.machine_to_phys_mapping.patch | 7 +- xenpaging.signal_handling.patch | 48 +++++++---- 19 files changed, 242 insertions(+), 248 deletions(-) create mode 100644 xenpaging.enabled.patch diff --git a/bdrv_open2_flags_2.patch b/bdrv_open2_flags_2.patch index e5fbb73..ffb6e3a 100644 --- a/bdrv_open2_flags_2.patch +++ b/bdrv_open2_flags_2.patch @@ -2,7 +2,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -237,6 +237,7 @@ static int open_disk(struct td_state *s, +@@ -235,6 +235,7 @@ static int open_disk(struct td_state *s, BlockDriver* drv; char* devname; static int devnumber = 0; @@ -10,7 +10,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c int i; DPRINTF("Opening %s as blktap%d\n", path, devnumber); -@@ -259,7 +260,7 @@ static int open_disk(struct td_state *s, +@@ -257,7 +258,7 @@ static int open_disk(struct td_state *s, DPRINTF("%s driver specified\n", drv ? drv->format_name : "No"); /* Open the image */ diff --git a/blktap-pv-cdrom.patch b/blktap-pv-cdrom.patch index 675b093..670ce5e 100644 --- a/blktap-pv-cdrom.patch +++ b/blktap-pv-cdrom.patch @@ -741,7 +741,7 @@ Index: xen-4.0.1-testing/tools/blktap/lib/blktaplib.h =================================================================== --- xen-4.0.1-testing.orig/tools/blktap/lib/blktaplib.h +++ xen-4.0.1-testing/tools/blktap/lib/blktaplib.h -@@ -225,6 +225,7 @@ typedef struct msg_pid { +@@ -224,6 +224,7 @@ typedef struct msg_pid { #define DISK_TYPE_RAM 3 #define DISK_TYPE_QCOW 4 #define DISK_TYPE_QCOW2 5 diff --git a/ioemu-bdrv-open-CACHE_WB.patch b/ioemu-bdrv-open-CACHE_WB.patch index eb48cff..2d4916d 100644 --- a/ioemu-bdrv-open-CACHE_WB.patch +++ b/ioemu-bdrv-open-CACHE_WB.patch @@ -2,7 +2,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -259,8 +259,11 @@ static int open_disk(struct td_state *s, +@@ -257,8 +257,11 @@ static int open_disk(struct td_state *s, drv = blktap_drivers[i].drv; DPRINTF("%s driver specified\n", drv ? drv->format_name : "No"); diff --git a/ioemu-blktap-barriers.patch b/ioemu-blktap-barriers.patch index 43d7dc5..41d018c 100644 --- a/ioemu-blktap-barriers.patch +++ b/ioemu-blktap-barriers.patch @@ -2,7 +2,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -360,6 +360,15 @@ static void qemu_send_responses(void* op +@@ -358,6 +358,15 @@ static void qemu_send_responses(void* op } /** @@ -18,7 +18,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c * Callback function for the IO message pipe. Reads requests from the ring * and processes them (call qemu read/write functions). * -@@ -378,6 +387,7 @@ static void handle_blktap_iomsg(void* pr +@@ -376,6 +385,7 @@ static void handle_blktap_iomsg(void* pr blkif_t *blkif = s->blkif; tapdev_info_t *info = s->ring_info; int page_size = getpagesize(); @@ -26,7 +26,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c struct aiocb_info *aiocb_info; -@@ -410,7 +420,7 @@ static void handle_blktap_iomsg(void* pr +@@ -408,7 +418,7 @@ static void handle_blktap_iomsg(void* pr /* Don't allow writes on readonly devices */ if ((s->flags & TD_RDONLY) && @@ -35,7 +35,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c blkif->pending_list[idx].status = BLKIF_RSP_ERROR; goto send_response; } -@@ -431,7 +441,7 @@ static void handle_blktap_iomsg(void* pr +@@ -429,7 +439,7 @@ static void handle_blktap_iomsg(void* pr DPRINTF("Sector request failed:\n"); DPRINTF("%s request, idx [%d,%d] size [%llu], " "sector [%llu,%llu]\n", @@ -44,7 +44,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c "WRITE" : "READ"), idx,i, (long long unsigned) -@@ -444,8 +454,14 @@ static void handle_blktap_iomsg(void* pr +@@ -442,8 +452,14 @@ static void handle_blktap_iomsg(void* pr blkif->pending_list[idx].secs_pending += nsects; @@ -60,7 +60,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c case BLKIF_OP_WRITE: aiocb_info = malloc(sizeof(*aiocb_info)); -@@ -465,6 +481,10 @@ static void handle_blktap_iomsg(void* pr +@@ -463,6 +479,10 @@ static void handle_blktap_iomsg(void* pr DPRINTF("ERROR: bdrv_write() == NULL\n"); goto send_response; } diff --git a/ioemu-blktap-image-format.patch b/ioemu-blktap-image-format.patch index 9fd0920..18a499a 100644 --- a/ioemu-blktap-image-format.patch +++ b/ioemu-blktap-image-format.patch @@ -19,7 +19,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -230,9 +230,10 @@ static int map_new_dev(struct td_state * +@@ -228,9 +228,10 @@ static int map_new_dev(struct td_state * return -1; } @@ -31,7 +31,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c char* devname; static int devnumber = 0; int i; -@@ -242,7 +243,22 @@ static int open_disk(struct td_state *s, +@@ -240,7 +241,22 @@ static int open_disk(struct td_state *s, bs = bdrv_new(devname); free(devname); @@ -55,7 +55,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c fprintf(stderr, "Could not open image file %s\n", path); return -ENOMEM; } -@@ -525,7 +541,7 @@ static void handle_blktap_ctrlmsg(void* +@@ -519,7 +535,7 @@ static void handle_blktap_ctrlmsg(void* s = state_init(); /*Open file*/ diff --git a/ioemu-blktap-zero-size.patch b/ioemu-blktap-zero-size.patch index 2ec271e..faa558b 100644 --- a/ioemu-blktap-zero-size.patch +++ b/ioemu-blktap-zero-size.patch @@ -16,7 +16,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c +++ xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -268,6 +268,12 @@ static int open_disk(struct td_state *s, +@@ -266,6 +266,12 @@ static int open_disk(struct td_state *s, s->size = bs->total_sectors; s->sector_size = 512; diff --git a/snapshot-ioemu-restore.patch b/snapshot-ioemu-restore.patch index 9c589c9..489a9ed 100644 --- a/snapshot-ioemu-restore.patch +++ b/snapshot-ioemu-restore.patch @@ -1,92 +1,3 @@ -Index: xen-4.0.1-testing/tools/blktap/drivers/blktapctrl.c -=================================================================== ---- xen-4.0.1-testing.orig/tools/blktap/drivers/blktapctrl.c -+++ xen-4.0.1-testing/tools/blktap/drivers/blktapctrl.c -@@ -348,6 +348,7 @@ static int write_msg(int fd, int msgtype - msg_dev = (msg_newdev_t *)(buf + sizeof(msg_hdr_t)); - msg_dev->devnum = blkif->minor; - msg_dev->domid = blkif->domid; -+ msg_dev->be_id = blkif->be_id; - - break; - -Index: xen-4.0.1-testing/tools/blktap/lib/blktaplib.h -=================================================================== ---- xen-4.0.1-testing.orig/tools/blktap/lib/blktaplib.h -+++ xen-4.0.1-testing/tools/blktap/lib/blktaplib.h -@@ -189,6 +189,7 @@ typedef struct msg_hdr { - typedef struct msg_newdev { - uint8_t devnum; - uint16_t domid; -+ uint32_t be_id; - } msg_newdev_t; - - typedef struct msg_pid { -Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -=================================================================== ---- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c -+++ xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -67,6 +67,8 @@ int write_fd; - static pid_t process; - fd_list_entry_t *fd_start = NULL; - -+extern char* get_snapshot_name(int devid); -+ - static void handle_blktap_iomsg(void* private); - - struct aiocb_info { -@@ -500,6 +502,10 @@ static void handle_blktap_ctrlmsg(void* - - char buf[MSG_SIZE]; - -+#ifndef QEMU_TOOL -+ char *snapshot; -+#endif -+ - length = read(read_fd, buf, MSG_SIZE); - - if (length > 0 && length >= sizeof(msg_hdr_t)) -@@ -555,7 +561,39 @@ static void handle_blktap_ctrlmsg(void* - if (s != NULL) { - ret = ((map_new_dev(s, msg_dev->devnum) - == msg_dev->devnum ? 0: -1)); -- } -+ } -+ -+#ifndef QEMU_TOOL -+ fprintf(stderr, "Reading snapshot name for %d\n", msg_dev->be_id); -+ snapshot = get_snapshot_name(msg_dev->be_id); -+ if (snapshot) { -+ fprintf(stderr, "Using snapshot %s\n", snapshot); -+ ret = bdrv_snapshot_goto(s->bs, snapshot); -+ switch (ret) { -+ case 0: -+ /* Success */ -+ break; -+ case -ENOTSUP: -+ if (s->flags & TD_RDONLY) { -+ fprintf(stderr, "Snapshots not supported for " -+ "image format of a read-only image\n"); -+ } else { -+ fprintf(stderr, "Snapshots not supported " -+ "for this image format"); -+ ret = -1; -+ } -+ break; -+ case -ENOENT: -+ fprintf(stderr, "No such snapshot"); -+ ret = -1; -+ break; -+ default: -+ fprintf(stderr, "Could not load snapshot"); -+ ret = -1; -+ break; -+ } -+ } -+#endif - - memset(buf, 0x00, MSG_SIZE); - msglen = sizeof(msg_hdr_t); Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/xenstore.c =================================================================== --- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/xenstore.c diff --git a/snapshot-without-pv-fix.patch b/snapshot-without-pv-fix.patch index 05e8fac..8a640ae 100644 --- a/snapshot-without-pv-fix.patch +++ b/snapshot-without-pv-fix.patch @@ -18,11 +18,11 @@ Signed-off-by: Li Dongyang tools/ioemu-qemu-xen/hw/xen_blktap.c | 49 +++++++++++++++----- 5 files changed, 213 insertions(+), 14 deletions(-) -diff --git a/tools/blktap/drivers/blktapctrl.c b/tools/blktap/drivers/blktapctrl.c -index bcc3152..8b58e3e 100644 ---- a/tools/blktap/drivers/blktapctrl.c -+++ b/tools/blktap/drivers/blktapctrl.c -@@ -381,7 +381,22 @@ static int write_msg(int fd, int msgtype, void *ptr, void *ptr2) +Index: xen-4.0.1-testing/tools/blktap/drivers/blktapctrl.c +=================================================================== +--- xen-4.0.1-testing.orig/tools/blktap/drivers/blktapctrl.c ++++ xen-4.0.1-testing/tools/blktap/drivers/blktapctrl.c +@@ -380,7 +380,22 @@ static int write_msg(int fd, int msgtype msg->cookie = blkif->cookie; break; @@ -46,7 +46,7 @@ index bcc3152..8b58e3e 100644 default: return -1; } -@@ -476,6 +491,12 @@ static int read_msg(int fd, int msgtype, void *ptr) +@@ -475,6 +490,12 @@ static int read_msg(int fd, int msgtype, DPRINTF("\tPID: [%d]\n",blkif->tappid); } break; @@ -59,7 +59,7 @@ index bcc3152..8b58e3e 100644 default: DPRINTF("UNKNOWN MESSAGE TYPE RECEIVED\n"); ret = 0; -@@ -758,6 +779,63 @@ static int unmap_blktapctrl(blkif_t *blkif) +@@ -757,6 +778,63 @@ static int unmap_blktapctrl(blkif_t *blk return 0; } @@ -123,7 +123,7 @@ index bcc3152..8b58e3e 100644 int open_ctrl_socket(char *devname) { int ret; -@@ -854,6 +932,7 @@ int main(int argc, char *argv[]) +@@ -853,6 +931,7 @@ int main(int argc, char *argv[]) register_new_blkif_hook(blktapctrl_new_blkif); register_new_devmap_hook(map_new_blktapctrl); register_new_unmap_hook(unmap_blktapctrl); @@ -131,11 +131,11 @@ index bcc3152..8b58e3e 100644 ctlfd = blktap_interface_open(); if (ctlfd < 0) { -diff --git a/tools/blktap/lib/blkif.c b/tools/blktap/lib/blkif.c -index 9a19596..11b63dc 100644 ---- a/tools/blktap/lib/blkif.c -+++ b/tools/blktap/lib/blkif.c -@@ -89,6 +89,11 @@ void register_new_blkif_hook(int (*fn)(blkif_t *blkif)) +Index: xen-4.0.1-testing/tools/blktap/lib/blkif.c +=================================================================== +--- xen-4.0.1-testing.orig/tools/blktap/lib/blkif.c ++++ xen-4.0.1-testing/tools/blktap/lib/blkif.c +@@ -89,6 +89,11 @@ void register_new_blkif_hook(int (*fn)(b { new_blkif_hook = fn; } @@ -172,10 +172,10 @@ index 9a19596..11b63dc 100644 void __init_blkif(void) { memset(blkif_hash, 0, sizeof(blkif_hash)); -diff --git a/tools/blktap/lib/blktaplib.h b/tools/blktap/lib/blktaplib.h -index 733b924..2a6a078 100644 ---- a/tools/blktap/lib/blktaplib.h -+++ b/tools/blktap/lib/blktaplib.h +Index: xen-4.0.1-testing/tools/blktap/lib/blktaplib.h +=================================================================== +--- xen-4.0.1-testing.orig/tools/blktap/lib/blktaplib.h ++++ xen-4.0.1-testing/tools/blktap/lib/blktaplib.h @@ -38,6 +38,7 @@ #include #include @@ -198,7 +198,7 @@ index 733b924..2a6a078 100644 void __init_blkif(void); typedef struct busy_state { -@@ -210,6 +213,8 @@ typedef struct msg_pid { +@@ -209,6 +212,8 @@ typedef struct msg_pid { #define CTLMSG_CLOSE_RSP 8 #define CTLMSG_PID 9 #define CTLMSG_PID_RSP 10 @@ -207,11 +207,11 @@ index 733b924..2a6a078 100644 /* disk driver types */ #define MAX_DISK_TYPES 20 -diff --git a/tools/blktap/lib/xenbus.c b/tools/blktap/lib/xenbus.c -index 53db3c8..96f75a5 100644 ---- a/tools/blktap/lib/xenbus.c -+++ b/tools/blktap/lib/xenbus.c -@@ -318,6 +318,72 @@ static int check_image(struct xs_handle *h, struct backend_info *be, +Index: xen-4.0.1-testing/tools/blktap/lib/xenbus.c +=================================================================== +--- xen-4.0.1-testing.orig/tools/blktap/lib/xenbus.c ++++ xen-4.0.1-testing/tools/blktap/lib/xenbus.c +@@ -318,6 +318,72 @@ static int check_image(struct xs_handle return 0; } @@ -284,7 +284,7 @@ index 53db3c8..96f75a5 100644 static void ueblktap_setup(struct xs_handle *h, char *bepath) { struct backend_info *be; -@@ -512,6 +578,9 @@ static void ueblktap_probe(struct xs_handle *h, struct xenbus_watch *w, +@@ -512,6 +578,9 @@ static void ueblktap_probe(struct xs_han be->backpath = bepath; be->frontpath = frontend; @@ -294,11 +294,11 @@ index 53db3c8..96f75a5 100644 list_add(&be->list, &belist); -diff --git a/tools/ioemu-qemu-xen/hw/xen_blktap.c b/tools/ioemu-qemu-xen/hw/xen_blktap.c -index c2236fd..c925283 100644 ---- a/tools/ioemu-qemu-xen/hw/xen_blktap.c -+++ b/tools/ioemu-qemu-xen/hw/xen_blktap.c -@@ -83,8 +83,18 @@ static void unmap_disk(struct td_state *s) +Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c +=================================================================== +--- xen-4.0.1-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c ++++ xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c +@@ -81,8 +81,18 @@ static void unmap_disk(struct td_state * { tapdev_info_t *info = s->ring_info; fd_list_entry_t *entry; @@ -317,7 +317,7 @@ index c2236fd..c925283 100644 if (info != NULL && info->mem > 0) munmap(info->mem, getpagesize() * BLKTAP_MMAP_REGION_SIZE); -@@ -244,18 +254,6 @@ static int open_disk(struct td_state *s, char *path, int readonly) +@@ -242,18 +252,6 @@ static int open_disk(struct td_state *s, s->info = ((s->flags & TD_RDONLY) ? VDISK_READONLY : 0); @@ -336,7 +336,7 @@ index c2236fd..c925283 100644 return 0; } -@@ -496,7 +494,7 @@ static void handle_blktap_ctrlmsg(void* private) +@@ -494,7 +492,7 @@ static void handle_blktap_ctrlmsg(void* msg_hdr_t *msg; msg_newdev_t *msg_dev; msg_pid_t *msg_pid; @@ -345,7 +345,7 @@ index c2236fd..c925283 100644 struct td_state *s = NULL; fd_list_entry_t *entry; -@@ -622,6 +620,31 @@ static void handle_blktap_ctrlmsg(void* private) +@@ -584,6 +582,31 @@ static void handle_blktap_ctrlmsg(void* len = write(write_fd, buf, msglen); break; diff --git a/snapshot-xend.patch b/snapshot-xend.patch index 0d11d6a..f08848f 100644 --- a/snapshot-xend.patch +++ b/snapshot-xend.patch @@ -115,7 +115,16 @@ Index: xen-4.0.1-testing/tools/python/xen/xend/XendCheckpoint.py from xen.xend import XendDomain try: -@@ -112,52 +112,61 @@ def save(fd, dominfo, network, live, dst +@@ -78,6 +78,8 @@ def save(fd, dominfo, network, live, dst + write_exact(fd, SIGNATURE, "could not write guest state file: signature") + + sxprep = dominfo.sxpr() ++ if name: ++ sxprep.append(['snapshotname', name]) + + if node > -1: + insert_after(sxprep,'vcpus',['node', str(node)]) +@@ -112,52 +114,61 @@ def save(fd, dominfo, network, live, dst image_cfg = dominfo.info.get('image', {}) hvm = dominfo.info.is_hvm() @@ -223,7 +232,7 @@ Index: xen-4.0.1-testing/tools/python/xen/xend/XendCheckpoint.py if checkpoint: dominfo.resumeDomain() -@@ -221,6 +230,71 @@ def restore(xd, fd, dominfo = None, paus +@@ -221,6 +232,71 @@ def restore(xd, fd, dominfo = None, paus if othervm is not None and othervm.domid is not None: raise VmError("Domain '%s' already exists with ID '%d'" % (domconfig["name_label"], othervm.domid)) @@ -295,7 +304,7 @@ Index: xen-4.0.1-testing/tools/python/xen/xend/XendCheckpoint.py if dominfo: dominfo.resume() else: -@@ -329,24 +403,7 @@ def restore(xd, fd, dominfo = None, paus +@@ -329,24 +405,7 @@ def restore(xd, fd, dominfo = None, paus dominfo.completeRestore(handler.store_mfn, handler.console_mfn) diff --git a/tapdisk-ioemu-shutdown-fix.patch b/tapdisk-ioemu-shutdown-fix.patch index 467490c..f5de870 100644 --- a/tapdisk-ioemu-shutdown-fix.patch +++ b/tapdisk-ioemu-shutdown-fix.patch @@ -27,8 +27,8 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c +int connected_disks = 0; fd_list_entry_t *fd_start = NULL; - extern char* get_snapshot_name(int devid); -@@ -545,6 +546,7 @@ static void handle_blktap_ctrlmsg(void* + static void handle_blktap_iomsg(void* private); +@@ -539,6 +540,7 @@ static void handle_blktap_ctrlmsg(void* /* Allocate the disk structs */ s = state_init(); @@ -36,7 +36,7 @@ Index: xen-4.0.1-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c /*Open file*/ if (s == NULL || open_disk(s, path, msg->drivertype, msg->readonly)) { -@@ -627,7 +629,8 @@ static void handle_blktap_ctrlmsg(void* +@@ -589,7 +591,8 @@ static void handle_blktap_ctrlmsg(void* case CTLMSG_CLOSE: s = get_state(msg->cookie); if (s) unmap_disk(s); diff --git a/xen.changes b/xen.changes index bef111a..df6cb1f 100644 --- a/xen.changes +++ b/xen.changes @@ -1,3 +1,24 @@ +------------------------------------------------------------------- +Fri Nov 19 11:48:43 CST 2010 - lidongyang@novell.com + +- bnc#651822 - xm snapshot-xxx scripts lead to an XP SP3 HVM domU + to chkdsk + snapshot-xend.patch + snapshot-ioemu-restore.patch + +------------------------------------------------------------------- +Wed Nov 17 15:20:02 MST 2010 - carnold@novell.com + +- bnc#651957 - Xen: vm-install failed to start + xenpaging.enabled.patch + +------------------------------------------------------------------- +Wed Nov 17 10:35:52 CET 2010 - ohering@suse.de + +- fate#310510 - fix xenpaging + xenpaging.signal_handling.patch + - unlink pagefile in signal handler + ------------------------------------------------------------------- Fri Nov 12 09:48:14 MST 2010 - carnold@novell.com diff --git a/xen.spec b/xen.spec index 1f7f3f9..6dbc725 100644 --- a/xen.spec +++ b/xen.spec @@ -25,35 +25,35 @@ ExclusiveArch: %ix86 x86_64 %define changeset 21326 %define xen_build_dir xen-4.0.1-testing %define with_kmp 1 -BuildRequires: LibVNCServer-devel -BuildRequires: SDL-devel -BuildRequires: automake -BuildRequires: bin86 -BuildRequires: curl-devel -BuildRequires: dev86 -BuildRequires: graphviz -BuildRequires: latex2html -BuildRequires: libjpeg-devel -BuildRequires: libxml2-devel -BuildRequires: ncurses-devel -BuildRequires: openssl -BuildRequires: openssl-devel -BuildRequires: pciutils-devel -BuildRequires: python-devel -BuildRequires: texinfo -BuildRequires: transfig +BuildRequires: LibVNCServer-devel +BuildRequires: SDL-devel +BuildRequires: automake +BuildRequires: bin86 +BuildRequires: curl-devel +BuildRequires: dev86 +BuildRequires: graphviz +BuildRequires: latex2html +BuildRequires: libjpeg-devel +BuildRequires: libxml2-devel +BuildRequires: ncurses-devel +BuildRequires: openssl +BuildRequires: openssl-devel +BuildRequires: pciutils-devel +BuildRequires: python-devel +BuildRequires: texinfo +BuildRequires: transfig %if %suse_version <= 1110 -BuildRequires: pmtools +BuildRequires: pmtools %else -BuildRequires: acpica +BuildRequires: acpica %endif %if %suse_version >= 1030 -BuildRequires: texlive -BuildRequires: texlive-latex +BuildRequires: texlive +BuildRequires: texlive-latex %else -BuildRequires: te_ams -BuildRequires: te_latex -BuildRequires: tetex +BuildRequires: te_ams +BuildRequires: te_latex +BuildRequires: tetex %endif %ifarch x86_64 BuildRequires: glibc-32bit glibc-devel-32bit @@ -273,31 +273,32 @@ Patch704: hv_apic.patch # Build patch Patch999: tmp_build.patch # FATE 310510 -Patch10001: xenpaging.tools_xenpaging_cleanup.patch -Patch10002: xenpaging.pageout_policy.patch -Patch10003: xenpaging.xs_daemon_close.patch -Patch10004: xenpaging.get_paged_frame.patch -Patch10005: xenpaging.makefile.patch -Patch10010: xenpaging.policy_linear.patch -Patch10011: xenpaging.pagefile.patch -Patch10012: xenpaging.xenpaging_init.patch -Patch10013: xenpaging.mem_paging_tool_qemu_flush_cache.patch -Patch10014: xenpaging.machine_to_phys_mapping.patch -Patch10015: xenpaging.populate_only_if_paged.patch -Patch10017: xenpaging.autostart.patch -Patch10018: xenpaging.signal_handling.patch -Patch10019: xenpaging.MRU_SIZE.patch -Patch10020: xenpaging.guest_remove_page.patch -Patch10021: xenpaging.mem_event_check_ring-free_requests.patch -Patch10022: xenpaging.blacklist.patch -Patch10023: xenpaging.autostart_delay.patch -Patch10024: xenpaging.page_already_populated.patch -Patch10025: xenpaging.notify_policy_only_once.patch -Patch10026: xenpaging.num_pages_equal_max_pages.patch -Patch10027: xenpaging.p2m_mem_paging_populate_if_p2m_ram_paged.patch -Patch10028: xenpaging.HVMCOPY_gfn_paged_out.patch -Patch10029: xenpaging.optimize_p2m_mem_paging_populate.patch -Patch10040: xenpaging.doc.patch +Patch10001: xenpaging.tools_xenpaging_cleanup.patch +Patch10002: xenpaging.pageout_policy.patch +Patch10003: xenpaging.xs_daemon_close.patch +Patch10004: xenpaging.get_paged_frame.patch +Patch10005: xenpaging.makefile.patch +Patch10010: xenpaging.policy_linear.patch +Patch10011: xenpaging.pagefile.patch +Patch10012: xenpaging.xenpaging_init.patch +Patch10013: xenpaging.mem_paging_tool_qemu_flush_cache.patch +Patch10014: xenpaging.machine_to_phys_mapping.patch +Patch10015: xenpaging.populate_only_if_paged.patch +Patch10017: xenpaging.autostart.patch +Patch10018: xenpaging.signal_handling.patch +Patch10019: xenpaging.MRU_SIZE.patch +Patch10020: xenpaging.guest_remove_page.patch +Patch10021: xenpaging.mem_event_check_ring-free_requests.patch +Patch10022: xenpaging.blacklist.patch +Patch10023: xenpaging.autostart_delay.patch +Patch10024: xenpaging.page_already_populated.patch +Patch10025: xenpaging.notify_policy_only_once.patch +Patch10026: xenpaging.num_pages_equal_max_pages.patch +Patch10027: xenpaging.p2m_mem_paging_populate_if_p2m_ram_paged.patch +Patch10028: xenpaging.HVMCOPY_gfn_paged_out.patch +Patch10029: xenpaging.optimize_p2m_mem_paging_populate.patch +Patch10030: xenpaging.enabled.patch +Patch10040: xenpaging.doc.patch Url: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/ BuildRoot: %{_tmppath}/%{name}-%{version}-build #%define pysite %(python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib()") @@ -811,8 +812,10 @@ Authors: %patch10027 -p1 %patch10028 -p1 %patch10029 -p1 +%patch10030 -p1 %patch10040 -p1 + %build XEN_EXTRAVERSION=%version-%release XEN_EXTRAVERSION=${XEN_EXTRAVERSION#%{xvers}} diff --git a/xend-domain-lock.patch b/xend-domain-lock.patch index 58795c4..e87a14a 100644 --- a/xend-domain-lock.patch +++ b/xend-domain-lock.patch @@ -232,7 +232,7 @@ Index: xen-4.0.1-testing/tools/python/xen/xend/XendCheckpoint.py =================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xend/XendCheckpoint.py +++ xen-4.0.1-testing/tools/python/xen/xend/XendCheckpoint.py -@@ -131,6 +131,7 @@ def save(fd, dominfo, network, live, dst +@@ -133,6 +133,7 @@ def save(fd, dominfo, network, live, dst dominfo.shutdown('suspend') dominfo.waitForSuspend() if line in ('suspend', 'suspended'): @@ -240,7 +240,7 @@ Index: xen-4.0.1-testing/tools/python/xen/xend/XendCheckpoint.py dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2, domain_name) log.info("Domain %d suspended.", dominfo.getDomid()) -@@ -408,6 +409,7 @@ def restore(xd, fd, dominfo = None, paus +@@ -410,6 +411,7 @@ def restore(xd, fd, dominfo = None, paus if not paused: dominfo.unpause() diff --git a/xenpaging.HVMCOPY_gfn_paged_out.patch b/xenpaging.HVMCOPY_gfn_paged_out.patch index a26d9b2..97f1cab 100644 --- a/xenpaging.HVMCOPY_gfn_paged_out.patch +++ b/xenpaging.HVMCOPY_gfn_paged_out.patch @@ -13,8 +13,8 @@ Signed-off-by: Olaf Hering --- xen/arch/x86/hvm/hvm.c | 4 ++++ - xen/common/memory.c | 43 ++++++++++++++++++++++++++++++++++++++----- - 2 files changed, 42 insertions(+), 5 deletions(-) + xen/common/memory.c | 44 +++++++++++++++++++++++++++++++++++++++----- + 2 files changed, 43 insertions(+), 5 deletions(-) --- xen-4.0.1-testing.orig/xen/arch/x86/hvm/hvm.c +++ xen-4.0.1-testing/xen/arch/x86/hvm/hvm.c @@ -66,7 +66,7 @@ Signed-off-by: Olaf Hering { struct page_info *page; unsigned long i, j; -+ unsigned long ctg_ret; ++ unsigned long cftg_ret; xen_pfn_t gpfn, mfn; struct domain *d = a->domain; @@ -75,10 +75,10 @@ Signed-off-by: Olaf Hering } - if ( unlikely(__copy_from_guest_offset(&gpfn, a->extent_list, i, 1)) ) -+ j = __copy_from_guest_offset(&gpfn, a->extent_list, i, 1); -+ if ( unlikely(j) ) ++ cftg_ret = __copy_from_guest_offset(&gpfn, a->extent_list, i, 1); ++ if ( unlikely(cftg_ret) ) + { -+ if ( (long)j == -EAGAIN ) ++ if ( (long)cftg_ret == -EAGAIN ) + a->preempted = 1; goto out; + } @@ -90,36 +90,44 @@ Signed-off-by: Olaf Hering /* Inform the domain of the new page's machine address. */ - if ( unlikely(__copy_to_guest_offset(a->extent_list, i, &mfn, 1)) ) -+ ctg_ret = __copy_to_guest_offset(a->extent_list, i, &mfn, 1); -+ if ( unlikely(ctg_ret) ) ++ cftg_ret = __copy_to_guest_offset(a->extent_list, i, &mfn, 1); ++ if ( unlikely(cftg_ret) ) + { + for ( j = 0; j < (1 << a->extent_order); j++ ) + set_gpfn_from_mfn(mfn + j, INVALID_M2P_ENTRY); + guest_physmap_remove_page(d, gpfn, mfn, a->extent_order); + free_domheap_pages(page, a->extent_order); -+ if ( (long)ctg_ret == -EAGAIN ) ++ if ( (long)cftg_ret == -EAGAIN ) + a->preempted = 1; goto out; + } } } } -@@ -226,8 +248,13 @@ static void decrease_reservation(struct +@@ -212,6 +234,7 @@ int guest_remove_page(struct domain *d, + static void decrease_reservation(struct memop_args *a) + { + unsigned long i, j; ++ unsigned long cfg_ret; + xen_pfn_t gmfn; + + if ( !guest_handle_subrange_okay(a->extent_list, a->nr_done, +@@ -226,8 +249,13 @@ static void decrease_reservation(struct goto out; } - if ( unlikely(__copy_from_guest_offset(&gmfn, a->extent_list, i, 1)) ) -+ j = __copy_from_guest_offset(&gmfn, a->extent_list, i, 1); -+ if ( unlikely(j) ) ++ cfg_ret = __copy_from_guest_offset(&gmfn, a->extent_list, i, 1); ++ if ( unlikely(cfg_ret) ) + { -+ if ( (long)j == -EAGAIN ) ++ if ( (long)cfg_ret == -EAGAIN ) + a->preempted = 1; goto out; + } if ( tb_init_done ) { -@@ -511,6 +538,7 @@ long do_memory_op(unsigned long cmd, XEN +@@ -511,6 +539,7 @@ long do_memory_op(unsigned long cmd, XEN int rc, op; unsigned int address_bits; unsigned long start_extent; @@ -127,7 +135,7 @@ Signed-off-by: Olaf Hering struct xen_memory_reservation reservation; struct memop_args args; domid_t domid; -@@ -524,8 +552,13 @@ long do_memory_op(unsigned long cmd, XEN +@@ -524,8 +553,13 @@ long do_memory_op(unsigned long cmd, XEN case XENMEM_populate_physmap: start_extent = cmd >> MEMOP_EXTENT_SHIFT; diff --git a/xenpaging.autostart.patch b/xenpaging.autostart.patch index 28004c7..ada2e71 100644 --- a/xenpaging.autostart.patch +++ b/xenpaging.autostart.patch @@ -9,6 +9,10 @@ TODO: parse config values like 42K, 42M, 42G, 42% Signed-off-by: Olaf Hering --- +v2: + unlink logfile instead of truncating it. + allows hardlinking for further inspection + tools/examples/xmexample.hvm | 3 + tools/python/README.XendConfig | 1 tools/python/README.sxpcfg | 1 @@ -19,8 +23,6 @@ Signed-off-by: Olaf Hering tools/python/xen/xm/xenapi_create.py | 1 8 files changed, 111 insertions(+) -Index: xen-4.0.1-testing/tools/examples/xmexample.hvm -=================================================================== --- xen-4.0.1-testing.orig/tools/examples/xmexample.hvm +++ xen-4.0.1-testing/tools/examples/xmexample.hvm @@ -127,6 +127,9 @@ disk = [ 'file:/var/lib/xen/images/disk. @@ -33,8 +35,6 @@ Index: xen-4.0.1-testing/tools/examples/xmexample.hvm #----------------------------------------------------------------------------- # boot on floppy (a), hard disk (c), Network (n) or CD-ROM (d) # default: hard disk, cd-rom, floppy -Index: xen-4.0.1-testing/tools/python/README.XendConfig -=================================================================== --- xen-4.0.1-testing.orig/tools/python/README.XendConfig +++ xen-4.0.1-testing/tools/python/README.XendConfig @@ -120,6 +120,7 @@ otherConfig @@ -45,8 +45,6 @@ Index: xen-4.0.1-testing/tools/python/README.XendConfig image.hvm.display image.hvm.xauthority image.hvm.vncconsole -Index: xen-4.0.1-testing/tools/python/README.sxpcfg -=================================================================== --- xen-4.0.1-testing.orig/tools/python/README.sxpcfg +++ xen-4.0.1-testing/tools/python/README.sxpcfg @@ -51,6 +51,7 @@ image @@ -57,8 +55,6 @@ Index: xen-4.0.1-testing/tools/python/README.sxpcfg - display - xauthority - vncconsole -Index: xen-4.0.1-testing/tools/python/xen/xend/XendConfig.py -=================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xend/XendConfig.py +++ xen-4.0.1-testing/tools/python/xen/xend/XendConfig.py @@ -145,6 +145,7 @@ XENAPI_PLATFORM_CFG_TYPES = { @@ -78,8 +74,6 @@ Index: xen-4.0.1-testing/tools/python/xen/xend/XendConfig.py if 'timer_mode' not in self['platform']: self['platform']['timer_mode'] = 1 if 'viridian' not in self['platform']: -Index: xen-4.0.1-testing/tools/python/xen/xend/XendDomainInfo.py -=================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-4.0.1-testing/tools/python/xen/xend/XendDomainInfo.py @@ -2442,6 +2442,7 @@ class XendDomainInfo: @@ -102,8 +96,6 @@ Index: xen-4.0.1-testing/tools/python/xen/xend/XendDomainInfo.py else: log.debug("No device model") -Index: xen-4.0.1-testing/tools/python/xen/xend/image.py -=================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xend/image.py +++ xen-4.0.1-testing/tools/python/xen/xend/image.py @@ -122,12 +122,14 @@ class ImageHandler: @@ -217,8 +209,6 @@ Index: xen-4.0.1-testing/tools/python/xen/xend/image.py def createDeviceModel(self, restore = False): if self.device_model is None: return -Index: xen-4.0.1-testing/tools/python/xen/xm/create.py -=================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xm/create.py +++ xen-4.0.1-testing/tools/python/xen/xm/create.py @@ -495,6 +495,10 @@ gopts.var('nfs_root', val="PATH", @@ -240,8 +230,6 @@ Index: xen-4.0.1-testing/tools/python/xen/xm/create.py 'device_model', 'display', 'fda', 'fdb', 'gfx_passthru', 'guest_os_type', -Index: xen-4.0.1-testing/tools/python/xen/xm/xenapi_create.py -=================================================================== --- xen-4.0.1-testing.orig/tools/python/xen/xm/xenapi_create.py +++ xen-4.0.1-testing/tools/python/xen/xm/xenapi_create.py @@ -1086,6 +1086,7 @@ class sxp2xml: diff --git a/xenpaging.enabled.patch b/xenpaging.enabled.patch new file mode 100644 index 0000000..2173011 --- /dev/null +++ b/xenpaging.enabled.patch @@ -0,0 +1,36 @@ +Index: xen-4.0.1-testing/tools/python/xen/xend/image.py +=================================================================== +--- xen-4.0.1-testing.orig/tools/python/xen/xend/image.py ++++ xen-4.0.1-testing/tools/python/xen/xend/image.py +@@ -123,18 +123,19 @@ class ImageHandler: + + self.device_model = vmConfig['platform'].get('device_model') + self.xenpaging = vmConfig['platform'].get('xenpaging') +- self.xenpaging_delay = xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay" % self.vm.info['name_label']) +- if self.xenpaging_delay == None: +- log.warn("XXX creating /local/domain/0/xenpaging/%s" % self.vm.info['name_label']) +- xstransact.Mkdir("/local/domain/0/xenpaging/%s" % self.vm.info['name_label']) +- xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay', '7.0')) +- xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_inc', '0.1')) +- xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_use', '5')) +- xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_used', '0')) +- self.xenpaging_delay = float(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay" % self.vm.info['name_label'])) +- self.xenpaging_delay_inc = float(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_inc" % self.vm.info['name_label'])) +- self.xenpaging_delay_use = int(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_use" % self.vm.info['name_label'])) +- self.xenpaging_delay_used = int(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_used" % self.vm.info['name_label'])) ++ if self.xenpaging: ++ self.xenpaging_delay = xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay" % self.vm.info['name_label']) ++ if self.xenpaging_delay == None: ++ log.warn("XXX creating /local/domain/0/xenpaging/%s" % self.vm.info['name_label']) ++ xstransact.Mkdir("/local/domain/0/xenpaging/%s" % self.vm.info['name_label']) ++ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay', '7.0')) ++ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_inc', '0.1')) ++ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_use', '5')) ++ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_used', '0')) ++ self.xenpaging_delay = float(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay" % self.vm.info['name_label'])) ++ self.xenpaging_delay_inc = float(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_inc" % self.vm.info['name_label'])) ++ self.xenpaging_delay_use = int(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_use" % self.vm.info['name_label'])) ++ self.xenpaging_delay_used = int(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_used" % self.vm.info['name_label'])) + + self.display = vmConfig['platform'].get('display') + self.xauthority = vmConfig['platform'].get('xauthority') diff --git a/xenpaging.guest_remove_page.patch b/xenpaging.guest_remove_page.patch index e6f9c46..9578c3f 100644 --- a/xenpaging.guest_remove_page.patch +++ b/xenpaging.guest_remove_page.patch @@ -5,6 +5,9 @@ drop reference to the gfn. Signed-off-by: Olaf Hering --- +v2: + resume dropped page to unpause vcpus + tools/xenpaging/xenpaging.c | 17 +++++++--- xen/arch/x86/mm/p2m.c | 65 +++++++++++++++++++++++++++++++---------- xen/common/memory.c | 6 +++ @@ -14,7 +17,7 @@ Signed-off-by: Olaf Hering --- xen-4.0.1-testing.orig/tools/xenpaging/xenpaging.c +++ xen-4.0.1-testing/tools/xenpaging/xenpaging.c -@@ -598,12 +598,19 @@ int main(int argc, char *argv[]) +@@ -600,12 +600,19 @@ int main(int argc, char *argv[]) goto out; } @@ -112,8 +115,8 @@ Signed-off-by: Olaf Hering - set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn); - p2m_unlock(d->arch.p2m); - } else { -- gdprintk(XENLOG_ERR, "invalid mfn %lx for gfn %lx p2mt %x\n", -- mfn_x(mfn), rsp.gfn, p2mt); +- gdprintk(XENLOG_ERR, "invalid mfn %lx for gfn %lx p2mt %x flags %lx\n", +- mfn_x(mfn), rsp.gfn, p2mt, (unsigned long)rsp.flags); + /* Fix p2m entry */ + mfn = gfn_to_mfn(d, rsp.gfn, &p2mt); + if (mfn_valid(mfn)) @@ -123,8 +126,8 @@ Signed-off-by: Olaf Hering + set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn); + p2m_unlock(d->arch.p2m); + } else { -+ gdprintk(XENLOG_ERR, "invalid mfn %lx for gfn %lx p2mt %x\n", -+ mfn_x(mfn), rsp.gfn, p2mt); ++ gdprintk(XENLOG_ERR, "invalid mfn %lx for gfn %lx p2mt %x flags %lx\n", ++ mfn_x(mfn), rsp.gfn, p2mt, (unsigned long)rsp.flags); + } } diff --git a/xenpaging.machine_to_phys_mapping.patch b/xenpaging.machine_to_phys_mapping.patch index ccd0bad..ab56330 100644 --- a/xenpaging.machine_to_phys_mapping.patch +++ b/xenpaging.machine_to_phys_mapping.patch @@ -26,7 +26,8 @@ passed gfn. Signed-off-by: Olaf Hering --- -v2: check wether mfn is valid +v2: + call set_gpfn_from_mfn only if mfn is valid xen/arch/x86/mm/p2m.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) @@ -54,8 +55,8 @@ v2: check wether mfn is valid + set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn); + p2m_unlock(d->arch.p2m); + } else { -+ gdprintk(XENLOG_ERR, "invalid mfn %lx for gfn %lx p2mt %x\n", -+ mfn_x(mfn), rsp.gfn, p2mt); ++ gdprintk(XENLOG_ERR, "invalid mfn %lx for gfn %lx p2mt %x flags %lx\n", ++ mfn_x(mfn), rsp.gfn, p2mt, (unsigned long)rsp.flags); + } /* Unpause domain */ diff --git a/xenpaging.signal_handling.patch b/xenpaging.signal_handling.patch index 7bf9475..c8b168e 100644 --- a/xenpaging.signal_handling.patch +++ b/xenpaging.signal_handling.patch @@ -6,8 +6,12 @@ Remove paging file on exit. Signed-off-by: Olaf Hering --- - tools/xenpaging/xenpaging.c | 39 +++++++++++++++++++++++++++++++-------- - 1 file changed, 31 insertions(+), 8 deletions(-) +v2: + unlink pagefile in signal handler to avoid stale pagefiles if xenpaging is + stuck in some loop + + tools/xenpaging/xenpaging.c | 42 +++++++++++++++++++++++++++++++++--------- + 1 file changed, 33 insertions(+), 9 deletions(-) --- xen-4.0.1-testing.orig/tools/xenpaging/xenpaging.c +++ xen-4.0.1-testing/tools/xenpaging/xenpaging.c @@ -19,19 +23,22 @@ Signed-off-by: Olaf Hering #include #include -@@ -40,6 +41,11 @@ +@@ -40,6 +41,14 @@ #define DPRINTF(...) ((void)0) #endif ++static char filename[80]; +static int interrupted; +static void close_handler(int sig) +{ + interrupted = sig; ++ if ( filename[0] ) ++ unlink(filename); +} static void *init_page(void) { -@@ -244,7 +250,6 @@ int xenpaging_teardown(xenpaging_t *pagi +@@ -244,7 +253,6 @@ int xenpaging_teardown(xenpaging_t *pagi if ( rc != 0 ) { ERROR("Error tearing down domain paging in xen"); @@ -39,7 +46,7 @@ Signed-off-by: Olaf Hering } /* Unbind VIRQ */ -@@ -252,7 +257,6 @@ int xenpaging_teardown(xenpaging_t *pagi +@@ -252,7 +260,6 @@ int xenpaging_teardown(xenpaging_t *pagi if ( rc != 0 ) { ERROR("Error unbinding event port"); @@ -47,7 +54,7 @@ Signed-off-by: Olaf Hering } paging->mem_event.port = -1; -@@ -261,7 +265,6 @@ int xenpaging_teardown(xenpaging_t *pagi +@@ -261,7 +268,6 @@ int xenpaging_teardown(xenpaging_t *pagi if ( rc != 0 ) { ERROR("Error closing event channel"); @@ -55,7 +62,7 @@ Signed-off-by: Olaf Hering } paging->mem_event.xce_handle = -1; -@@ -270,7 +273,6 @@ int xenpaging_teardown(xenpaging_t *pagi +@@ -270,7 +276,6 @@ int xenpaging_teardown(xenpaging_t *pagi if ( rc != 0 ) { ERROR("Error closing connection to xen"); @@ -63,7 +70,7 @@ Signed-off-by: Olaf Hering } paging->xc_handle = -1; -@@ -375,7 +377,7 @@ int xenpaging_evict_page(xenpaging_t *pa +@@ -375,7 +380,7 @@ int xenpaging_evict_page(xenpaging_t *pa return ret; } @@ -72,7 +79,7 @@ Signed-off-by: Olaf Hering { int ret; -@@ -455,6 +457,11 @@ static int evict_victim(xenpaging_t *pag +@@ -455,6 +460,11 @@ static int evict_victim(xenpaging_t *pag goto out; } @@ -84,7 +91,7 @@ Signed-off-by: Olaf Hering ret = xc_mem_paging_nominate(paging->xc_handle, paging->mem_event.domain_id, victim->gfn); if ( ret == 0 ) -@@ -479,6 +486,7 @@ static int evict_victim(xenpaging_t *pag +@@ -479,6 +489,7 @@ static int evict_victim(xenpaging_t *pag int main(int argc, char *argv[]) { @@ -92,7 +99,15 @@ Signed-off-by: Olaf Hering domid_t domain_id; int num_pages; xenpaging_t *paging; -@@ -513,7 +521,7 @@ int main(int argc, char *argv[]) +@@ -491,7 +502,6 @@ int main(int argc, char *argv[]) + + 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; +- char filename[80]; + int fd; + + if ( argc != 3 ) +@@ -513,7 +523,7 @@ int main(int argc, char *argv[]) if ( paging == NULL ) { ERROR("Error initialising paging"); @@ -101,7 +116,7 @@ Signed-off-by: Olaf Hering } /* Open file */ -@@ -522,9 +530,18 @@ int main(int argc, char *argv[]) +@@ -522,9 +532,18 @@ int main(int argc, char *argv[]) if ( fd < 0 ) { perror("failed to open file"); @@ -121,7 +136,7 @@ Signed-off-by: Olaf Hering /* Evict pages */ memset(victims, 0, sizeof(xenpaging_victim_t) * num_pages); for ( i = 0; i < num_pages; i++ ) -@@ -532,6 +549,8 @@ int main(int argc, char *argv[]) +@@ -532,6 +551,8 @@ int main(int argc, char *argv[]) rc = evict_victim(paging, domain_id, &victims[i], fd, i); if ( rc == -ENOSPC ) break; @@ -130,7 +145,7 @@ Signed-off-by: Olaf Hering if ( i % 100 == 0 ) DPRINTF("%d pages evicted\n", i); } -@@ -539,7 +558,7 @@ int main(int argc, char *argv[]) +@@ -539,7 +560,7 @@ int main(int argc, char *argv[]) DPRINTF("pages evicted\n"); /* Swap pages in and out */ @@ -139,19 +154,18 @@ Signed-off-by: Olaf Hering { /* Wait for Xen to signal that a page needs paged in */ rc = xc_wait_for_event_or_timeout(paging->mem_event.xce_handle, 100); -@@ -630,8 +649,11 @@ int main(int argc, char *argv[]) +@@ -630,8 +651,10 @@ int main(int argc, char *argv[]) } } } + DPRINTF("xenpaging got signal %d\n", interrupted); out: -+ unlink(filename); + close(fd); free(victims); /* Tear down domain paging */ -@@ -642,6 +664,7 @@ int main(int argc, char *argv[]) +@@ -642,6 +665,7 @@ int main(int argc, char *argv[]) if ( rc == 0 ) rc = rc1;