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

Re: [Xen-devel] [PATCH] Convert shutdown to use xenstore



Rusty Russell wrote:

/* Only required if your code runs in dom0 as well as domU */
static int register_xenstore_notifier(struct notifier_block *notifier)
{
        int ret = 0;

        down(&xenbus_lock);
        if (xen_start_info.evtchn)
                ret = notifier.notifier_call(notifier, 0, NULL);
        else
                notifier_chain_register(&xenstore_chain, nb);
        up(&xenbus_lock);
        return ret;
}
I like this. It avoids having special case code for dom0 in all the drivers.

Implementation detail: just use the xenbus_lock rather than another
lock, and make sure you hold it while traversing, not just registering!
I was following kernel/cpu.c:cpu_down().  Definitely makes sense though.

Regards,

Anthony Liguori

Rusty.


_______________________________________________
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®.