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

[Xen-devel] Use of the "has_shutdown_code" code in v3.2


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Roger Cruz" <rcruz@xxxxxxxxxxxxxxxxxxxxxxxx>
  • Date: Thu, 30 Oct 2008 17:19:19 -0400
  • Delivery-date: Thu, 30 Oct 2008 14:19:44 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • 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


 


Rackspace

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