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] Passing a grant reference to another domain!

To: Daniel Stodden <stodden@xxxxxxxxxx>
Subject: RE: [Xen-devel] Passing a grant reference to another domain!
From: "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@xxxxxxx>
Date: Tue, 19 Aug 2008 15:54:24 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: Xen Developers <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 19 Aug 2008 00:55:58 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1219092118.19737.39.camel@xxxxxxxxxxxxxxxxxxxx>
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: <7F0FB2108857B5449321AEA91CF47903185A6F6F82@xxxxxxxxxxxxxxxxx> <1219092118.19737.39.camel@xxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AckBcuKRPZ/71uFTQoq22tmkY7YPQwAR/10g
Thread-topic: [Xen-devel] Passing a grant reference to another domain!
Daniel thanks for the reply, I have a few more q's.
1] A grant reference number is the array index in the grant table?

2] Passing more than one reference would require more than one key in the XS 
and the sharing domain will simply populate values and keys in xs, that are 
assumed to be known to the domain with which it is sharing those references?

3] The reason I'm asking you this is because I want to do so in an HVM which is 
a requirement for my project. I am not sure if libxenstore is available for an 
HVM?? Also since an HVM cannot use the backend mechanism that blkfront and 
netfront drivers use, I will have to transfer pages using grant references on 
my own between domains if I'm right?? This is for making I/Os.

4] Plus if I want to transfer many pages, I will have to keep increasing my 
memory allocation with Xen by the number of pages that I lose as a result of 
sharing those pages and the shared domain will have to free up the shared pages 
once used to remain within its prescribed memory allocation range?

5] To pass a grant ref I guess I'll be doing the following: -

In the sharing domain: -
xsh = xs_domain_open()
xth = xs_transaction_start(xsh)
xs_write(xsh, xth, "/local/domain/1/shm/tx-ring-ref", "2045", 5);
xs_write(xsh, xth, "/local/domain/1/shm/rx-ring-ref", "2046", 5);
In the shared domain: -
xsh = xs_domain_open()
xth = xs_transaction_start(xsh)
char* val1 = xs_read(xsh, xth, "/local/domain/1/shm/tx-ring-ref", NULL);
char* val2 = xs_read(xsh, xth, "/local/domain/1/shm/rx-ring-ref", NULL);

Would this be a way of passing references between domains?

6] If so, the above code uses libxenstore and this is is user space. Is there a 
way to do this from kernel space?

Regards,
Bhaskar.


-----Original Message-----
From: Daniel Stodden [mailto:stodden@xxxxxxxxxx]
Sent: Tuesday, August 19, 2008 2:12 AM
To: Jayaraman, Bhaskar
Cc: Xen Developers
Subject: Re: [Xen-devel] Passing a grant reference to another domain!

On Tue, 2008-08-19 at 03:27 +0800, Jayaraman, Bhaskar wrote:
> Hi can anyone point me to the code which passes grant reference between 
> domains?


>  In Mini-OS it doesn't seem to be used and I'm a little clueless where to 
> look for passing of reference.
> I am aware of the way a grant table is mapped, how to use the ring
> buffer once you map the shared memory page

> into your domain using the reference and the domain id, and how to read and 
> write into the xenstored database.

>  However, I'm struggling to understand how we pass the grant reference
> to a particular domain once

> you share a page after setting necessary access permissions on the page.

XenStore's typically used for bootstrapping shared memory. For generic I/O 
rings, it's sufficient to set up sharing of the ring itself. In that case, a 
frontend allocates the shared page and puts that reference into an xs location 
watched by the backend.

Beyond that, further references would be typically be sent as messages, but 
when and how many clearly depends on the application and protocol.
See e.g. the sector segment descriptors in xen/include/public/io/blkif.h. 
Similarly for io/netif.h, but blkif is simpler.

HTH,
Daniel

--
Daniel Stodden
LRR     -      Lehrstuhl für Rechnertechnik und Rechnerorganisation
Institut für Informatik der TU München             D-85748 Garching
http://www.lrr.in.tum.de/~stodden         mailto:stodden@xxxxxxxxxx
PGP Fingerprint: F5A4 1575 4C56 E26A 0B33  3D80 457E 82AE B0D8 735B



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