What is the recommended way to transmit batches of grant references between Linux domains?
I need to share large regions of memory between domains. I understand that the grant table API can be used to share memory, with one grant reference being created per page (frame) to be shared:
gref = gnttab_grant_foreign_access(otherend_id, frame, readonly);
or
err = gnttab_alloc_grant_references(num_grefs, &gref_head);
gref = gnttab_claim_reference(&gref_head);
err = gnttab_grant_foreign_access_ref(gref, otherend_id, frame, readonly);
In order to share a large number of pages, it is desirable to minimise both the number of hypercalls required in each domain, and the number of messages (e.g. xenstore writes) required to transmit grant reference(s)
from the donor to the recipient.
I see that gnttab_grant_foreign_access just updates grant table fields in a page which is mapped into the donor, and does not require a hypercall. In the recipient domain, multiple grant references can be mapped
by gnttab_map_refs using a single GNTTABOP_map_grant_ref hypercall (assuming that the target memory is not paged out).
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?