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

Re: [Xen-devel] [PATCH RFC] tools/libxc, xen/x86: Added xc_set_mem_access_sparse()



On Fri, Aug 26, 2016 at 09:11:42AM +0300, Razvan Cojocaru wrote:
> Currently it is only possible to set mem_access restrictions only for
> a contiguous range of GFNs (or, as a particular case, for a single GFN).
> This patch introduces a new libxc function taking an array of GFNs.
> The alternative would be to set each page in turn, using a userspace-HV
> roundtrip for each call, and triggering a TLB flush per page set.
> 
> Signed-off-by: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
> ---
>  tools/libxc/include/xenctrl.h |  4 +++
>  tools/libxc/xc_mem_access.c   | 32 +++++++++++++++++++++++
>  xen/arch/x86/hvm/hvm.c        |  2 +-
>  xen/arch/x86/mm/p2m.c         | 59 
> ++++++++++++++++++++++++++++++-------------
>  xen/common/compat/memory.c    |  1 -
>  xen/common/mem_access.c       | 13 +++++++++-
>  xen/include/public/memory.h   |  6 +++++
>  xen/include/xen/p2m-common.h  |  6 ++---
>  8 files changed, 100 insertions(+), 23 deletions(-)
> 
> diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
> index 560ce7b..ac84908 100644
> --- a/tools/libxc/include/xenctrl.h
> +++ b/tools/libxc/include/xenctrl.h
> @@ -2125,6 +2125,10 @@ int xc_set_mem_access(xc_interface *xch, domid_t 
> domain_id,
>                        xenmem_access_t access, uint64_t first_pfn,
>                        uint32_t nr);
>  
> +int xc_set_mem_access_sparse(xc_interface *xch, domid_t domain_id,
> +                             xenmem_access_t access, xen_pfn_t *pages,
> +                             uint32_t nr);
> +
>  /*
>   * Gets the mem access for the given page (returned in access on success)
>   */
> diff --git a/tools/libxc/xc_mem_access.c b/tools/libxc/xc_mem_access.c
> index eee088c..73b1caa 100644
> --- a/tools/libxc/xc_mem_access.c
> +++ b/tools/libxc/xc_mem_access.c
> @@ -41,6 +41,38 @@ int xc_set_mem_access(xc_interface *xch,
>      return do_memory_op(xch, XENMEM_access_op, &mao, sizeof(mao));
>  }
>  
> +int xc_set_mem_access_sparse(xc_interface *xch,
> +                             domid_t domain_id,
> +                             xenmem_access_t access,
> +                             xen_pfn_t *pages,
> +                             uint32_t nr)
> +{
> +    DECLARE_HYPERCALL_BOUNCE(pages, nr * sizeof(xen_pfn_t), 
> XC_HYPERCALL_BUFFER_BOUNCE_IN);

Line too long.

There isn't much else to say because it looks like to be a rather
straightforward hypercall wrapper.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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