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

Re: [Xen-devel] [PATCH] serialize suspend-resume process

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] serialize suspend-resume process
From: BVK Chaitanya <bayapuneni_chaitanya@xxxxxxxxxxxx>
Date: Thu, 31 Jul 2008 19:04:12 +0530
Cc: Xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 31 Jul 2008 06:30:15 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C4B77786.24EA3%keir.fraser@xxxxxxxxxxxxx>
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: <C4B77786.24EA3%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509)
Keir Fraser wrote:

On 31/7/08 14:04, "BVK Chaitanya" <bayapuneni_chaitanya@xxxxxxxxxxxx> wrote:

With suspend event channel in place, i see that suspend request doesn't
go through the shutdown_handler function when suspend is triggered over
event channel.

Oh, I agree that the shutdown_handler() can be re-entered! But it will *not*
trigger multiple invocations of xen_suspend() -- note it stores away the
suspend request by performing xchg(&shutting_down, ...) but it does *not*
immediately trigger a suspend unless old_state==SHUTDOWN_INVALID (in which
case there is no active current invocation of xen_suspend()).



In my tree there are two shutdown_handler functions.

    shutdown_handler
    __shutdown_handler

First one is called through xenbus interface and ensures that xen_suspend is serialized. I agree about this.

Second one is called through suspend_int (handler for suspend event channel) as below:



    static irqreturn_t suspend_int(int irq, void* dev_id,
                                   struct pt_regs *ptregs)
    {
        shutting_down = SHUTDOWN_SUSPEND;
        schedule_work(&shutdown_work);

        return IRQ_HANDLED;
    }



where shutdown_work & its callback are:



    static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL);

    static void __shutdown_handler(void *unused)
    {
        int err;

        err = kernel_thread((shutting_down == SHUTDOWN_SUSPEND) ?
                            xen_suspend : shutdown_process,
                            NULL, CLONE_FS | CLONE_FILES);

        if (err < 0) {
                printk(KERN_WARNING "Error creating shutdown"
                       " process (%d): "
                       "retrying...\n", -err);
                schedule_delayed_work(&shutdown_work, HZ/2);
        }
    }



This second function creates a thread and calls xen_suspend without looking for shutting_down variable's value.


I will check my tree again and will get back to you.


--
bvk-chaitanya



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