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: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Convert shutdown to use xenstore
From: Anthony Liguori <aliguori@xxxxxxxxxx>
Date: Thu, 04 Aug 2005 21:18:51 -0500
Cc: Dan Smith <danms@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 05 Aug 2005 02:17:27 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1123207790.10802.62.camel@xxxxxxxxxxxxxxxxxxxxx>
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> <1123207790.10802.62.camel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)
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