From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andres Lagar-Cavilla Subject: [PATCH 06 of 18] Tools: Update libxc mem sharing interface Date: Thu, 08 Dec 2011 02:47:21 -0500 Message-ID: <6ad4a8da105e97d81fbe.1323330441@xdev.gridcentric.ca> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: ian.campbell@citrix.com, andres@gridcentric.ca, tim@xen.org, keir.xen@gmail.com, JBeulich@suse.com, ian.jackson@citrix.com, adin@gridcentric.ca List-Id: xen-devel@lists.xenproject.org tools/libxc/xc_memshr.c | 19 ++++++++++++++++++- tools/libxc/xenctrl.h | 7 ++++++- 2 files changed, 24 insertions(+), 2 deletions(-) Previosuly, the mem sharing code would return an opaque handle to index shared pages (and nominees) in its global hash table. By removing the hash table, the handle becomes a version, to avoid sharing a stale version of a page. Thus, libxc wrappers need to be updated accordingly. Signed-off-by: Adin Scannell Signed-off-by: Andres Lagar-Cavilla diff -r b398fc97ab19 -r 6ad4a8da105e tools/libxc/xc_memshr.c --- a/tools/libxc/xc_memshr.c +++ b/tools/libxc/xc_memshr.c @@ -88,8 +88,13 @@ int xc_memshr_nominate_gref(xc_interface int xc_memshr_share(xc_interface *xch, uint32_t source_domain, + uint64_t source_gfn, uint64_t source_handle, - uint64_t client_handle) + int source_is_gref, + uint32_t client_domain, + uint64_t client_gfn, + uint64_t client_handle, + int client_is_gref) { DECLARE_DOMCTL; struct xen_domctl_mem_sharing_op *op; @@ -100,8 +105,20 @@ int xc_memshr_share(xc_interface *xch, op = &(domctl.u.mem_sharing_op); op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE; op->u.share.source_handle = source_handle; + op->u.share.client_domain = (uint64_t) client_domain; op->u.share.client_handle = client_handle; + if (source_is_gref) + XEN_DOMCTL_MEM_SHARING_FIELD_MAKE_GREF( + op->u.share.source_gfn, source_gfn); + else + op->u.share.source_gfn = source_gfn; + if (client_is_gref) + XEN_DOMCTL_MEM_SHARING_FIELD_MAKE_GREF( + op->u.share.client_gfn, client_gfn); + else + op->u.share.client_gfn = client_gfn; + return do_domctl(xch, &domctl); } diff -r b398fc97ab19 -r 6ad4a8da105e tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -1893,8 +1893,13 @@ int xc_memshr_nominate_gref(xc_interface uint64_t *handle); int xc_memshr_share(xc_interface *xch, uint32_t source_domain, + uint64_t source_gfn, uint64_t source_handle, - uint64_t client_handle); + int source_is_gref, + uint32_t client_domain, + uint64_t client_gfn, + uint64_t client_handle, + int dest_is_gref); int xc_memshr_domain_resume(xc_interface *xch, uint32_t domid); int xc_memshr_debug_gfn(xc_interface *xch,