From: Kuriakose Mathew Subject: Re: how to read value from xenstore inside kernel Date: Fri, 28 Aug 2009 17:11:23 +0530 Message-ID: <9e81bde0908280441h2961f63bkf858c6812caeb81e@mail.gmail.com> References: <9e81bde0908162340h42011f5cn7606c962fda89da4@mail.gmail.com> <20090817143826.GA4551@phenom.dumpdata.com> <9e81bde0908171055q5504683cm19cb2c70e24dfb88@mail.gmail.com> <20090817182023.GA6144@phenom.dumpdata.com> <9e81bde0908250357j5678af58ob56633561bf5a2bb@mail.gmail.com> <9e81bde0908280152r35c7b06ck866ab69487e0aa16@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1157740630==" 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: James Harper Cc: xen-devel@lists.xensource.com, Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org --===============1157740630== Content-Type: multipart/alternative; boundary=0016e6476268e4b83404723229ac --0016e6476268e4b83404723229ac Content-Type: text/plain; charset=ISO-8859-1 In netback.c , I intialized a target_watch struct and a callback function target_watch. Now for registering it , I used the below function in " static int __init netback_init(void) " spin_lock_init(&net_schedule_list_lock); INIT_LIST_HEAD(&net_schedule_list); netif_xenbus_init(); //ADDED CODE err = register_xenbus_watch(&target_watch); if(IS_ERR(err)) { printk(KERN_NOTICE "In netback.c::init Failed to initialize watcher\n"); } else { printk(KERN_NOTICE " In netback.c::init xenbus watcher initialized\n"); } ///END OF ADD When I reboot , it is hung at the point above the 'register_xenbus_watch(&target_watch)' . Neither of the printk messages are dispayed. On Fri, Aug 28, 2009 at 2:37 PM, James Harper wrote: > > When I am using > > char * test; > > const char *nodename = "vif/2/0"; > > test = xenbus_read(XBT_NIL, nodename, "mac", NULL); > > > > in netback .c ,I am getting this error when the kernel is rebooted. > > > > guest1 BUG: scheduling while atomic: xenwatch/0x00000100/13 > > > > That will be because the xenbus_read involves a wait of some sort, and > you can't do that in that sort of function. > > Basically the rx and tx and other hardware event handlers need to > execute as fast as possible, which precludes any waiting for xenbus > responses to arrive. > > Read your value at startup, or put a watch in at startup and read it > when it changes. > > James > --0016e6476268e4b83404723229ac Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable In netback.c , I intialized a target_watch struct and a callback function t= arget_watch.
Now for registering it , I used the below function in "= ; static int __init netback_init(void)=A0 "

spin_lock_init(&= ;net_schedule_list_lock);
INIT_LIST_HEAD(&net_schedule_list);

netif_xenbus_init();
//AD= DED CODE
err =3D register_xenbus_watch(&target_watch);
=A0=A0=A0 = if(IS_ERR(err)) {
=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 printk(KERN_NOTICE= "In netback.c::init Failed to initialize=A0 watcher\n");
=A0=A0=A0 =A0=A0=A0 } else {
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0 printk(KE= RN_NOTICE " In netback.c::init xenbus watcher initialized\n");=A0 =A0=A0=A0 }
///END OF ADD

When I reboot , it is hung at the = point above the 'register_xenbus_watch(&target_watch)' .
Neither of the printk messages are dispayed.



On Fri, Aug 28, 2009 at 2:37 PM, James Harper <james.harper@bendigo= it.com.au> wrote:
> When I am using
> =A0 char * test;
> =A0 const char *nodename =3D "vif/2/0";
> =A0 test =3D xenbus_read(XBT_NIL, nodename, "mac", NULL); >
> in netback .c ,I am getting this error when the kernel is rebooted. >
> guest1 BUG: scheduling while atomic: xenwatch/0x00000100/13
>

That will be because the xenbus_read involves a wait of some sort, an= d
you can't do that in that sort of function.

Basically the rx and tx and other hardware event handlers need to
execute as fast as possible, which precludes any waiting for xenbus
responses to arrive.

Read your value at startup, or put a watch in at startup and read it
when it changes.

James

--0016e6476268e4b83404723229ac-- --===============1157740630== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1157740630==--