From: Rusty Russell Subject: Re: [PATCH] Convert shutdown to use xenstore Date: Fri, 05 Aug 2005 12:09:50 +1000 Message-ID: <1123207790.10802.62.camel@localhost.localdomain> References: Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Dan Smith Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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