[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [Xen-users] Grant reference batch transmission



Hi Ian,

Thanks for your reply.

On Tue, Mar 10, 2015 at 16:22:40, Ian Campbell wrote:
>
> > What is the recommended way for the donor to transmit a batch of
> > grant references?  I assume that this requires the donor to pack
> > references into an index page, grant foreign access to the index and
> > transmit the index grant reference.  Does Linux provide any way to
> > do this, or are xenbus drivers expected to implement their own batch 
> > transmission?
>
> A bit of each. You would indeed want to setup a shared page and push
> the references into it, and Linux (/the Xen interface headers) provide
> some helpers for this sort of thing, but each driver largely sets
> things up themselves using a specific ring request format etc.
>
> As far as setup of the ring itself goes typically the frontend would
> allocate one of its pages, grant it to the backend and communicate
> that to the backend via xenstore. Most drivers use a little start of
> day synchronisation protocol based around the "state" keys in the
> front and backend xenstore dirs, working through the states in enum
> xenbus_state
> XenbusState* from xen/include/public/io/xenbus.h. It's assumed that
> this setup is infrequent (i.e. corresponds to plugging in a new disk
> etc)
>
> In Linux (for most drivers at least, yours may not fit this
> infrastructure) that state machine can be driven from the
> .otherend_changed callback in the struct xenbus_driver ops struct.

We have implemented front/backend drivers which perform this handshake via 
xenstore state keys, and which share a single page allocated by the frontend.

I think this gives us two options for grant reference batch transmission:

1. Send the grant references via the ring buffer.
This doesn't require any additional allocations, but means that if the number 
of grant references in the batch is greater than O(sizeof(ringbuffer) / 
sizeof(grant_ref_t)), cycling through the ring will be required.

2. Allocate and share one or more "index" page(s) which hold the grant 
references.
This means that only a single grant_ref_t needs to be sent via the ring, but at 
the cost of allocating additional memory for the index.  If multiple index 
pages are required, they could be chained together by appending to index page N 
a grant reference pointing to page N+1.

AFAICS the existing drivers use approach #1; is there any precedent for #2?

Gareth


-- IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium.  Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered 
in England & Wales, Company No:  2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, 
Registered in England & Wales, Company No:  2548782
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.