WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 05/11] xen: suspend: refactor cancellation flag into

To: Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 05/11] xen: suspend: refactor cancellation flag into a structure
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 15 Feb 2011 14:13:19 +0000
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Tue, 15 Feb 2011 06:19:07 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1297779181.21980.3722.camel@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1297779181.21980.3722.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Will add extra fields in subsequent patches.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 drivers/xen/manage.c |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index ba7caa3..22af876 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -34,11 +34,15 @@ enum shutdown_state {
 /* Ignore multiple shutdown requests. */
 static enum shutdown_state shutting_down = SHUTDOWN_INVALID;
 
+struct suspend_info {
+       int cancelled;
+};
+
 #ifdef CONFIG_PM_SLEEP
 static int xen_hvm_suspend(void *data)
 {
+       struct suspend_info *si = data;
        int err;
-       int *cancelled = data;
 
        BUG_ON(!irqs_disabled());
 
@@ -54,12 +58,12 @@ static int xen_hvm_suspend(void *data)
         * or the domain was merely checkpointed, and 0 if it
         * is resuming in a new domain.
         */
-       *cancelled = HYPERVISOR_suspend(0UL);
+       si->cancelled = HYPERVISOR_suspend(0UL);
 
-       xen_hvm_post_suspend(*cancelled);
+       xen_hvm_post_suspend(si->cancelled);
        gnttab_resume();
 
-       if (!*cancelled) {
+       if (!si->cancelled) {
                xen_irq_resume();
                xen_console_resume();
                xen_timer_resume();
@@ -72,8 +76,8 @@ static int xen_hvm_suspend(void *data)
 
 static int xen_suspend(void *data)
 {
+       struct suspend_info *si = data;
        int err;
-       int *cancelled = data;
 
        BUG_ON(!irqs_disabled());
 
@@ -93,13 +97,13 @@ static int xen_suspend(void *data)
         * or the domain was merely checkpointed, and 0 if it
         * is resuming in a new domain.
         */
-       *cancelled = HYPERVISOR_suspend(virt_to_mfn(xen_start_info));
+       si->cancelled = HYPERVISOR_suspend(virt_to_mfn(xen_start_info));
 
-       xen_post_suspend(*cancelled);
+       xen_post_suspend(si->cancelled);
        gnttab_resume();
        xen_mm_unpin_all();
 
-       if (!*cancelled) {
+       if (!si->cancelled) {
                xen_irq_resume();
                xen_console_resume();
                xen_timer_resume();
@@ -113,7 +117,7 @@ static int xen_suspend(void *data)
 static void do_suspend(void)
 {
        int err;
-       int cancelled = 1;
+       struct suspend_info si;
 
        shutting_down = SHUTDOWN_SUSPEND;
 
@@ -143,20 +147,22 @@ static void do_suspend(void)
                goto out_resume;
        }
 
+       si.cancelled = 1;
+
        if (xen_hvm_domain())
-               err = stop_machine(xen_hvm_suspend, &cancelled, cpumask_of(0));
+               err = stop_machine(xen_hvm_suspend, &si, cpumask_of(0));
        else
-               err = stop_machine(xen_suspend, &cancelled, cpumask_of(0));
+               err = stop_machine(xen_suspend, &si, cpumask_of(0));
 
        dpm_resume_noirq(PMSG_RESUME);
 
        if (err) {
                printk(KERN_ERR "failed to start xen_suspend: %d\n", err);
-               cancelled = 1;
+               si.cancelled = 1;
        }
 
 out_resume:
-       if (!cancelled) {
+       if (!si.cancelled) {
                xen_arch_resume();
                xs_resume();
        } else
-- 
1.5.6.5


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

<Prev in Thread] Current Thread [Next in Thread>