Fix save/restore (for SMP guests in particularl); the blkfront suspend code
authorshand@ubuntu.eng.hq.xensource.com <shand@ubuntu.eng.hq.xensource.com>
Tue, 30 Aug 2005 03:20:55 +0000 (19:20 -0800)
committershand@ubuntu.eng.hq.xensource.com <shand@ubuntu.eng.hq.xensource.com>
Tue, 30 Aug 2005 03:20:55 +0000 (19:20 -0800)
was failing to unbind its irq handler correctly which (on SMP) caused the
guest to BUG() on resume when trying to request its callfunc_irq. Plus a
few small cosmetic changes.

Signed-off-by: Steven Hand <steven@xensource.com>
/bin/bash: :x: command not found

linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
tools/libxc/xc_linux_restore.c

index 9085609dc0e0db4f69fad07026d47618ff9ebb65..82448a527efffe6ce346a299530438fa362cac10 100644 (file)
@@ -65,17 +65,12 @@ static int shutting_down = SHUTDOWN_INVALID;
 #define cpu_up(x) (-EOPNOTSUPP)
 #endif
 
-#ifdef CONFIG_SMP
-#endif
 
 static int __do_suspend(void *ignore)
 {
     int i, j;
     suspend_record_t *suspend_record;
 
-    /* Hmmm... a cleaner interface to suspend/resume blkdevs would be nice. */
-       /* XXX SMH: yes it would :-( */ 
-
 #ifdef CONFIG_XEN_USB_FRONTEND
     extern void usbif_resume();
 #else
@@ -108,7 +103,8 @@ static int __do_suspend(void *ignore)
 
 #if defined(CONFIG_SMP) && !defined(CONFIG_HOTPLUG_CPU)
     if (num_online_cpus() > 1) {
-       printk(KERN_WARNING "Can't suspend SMP guests without CONFIG_HOTPLUG_CPU\n");
+       printk(KERN_WARNING 
+               "Can't suspend SMP guests without CONFIG_HOTPLUG_CPU\n");
        return -EOPNOTSUPP;
     }
 #endif
index cd6c341d142aec3e646f4c51c9f2a4a4b1ca45a7..d3caf467c85122297bb11d2033197a8d8a179a30 100644 (file)
@@ -368,7 +368,7 @@ static void blkif_free(struct blkfront_info *info)
                free_page((unsigned long)info->ring.sring);
                info->ring.sring = NULL;
        }
-       unbind_evtchn_from_irqhandler(info->evtchn, NULL);
+       unbind_evtchn_from_irqhandler(info->evtchn, info); 
        info->evtchn = 0;
 }
 
index 4a9342c3475442b87f7b1cd663aebddb3d6bc912..8d9790e689058d9b14fca2fcf5bf0588880e31f8 100644 (file)
 #define DEBUG 0
 
 #if 1
-#define ERR(_f, _a...) fprintf ( stderr, _f , ## _a ); fflush(stderr)
+#define ERR(_f, _a...) do { fprintf ( stderr, _f , ## _a ); fflush(stderr); } while(0)
 #else
 #define ERR(_f, _a...) ((void)0)
 #endif
 
 #if DEBUG
-#define DPRINTF(_f, _a...) fprintf ( stdout, _f , ## _a ); fflush(stdout)
+#define DPRINTF(_f, _a...) do { fprintf ( stdout, _f , ## _a ); fflush(stdout); } while (0)
 #else
 #define DPRINTF(_f, _a...) ((void)0)
 #endif
@@ -103,7 +103,7 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
     struct mmuext_op pin[MAX_PIN_BATCH];
     unsigned int nr_pins = 0;
 
-    DPRINTF("xc_linux_restore start\n");
+    DPRINTF("xc_linux_restore start: nr_pfns = %lx\n", nr_pfns);
 
     if (mlock(&ctxt, sizeof(ctxt))) {
         /* needed for when we do the build dom0 op, 
@@ -152,6 +152,8 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
     err = xc_domain_memory_increase_reservation(xc_handle, dom,
                                                 nr_pfns * PAGE_SIZE / 1024);
     if (err != 0) {
+        ERR("Failed to increate reservation by %lx\n", 
+            nr_pfns * PAGE_SIZE / 1024); 
         errno = ENOMEM;
         goto out;
     }