Mailing List Archive

[PATCH 06 of 18] Tools: Update libxc mem sharing interface
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 <adin@scannell.ca>
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>

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,

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 06 of 18] Tools: Update libxc mem sharing interface [ In reply to ]
Andres Lagar-Cavilla writes ("[PATCH 06 of 18] Tools: Update libxc mem sharing interface"):
> 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 <adin@scannell.ca>
> Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

(assuming the hypervisor changes are OK, obviously)

Ian.

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