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] how to read value from xenstore inside kernel

To: James Harper <james.harper@xxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] how to read value from xenstore inside kernel
From: Kuriakose Mathew <kmathew123@xxxxxxxxx>
Date: Fri, 28 Aug 2009 17:11:23 +0530
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Fri, 28 Aug 2009 04:41:47 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=xk53DPRE2UJ0fZcSG6BTQb33yJbUBowN2eswrgDQ+2Y=; b=Y9emHNtMzxnKINMvcAEKHyU0p+taFn5dtagmaaij/ye/Lsyq28HrvKB9a6ecWBkkub Vl3X/jT4ZG0vUuxlIvudB6vEAxlYdk10uzDH7OaxdUnZLWlTe78P8dHwWnJ78YK7gok1 wrp8kPg76giThW0L4zrhnJaah5A25vJ3Fn1KY=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=IlK5XdmmEeOS74GpBv8GFfDG5tf24emIxkW9g1P4gO6zZoXU0tOn2SGxv7xWtgad35 a92UxY/3f63zzg8KXg6s/fRjYmAdeJanPnPCZ5+k6l23i46tdnp2yyKRsg9YAgGE1PGa pX6yDoo1bM8lr7OG0B0UUtTS8flUjT8AB16kc=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <AEC6C66638C05B468B556EA548C1A77D0177CEF6@trantor>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <9e81bde0908162340h42011f5cn7606c962fda89da4@xxxxxxxxxxxxxx> <20090817143826.GA4551@xxxxxxxxxxxxxxxxxxx> <9e81bde0908171055q5504683cm19cb2c70e24dfb88@xxxxxxxxxxxxxx> <20090817182023.GA6144@xxxxxxxxxxxxxxxxxxx> <9e81bde0908250357j5678af58ob56633561bf5a2bb@xxxxxxxxxxxxxx> <AEC6C66638C05B468B556EA548C1A77D0177CE13@trantor> <9e81bde0908280152r35c7b06ck866ab69487e0aa16@xxxxxxxxxxxxxx> <AEC6C66638C05B468B556EA548C1A77D0177CEF6@trantor>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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 <james.harper@xxxxxxxxxxxxxxxx> 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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel