From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] Convert shutdown to use xenstore Date: Thu, 04 Aug 2005 21:18:51 -0500 Message-ID: <42F2CC8B.1070400@us.ibm.com> References: <1123207790.10802.62.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1123207790.10802.62.camel@localhost.localdomain> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Rusty Russell Cc: Dan Smith , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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. > >