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

[Xen-devel] Re: Some problem with xenstore

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Re: Some problem with xenstore
From: Daniel Castro <evil.dani@xxxxxxxxx>
Date: Wed, 3 Aug 2011 12:41:03 +0900
Delivery-date: Tue, 02 Aug 2011 20:41:58 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=bnxRr0VJwi3gU61eqECn5GuZjkXy8q9Y1C4ZS8zKQN4=; b=vpvncFfLgqrmpqarbykImboixPwcajqhI9js8d1bxYCf9l/R6fFIOm++FCeMfORO+c d+Kxn0Rq3l3vPbcTgzBHh7HN8oMtJZqoxPlIIoCANSJ+6HqOgkOB3tAQZwvn4t8KH55l JG9HCWDxh2v7pR/6Q4ot+Bq6w9uYW7UEBfA6Q=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <CAP2B859fwahJxL6yWbyPg5_PajKRrns9GYaBy8DU26KVjQ_M2w@xxxxxxxxxxxxxx>
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: <CAP2B85-6SOgeaHeBWdm_oG4BU+EQ2d6RfDLSX3pL47Sxx2VuNg@xxxxxxxxxxxxxx> <CAP2B859fwahJxL6yWbyPg5_PajKRrns9GYaBy8DU26KVjQ_M2w@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
SOLVED.
For Xenstore the null terminated caracter is MANDATORY, when
calculating the size of the string to pass it to xenbus_send the
function strlen does not count the \0 at the end, so when memcpy is
executed the null does not go to the buffer. Hence the function
onearg() in xenstored_core will return null when extracting the path.

Sorry my bad....

Daniel

On Tue, Aug 2, 2011 at 9:32 PM, Daniel Castro <evil.dani@xxxxxxxxx> wrote:
> On Mon, Aug 1, 2011 at 9:42 PM, Daniel Castro <evil.dani@xxxxxxxxx> wrote:
>> Hello All,
>>
>> I am having some trouble with xenstore, so any ideas to solve this
>> "small" problem will be greatly appreciated.
>>
>> Right now the rings for xenbus connections is created but whenever I
>> send anything to xenstore (XS_READ, XS_WRITE, XS_GET_PERMS or
>> XS_DIRECTORY) the response is 22 if I do a XS_DEBUG I get a 13. On the
>> xenstore trace log I get for example:
>> IN 0x1f53050 20110801 21:15:25 GET_PERMS (/local/domain/0)
>> OUT 0x1f53050 20110801 21:15:25 ERROR (EINVAL )
>> IN 0x1f53050 20110801 21:15:25 DEBUG (/local/domain/0)
>> OUT 0x1f53050 20110801 21:15:25 ERROR (EACCES )
>> The address for the rings is correct and the response code corresponds
>> to the error number.
>>
>> The connection works the same way as in hvmloader xenbus.c
>>
>> The relevant code is like this:
>> char *test = "/local/domain/0";   //path to query
>> char * replay_data = malloc_high(1024); //buffer for response
>> memset(replay_data,0,1024);
>> replay_data[1023] = '\0'; //sanity check
>> int replay_len = 0; //no response yet
>> ret = xenbus_send(XS_DIRECTORY,strlen(test),test,&replay_len,&replay_data);
>>
>> After the xenbus_send the replay_data buffer is empty.
>>
>> Any ideas?
>>
>
> Since nobody had any ideas I went by myself and modified the code of
> xenstored_core and xenstored_domain in order to get to the bottom of
> this.
>
> I am adding lines like:
> trace("error on method XX in file YY where return should be THIS: %d, error);
> To the methods I am calling so far with this results:
>
> IN 0x13c5590 20110802 21:19:39 READ (/local/domain/1/device/pci/0/state )
> Got message READ len 35 from 0x13c5590
> Writing msg READ (1) out to 0x13c5590 domid 16843009
> OUT 0x13c5590 20110802 21:19:39 READ (1)
> IN 0x13b51f0 20110802 21:19:40 GET_PERMS (/local/domain/0)
> Got message GET_PERMS len 15 from 0x13b51f0
> debug: get_node in core; error name or is not valid node_name: (null)
> Error node does not exist
> Writing msg ERROR (EINVAL) out to 0x13b51f0 domid 16843009
> OUT 0x13b51f0 20110802 21:19:40 ERROR (EINVAL )
> IN 0x13b51f0 20110802 21:19:40 DEBUG (/local/domain/0)
> Got message DEBUG len 15 from 0x13b51f0
>
> Two things catch my attention:
> * The domid  for the operation in xenstore is incorrect. Maybe I need
> to do something about that. Since this code is being run when
> hvmloader is deploying the BIOS on main memory maybe I have to do
> something to introduce the domain to xenstore?
> * The node string for GET_PERMS is getting to be null, so either it
> does not exist or is being lost in the process. Again I am trying to
> get /local/domain/0 according to xenstore-ls it does exist.
>
>
> In order to make this work I have to add to the init script of
> xenstored the --verbose option, and the following in
> /etc/defaults/xencommons:
> XENCONSOLED_TRACE=all
> XENSTORED_TRACE=yes
> XENBACKENDD_DEBUG=yes
>
>
> I will keep digging on the matter.
>
> Daniel
>



-- 
+-=====---------------------------+
| +---------------------------------+ | This space intentionally blank
for notetaking.
| |   | Daniel Castro,                |
| |   | Consultant/Programmer.|
| |   | U Andes                         |
+-------------------------------------+

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

<Prev in Thread] Current Thread [Next in Thread>