Tian, Kevin
2007-Feb-06 08:16 UTC
[Xen-devel] [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@intel.com> 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; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel