[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 4/6] Limit new suspend steps only to driver domain


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Tue, 6 Feb 2007 16:16:03 +0800
  • Delivery-date: Tue, 06 Feb 2007 00:16:39 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcdJxwqRIApTY5FURz+pS5R45gZXiA==
  • Thread-topic: [PATCH 4/6] Limit new suspend steps only to driver domain

Anyway to wait and freeze all processes is overhead to some
extent. This patch adds a check upon whether current one
is driver domain. If not, keep original suspend sequence.

Signed-off-by Kevin Tian <kevin.tian@xxxxxxxxx>

diff -r ac24ecea9595 -r f30f5edc3da8
linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c    Mon Feb
05 17:30:13 2007 +0800
+++ b/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c    Mon Feb
05 17:34:13 2007 +0800
@@ -18,6 +18,7 @@
 #include <xen/gnttab.h>
 #include <xen/xencons.h>
 #include <xen/cpu_hotplug.h>
+#include <linux/pci.h>
 
 #if defined(__i386__) || defined(__x86_64__)
 
@@ -130,9 +131,19 @@ static void post_suspend(int suspend_can
 
 #endif
 
+/* Check driver domain to see whether to freeze processes */
+static inline int check_driver_domain(void)
+{
+       struct pci_device_id ids = {PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+               PCI_ANY_ID, 0, 0, 0};
+
+       return pci_dev_present(&ids);
+}
+
 int __xen_suspend(void)
 {
        int err, suspend_cancelled;
+       int driver;
 
        extern void time_resume(void);
 
@@ -151,13 +162,16 @@ int __xen_suspend(void)
        if (err)
                return err;
 
-       if (freeze_processes()) {
-               err = -EAGAIN;
-               goto Thaw;
-       }
-
-       if ((err = device_suspend(PMSG_SUSPEND)))
-               goto Thaw;
+       driver = check_driver_domain();
+       if (driver) {
+               if (freeze_processes()) {
+                       err = -EAGAIN;
+                       goto Thaw;
+               }
+
+               if ((err = device_suspend(PMSG_SUSPEND)))
+                       goto Thaw;
+       }
 
        xenbus_suspend();
 
@@ -167,7 +181,7 @@ int __xen_suspend(void)
        local_irq_disable();
        preempt_enable();
 
-       if ((err = device_power_down(PMSG_SUSPEND)))
+       if (driver && (err = device_power_down(PMSG_SUSPEND)))
                goto Thaw;
 
        gnttab_suspend();
@@ -187,7 +201,8 @@ int __xen_suspend(void)
        if (!suspend_cancelled)
                irq_resume();
 
-       device_power_up();
+       if (driver)
+               device_power_up();
 
        time_resume();
 
@@ -202,10 +217,12 @@ int __xen_suspend(void)
                xenbus_suspend_cancel();
        }
 
-       device_resume();
+       if (driver)
+               device_resume();
        err = 0;
 Thaw:
-       thaw_processes();
+       if (driver)
+               thaw_processes();
        smp_resume();
 
        return err;

Attachment: check_driver_domain.patch
Description: check_driver_domain.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.