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] Use of the "has_shutdown_code" code in v3.2

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] Use of the "has_shutdown_code" code in v3.2
From: "Roger Cruz" <rcruz@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 30 Oct 2008 17:19:19 -0400
Delivery-date: Thu, 30 Oct 2008 14:19:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C52F9EE9.1EAEE%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: <4909F703.76E4.0078.0@xxxxxxxxxx> <C52F9EE9.1EAEE%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Ack6tLo/+Ov74aanEd2zLQAWy6hiGQAH37Tw
Thread-topic: Use of the "has_shutdown_code" code in v3.2
We're using the V3.2 of the hypervisor code and while tracking down a
suspend/resume bug, I came across the following code that caused me to
ask myself whether the "has_shutdown_code" should also be cleared when
the domain is resumed.

This hypercall will not set a new shutdown reason if the domain already
has the flag set to 1.  So, if a domain is suspended and then resumed,
the flag would remain set.


    case SCHEDOP_shutdown_code:
    {
        struct sched_shutdown sched_shutdown;

        ret = -EFAULT;
        if ( copy_from_guest(&sched_shutdown, arg, 1) )
            break;

        ret = 0;
        TRACE_3D(TRC_SCHED_SHUTDOWN_CODE,
                 current->domain->domain_id, current->vcpu_id,
                 sched_shutdown.reason);
        spin_lock(&current->domain->shutdown_lock);
        if ( !current->domain->has_shutdown_code )
        {
            current->domain->shutdown_code = (u8)sched_shutdown.reason;
            current->domain->has_shutdown_code = 1;
        }

So I asked myself, should the domain_resume routine also clear that
flag?



void domain_resume(struct domain *d)
{
    struct vcpu *v;

    /*
     * Some code paths assume that shutdown status does not get reset
under
     * their feet (e.g., some assertions make this assumption).
     */
    domain_pause(d);

    spin_lock(&d->shutdown_lock);

    d->is_shutting_down = d->is_shut_down = 0;  <---- should it also
include: "d->has_shutdown_code = "

    for_each_vcpu ( d, v )
    {
        if ( v->paused_for_shutdown )
            vcpu_unpause(v);
        v->paused_for_shutdown = 0;
    }

    spin_unlock(&d->shutdown_lock);

    domain_unpause(d);
}


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