[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 12:11 AM, Razvan Cojocaru
<rcojocaru@xxxxxxxxxxxxxxx> 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.

I think this is a useful addition.

>
> 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);
> +

I guess adding a comment here would be nice for people just looking at
the header to be able to tell that pages = array, nr = array size.
Also, wouldn't it make sense to make "access" an array as well, so you
could one-set multiple pages to different permissions?

Tamas

_______________________________________________
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®.