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

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



On Thu, 2005-08-04 at 08:35 -0700, Dan Smith wrote:
> 2. Includes Anthony's xenstore notification code, and

There are subtleties here.  We do need a notifier, because in domain 0,
the store gets started long after boot (when xenstored starts).
However, we don't need a notifier for domU code, because the store
exists from the moment we boot.

ie. for domU, this notifier chain is a noop, and I think the name should
reflect that, otherwise we'll have innocent drivers thinking registering
is the right thing.  register_dom0_xenstore_start()?

Or we could hide the whole thing, and simply call the notifier
immediately in the dom0/store-already-up case:

/* 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;
}

Implementation detail: just use the xenbus_lock rather than another
lock, and make sure you hold it while traversing, not just registering!

Rusty.
-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman


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