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] Convert shutdown to use xenstore

To: Dan Smith <danms@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Convert shutdown to use xenstore
From: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Date: Fri, 05 Aug 2005 12:09:50 +1000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 05 Aug 2005 02:08:20 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <m364ulzpde.fsf@xxxxxxxxxxxxxxxxxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <m364ulzpde.fsf@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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