tools/libxc, xen/x86: Added xc_set_mem_access_multi()
PATCH v3 1/1 tools/libxc, xen/x86: Added xc_set_mem_access_multi()
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.
---
Changes since V2:
- Renamed 'size' back to 'nr', but added a comment explaining the signifincance of the parameter.
- Reverted modifications to p2m_set_altp2m_mem_access().
- Renamed _p2m_set_mem_access() to set_mem_access(), and removed the inline hint.
- United return paths for set_mem_access().
- Modified p2m_xenmem_access_to_p2m_access() to return bool_t.
- Removed stray blank line between declarations.
- Replaced the return mem_access_memop() in the XENMEM_access_op case in common/compat/memory.c with a proper break.
- Now using XEN_GUEST_HANDLE(const_uint64) and XEN_GUEST_HANDLE(const_uint8).
- Added p2m_set_mem_access_multi() to the ARM side to fix a compilation error.
--- tools/libxc/include/xenctrl.h | 9 +++ tools/libxc/xc_mem_access.c | 38 +++++++++++ xen/arch/arm/p2m.c | 9 +++ xen/arch/x86/mm/p2m.c | 149 ++++++++++++++++++++++++++++++++---------- xen/common/compat/memory.c | 25 +++++-- xen/common/mem_access.c | 11 ++++ xen/include/public/memory.h | 14 +++- xen/include/xen/p2m-common.h | 6 ++ xen/include/xlat.lst | 2 +- 9 files changed, 224 insertions(+), 39 deletions(-)
tools/libxc/include/xenctrl.h +9 -0
@@ -2126,6 +2126,15 @@ int xc_set_mem_access(xc_interface *xch, domid_t domain_id, uint32_t nr);/* +* Set an array of pages to their respective access in the access array. +* The nr parameter specifies the size of the pages and access arrays. +* The same allowed access types as for xc_set_mem_access() apply. +*/ +int xc_set_mem_access_multi (xc_interface *xch,domid_t domain_id, +uint8_t *access,uint64_t *pages, +uint32_t nr); + +/* * Gets the mem access for the given page (returned in access on success) */ int xc_get_mem_access(xc_interface *xch, domid_t domain_id,
tools/libxc/xc_mem_access.c +38 -0
@@ -41,6 +41,44 @@ int xc_set_mem_access(xc_interface *xch,return do_memory_op (xch, XENMEM_access_op, &mao,sizeof (mao)); } +int xc_set_mem_access_multi (xc_interface *xch, +domid_t domain_id, +uint8_t *access, +uint64_t *pages, +uint32_t nr) +{ +DECLARE_HYPERCALL_BOUNCE (access, nr,XC_HYPERCALL_BUFFER_BOUNCE_IN ); +DECLARE_HYPERCALL_BOUNCE (pages, nr *sizeof (uint64_t ), +XC_HYPERCALL_BUFFER_BOUNCE_IN ); +int rc; + +xen_mem_access_op_t mao = + { + .op = XENMEM_access_op_set_access_multi, + .domid = domain_id, + .access = XENMEM_access_default +1 ,/* Invalid value */ + .pfn = ~0UL ,/* Invalid GFN */ + .nr = nr, + }; + +if (xc_hypercall_bounce_pre (xch, pages) || +xc_hypercall_bounce_pre (xch, access) ) + { +PERROR ("Could not bounce memory for XENMEM_access_op_set_access_multi" ); +return -1 ; + } + +set_xen_guest_handle (mao.pfn_list, pages); +set_xen_guest_handle (mao.access_list, access); + + rc =do_memory_op (xch, XENMEM_access_op, &mao,sizeof (mao)); + +xc_hypercall_bounce_post (xch, access); +xc_hypercall_bounce_post (xch, pages); + +return rc; +} + int xc_get_mem_access(xc_interface *xch, domid_t domain_id, uint64_t pfn,
xen/arch/arm/p2m.c +9 -0
@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,return 0 ; } +long p2m_set_mem_access_multi (struct domain *d, +const XEN_GUEST_HANDLE (const_uint64) pfn_list, +const XEN_GUEST_HANDLE (const_uint8) access_list, +uint32_t nr,uint32_t start,uint32_t mask, +unsigned int altp2m_idx) +{ +return -ENOTSUP ; +} +int p2m_get_mem_access (struct domain *d,gfn_t gfn,xenmem_access_t *access) {
xen/arch/x86/mm/p2m.c +116 -33
187 lines not on this page · raw message
xen/common/compat/memory.c +21 -4
@@ -15,7 +15,6 @@ CHECK_TYPE(domid);#undef compat_domid_t#undef xen_domid_t -CHECK_mem_access_op; CHECK_vmemrange;#ifdef CONFIG_HAS_PASSTHROUGH
@@ -71,6 +70,7 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)struct xen_add_to_physmap_batch *atpb;struct xen_remove_from_physmap *xrfp;struct xen_vnuma_topology_info *vnuma; +struct xen_mem_access_op *mao; } nat;union {struct compat_memory_reservation rsrv;
@@ -78,6 +78,7 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)struct compat_add_to_physmap atp;struct compat_add_to_physmap_batch atpb;struct compat_vnuma_topology_info vnuma; +struct compat_mem_access_op mao; } cmp;set_xen_guest_handle (nat.hnd,COMPAT_ARG_XLAT_VIRT_BASE );
@@ -321,9 +322,22 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) }case XENMEM_access_op: -return mem_access_memop (cmd, -guest_handle_cast (compat, - xen_mem_access_op_t)); + { +if (copy_from_guest (&cmp.mao, compat,1 ) ) +return -EFAULT ; + +#define XLAT_mem_access_op_HNDL_pfn_list (_d_, _s_) \ + guest_from_compat_handle((_d_)->pfn_list, (_s_)->pfn_list) +#define XLAT_mem_access_op_HNDL_access_list (_d_, _s_) \ + guest_from_compat_handle((_d_)->access_list, (_s_)->access_list) + +XLAT_mem_access_op (nat.mao, &cmp.mao); + +#undef XLAT_mem_access_op_HNDL_pfn_list +#undef XLAT_mem_access_op_HNDL_access_list + +break ; + }case XENMEM_get_vnumainfo: {
@@ -520,6 +534,9 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) rc = -EFAULT ;break ; +case XENMEM_access_op: +break ; +default :domain_crash (current->domain); split =0 ;
xen/common/mem_access.c +11 -0
@@ -76,6 +76,17 @@ int mem_access_memop(unsigned long cmd, }break ; +case XENMEM_access_op_set_access_multi: + rc =p2m_set_mem_access_multi (d, mao.pfn_list, mao.access_list, mao.nr, + start_iter,MEMOP_CMD_MASK ,0 ); +if ( rc >0 ) + { +ASSERT (!(rc &MEMOP_CMD_MASK )); + rc =hypercall_create_continuation (__HYPERVISOR_memory_op,"lh" , + XENMEM_access_op | rc, arg); + } +break ; +case XENMEM_access_op_get_access: {xenmem_access_t access;
xen/include/public/memory.h +13 -1
@@ -410,6 +410,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_mem_paging_op_t);* #define XENMEM_access_op_enable_emulate 2 * #define XENMEM_access_op_disable_emulate 3 */ +#define XENMEM_access_op_set_access_multi 4 typedef enum { XENMEM_access_n,
@@ -442,7 +443,8 @@ struct xen_mem_access_op {uint8_t access;domid_t domid;/* -* Number of pages for set op +* Number of pages for set op (or size of pfn_list for +* XENMEM_access_op_set_access_multi) * Ignored on setting default access and other ops */ uint32_t nr;
@@ -452,6 +454,16 @@ struct xen_mem_access_op {* ~0ull is used to set and get the default access for pages */ uint64_aligned_t pfn; +/* +* List of pfns to set access for +* Used only with XENMEM_access_op_set_access_multi +*/ +XEN_GUEST_HANDLE (const_uint64) pfn_list; +/* +* Corresponding list of access settings for pfn_list +* Used only with XENMEM_access_op_set_access_multi +*/ +XEN_GUEST_HANDLE (const_uint8) access_list; };typedef struct xen_mem_access_op xen_mem_access_op_t ;DEFINE_XEN_GUEST_HANDLE (xen_mem_access_op_t);
xen/include/xen/p2m-common.h +6 -0
@@ -53,6 +53,12 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, uint32_t start, uint32_t mask, xenmem_access_t access, unsigned int altp2m_idx); +long p2m_set_mem_access_multi (struct domain *d, +const XEN_GUEST_HANDLE (const_uint64) pfn_list, +const XEN_GUEST_HANDLE (const_uint8) access_list, +uint32_t nr,uint32_t start,uint32_t mask, +unsigned int altp2m_idx); +/* * Get access type for a gfn. * If gfn == INVALID_GFN, gets the default access type.
xen/include/xlat.lst +1 -1
@@ -68,7 +68,7 @@ ! memory_exchange memory.h ! memory_map memory.h ! memory_reservation memory.h -? mem_access_op memory.h +! mem_access_op memory.h ! pod_target memory.h ! remove_from_physmap memory.h ! reserved_device_memory_map memory.h
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Razvan Cojocaru writes ("[PATCH V3] tools/libxc, xen/x86: Added xc_set_mem_access_multi()"):
Quoted 8 lines
Currently it is only possible to set
mem_accessrestrictions 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 <[email protected]>Acked-by Wei Liu <[email protected]>
I have no objection with my tools maintainer hat on. But I have a question for you and/or the hypervisor maintainers:
Could this aim be achieved with a multicall ? (Can multicalls defer the TLB flush?)
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 12:16, <[email protected]> wrote:
Razvan Cojocaru writes ("[PATCH V3]
tools/libxc, xen/x86: Addedxc_set_mem_access_multi()"):Quoted 6 lines
Currently it is only possible to set
mem_accessrestrictions 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.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Razvan Cojocaru <[email protected]>Acked-by Wei Liu <[email protected]>I have no objection with my tools maintainer hat on. But I have a question for you and/or the hypervisor maintainers:
Could this aim be achieved with a multicall ? (Can multicalls defer the TLB flush?)
No, they can't, but it's not entirely excluded to make them do so. And then iirc there are no multicalls available to HVM (and hence PVHv2) guests right now.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 15 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 12:16, <[email protected]> wrote:
Razvan Cojocaru writes ("[PATCH V3]
tools/libxc, xen/x86: Addedxc_set_mem_access_multi()"):Quoted 8 lines
Currently it is only possible to set
mem_accessrestrictions 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 <[email protected]>Acked-by Wei Liu <[email protected]>I have no objection with my tools maintainer hat on. But I have a question for you and/or the hypervisor maintainers:
Quoted 6 lines
Quoted 2 lines
Could this aim be achieved with a multicall ? (Can multicalls defer the TLB flush?)
No, they can't, but it's not entirely excluded to make them do so. And then iirc there are no multicalls available to HVM (and hence PVHv2) guests right now.
Oh, right, Ian was talking about the Xen multicall mechanism, not simply chaining userspace xc_set_mem_access() calls.
In any case, any single xc_set_mem_access() call does a TLB flush hypervisor-side, and AFAIK no flush hypercall is currently available. Other than that, I've never used the multicall mechanism so I'm not sure what else it would imply in this case.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 7 lines · Ian Jackson
Razvan Cojocaru writes ("[PATCH V3]
tools/libxc, xen/x86: Addedxc_set_mem_access_multi()"):Quoted 6 lines
Currently it is only possible to set
mem_accessrestrictions 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.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Razvan Cojocaru <[email protected]>Acked-by Wei Liu <[email protected]>I have no objection with my tools maintainer hat on. But I have a question for you and/or the hypervisor maintainers:
Could this aim be achieved with a multicall ? (Can multicalls defer the TLB flush?)
I assume your question is: could we do multiple xc_set_mem_access() calls and then call something like xc_tlb_flush() at the end of it, instead of a singke xc_set_mem_access_multi() call?
If that's the question, the answer (to the best of my knowledge) is that yes, that would be achievable (again, to the best of my knowledge that would still require a patch).
But that would still be suboptimal performance-wise. Each xc_set_mem_access() call is a userspace <-> hypervisor round-trip. A typical introspection application follows the basic xen-access.c model, where you receive an event, do things in response to it, then reply (at which point, usually the VCPU is allowed to resume running). If, as part of processing the event, you'd like to set access restrictions on hundreds of pages, that would require hundreds of xc_set_mem_access() calls, and would definitely incur noticeable overhead.
In short, I believe that there's a very strong case to be made for this approach vs. multiple calls.
I hope I've understood and addressed your question.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 14 lines · Razvan Cojocaru
Quoted 13 lines · Ian Jackson
Razvan Cojocaru writes ("[PATCH V3]
tools/libxc, xen/x86: Addedxc_set_mem_access_multi()"):Quoted 8 lines
Currently it is only possible to set
mem_accessrestrictions 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 <[email protected]>Acked-by Wei Liu <[email protected]>I have no objection with my tools maintainer hat on. But I have a question for you and/or the hypervisor maintainers:
Quoted 7 lines
Quoted 2 lines
Could this aim be achieved with a multicall ? (Can multicalls defer the TLB flush?)
I assume your question is: could we do multiple
xc_set_mem_access()calls and then call something likexc_tlb_flush()at the end of it, instead of a singkexc_set_mem_access_multi()call?
FWIW: I think you misunderstood, multicall is a Xen hypercall to batch multiple hypercalls into one.
But as Jan said in the other reply, there is no multicall for HVM guests (yet) -- see hvm/hvm.c:hvm_hypercall_table.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH V3] tools/libxc, xen/x86: Added xc_set_mem_access_multi() [and 1 more messages]
In reply to Razvan CojocaruRazvan Cojocaru writes ("Re: [PATCH V3] tools/libxc, xen/x86: Added xc_set_mem_access_multi()"):
Quoted 7 lines · Ian Jackson
Quoted 2 lines
Could this aim be achieved with a multicall ? (Can multicalls defer the TLB flush?)
I assume your question is: could we do multiple
xc_set_mem_access()calls and then call something likexc_tlb_flush()at the end of it, instead of a singkexc_set_mem_access_multi()call?
No, I was talking about the guest<->hypervisor interface.
Xen has a feature called "multicalls" which allows a single hypercall to actually contain several hypercalls, so that a single pair of guest<->hypervisor transitions can do more work.
Jan Beulich writes ("Re: [PATCH V3] tools/libxc, xen/x86: Added xc_set_mem_access_multi()"):
Quoted 5 lines · On 06.09.16 at 12:16, <[email protected]> wrote:
Quoted 2 lines
Could this aim be achieved with a multicall ? (Can multicalls defer the TLB flush?)
No, they can't, but it's not entirely excluded to make them do so.
AIUI from reading the patch the TLB flush is implicit, so extra code complexity (and fragility) would be needed to implement that.
Quoted 2 lines
And then iirc there are no multicalls available to HVM (and hence PVHv2) guests right now.
This is another problem with my suggestion.
So, thanks for the reply. Carry on :-).
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 7 lines · Ian Jackson
Razvan Cojocaru writes ("[PATCH V3]
tools/libxc, xen/x86: Addedxc_set_mem_access_multi()"):Quoted 6 lines
Currently it is only possible to set
mem_accessrestrictions 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.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Razvan Cojocaru <[email protected]>Acked-by Wei Liu <[email protected]>I have no objection with my tools maintainer hat on. But I have a question for you and/or the hypervisor maintainers:
Could this aim be achieved with a multicall ? (Can multicalls defer the TLB flush?)
Making people go through the process of constructing a multicall consisting of a huge array of hypercalls which each set restrictions for a single gfn seems a bit tedious. We already have other hypercalls which take arrays of gfns, so even if it could be done in theory, I don't see a good reason why not to accept something like this.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Ravzan,
Quoted 5 lines · Razvan Cojocaru
xen/arch/arm/p2m.c +0
-0
xen/arch/arm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1845
Quoted 10 lines
xen/arch/arm/p2m.c +7
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,return 0 ; } +long p2m_set_mem_access_multi (struct domain *d, +const XEN_GUEST_HANDLE (const_uint64) pfn_list, +const XEN_GUEST_HANDLE (const_uint8) access_list, +uint32_t nr,uint32_t start,uint32_t mask, +unsigned int altp2m_idx) +{ +return -ENOTSUP ;
Why didn't you implement this function for ARM?
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Hello,
Quoted 10 lines · Razvan Cojocaru
Quoted 9 lines
xen/arch/arm/p2m.c +0
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, return 0; }
Quoted 12 lines
xen/arch/arm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1845
Quoted 10 lines
xen/arch/arm/p2m.c +4
-0+long p2m_set_mem_access_multi (struct domain *d, +const XEN_GUEST_HANDLE (const_uint64) pfn_list, +const XEN_GUEST_HANDLE (const_uint8) access_list, + uint32_t nr, uint32_t start, uint32_tmask,
xen/arch/arm/p2m.c +3
-0+ unsigned int altp2m_idx) +{ +return -ENOTSUP ;Why didn't you implement this function for ARM?
Because unfortunately I don't have an ARM setup to test it on and I thought it would be unfair to publish the patch with untestable ARM support.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 25 lines · Razvan Cojocaru
Hello,
Quoted 10 lines · Razvan Cojocaru
Quoted 9 lines
xen/arch/arm/p2m.c +0
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, return 0; }Quoted 12 lines
xen/arch/arm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1845
Quoted 10 lines
xen/arch/arm/p2m.c +4
-0+long p2m_set_mem_access_multi (struct domain *d, +const XEN_GUEST_HANDLE (const_uint64) pfn_list, +const XEN_GUEST_HANDLE (const_uint8) access_list, + uint32_t nr, uint32_t start, uint32_tmask,
xen/arch/arm/p2m.c +3
-0+ unsigned int altp2m_idx) +{ +return -ENOTSUP ;Why didn't you implement this function for ARM?
Quoted 2 lines
Because unfortunately I don't have an ARM setup to test it on and I thought it would be unfair to publish the patch with untestable ARM support.
So what's the plan? Who will implement the ARM solution?
I don't think there is a technical challenge to implement the ARM one.
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 28 lines · Julien Grall
Quoted 25 lines · Razvan Cojocaru
Hello,
Quoted 22 lines · Razvan Cojocaru
Quoted 16 lines
xen/arch/arm/p2m.c +4
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, return 0; } +long p2m_set_mem_access_multi (struct domain *d, +const XEN_GUEST_HANDLE (const_uint64) pfn_list, +const XEN_GUEST_HANDLE (const_uint8) access_list, + uint32_t nr, uint32_t start, uint32_tmask,
xen/arch/arm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1845
Quoted 3 lines
xen/arch/arm/p2m.c +3
-0+ unsigned int altp2m_idx) +{ +return -ENOTSUP ;Why didn't you implement this function for ARM?
Quoted 7 lines
Quoted 3 lines
Because unfortunately I don't have an ARM setup to test it on and I thought it would be unfair to publish the patch with untestable ARM support.
So what's the plan? Who will implement the ARM solution?
I don't think there is a technical challenge to implement the ARM one.
Are we going to require that all new functionality be implemented both on x86 and on ARM? That seems like a bit of a lot to ask of someone who's not going to use it (and as Razvan points out, can't even test it). The mem_access functionality is still fairly technical -- anyone who decides they want to use it and runs across the same problem Razvan did should have no trouble implementing this hypercall for ARM when they need it.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 37 lines · George Dunlap
Quoted 28 lines · Julien Grall
Quoted 25 lines · Razvan Cojocaru
Hello,
Quoted 22 lines · Razvan Cojocaru
Quoted 16 lines
xen/arch/arm/p2m.c +4
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, return 0; } +long p2m_set_mem_access_multi (struct domain *d, +const XEN_GUEST_HANDLE (const_uint64) pfn_list, +const XEN_GUEST_HANDLE (const_uint8) access_list, + uint32_t nr, uint32_t start, uint32_tmask,
xen/arch/arm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1845
Quoted 3 lines
xen/arch/arm/p2m.c +3
-0+ unsigned int altp2m_idx) +{ +return -ENOTSUP ;Why didn't you implement this function for ARM?
Quoted 7 lines
Quoted 3 lines
Because unfortunately I don't have an ARM setup to test it on and I thought it would be unfair to publish the patch with untestable ARM support.
So what's the plan? Who will implement the ARM solution?
I don't think there is a technical challenge to implement the ARM one.
Quoted 7 lines
Are we going to require that all new functionality be implemented both on x86 and on ARM? That seems like a bit of a lot to ask of someone who's not going to use it (and as Razvan points out, can't even test it). The
mem_accessfunctionality is still fairly technical -- anyone who decides they want to use it and runs across the same problem Razvan did should have no trouble implementing this hypercall for ARM when they need it.
I am not saying we should every time implement the ARM version when the x86 version is added and vice-versa.
However, I don't think this is a lot to ask when an hypercall benefits both architecture. Note that nobody would have complained that the code was not tested on ARM if the hypercall was implemented in the common code. Even if it could break the platform...
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 49 lines · Julien Grall
Quoted 38 lines · George Dunlap
Quoted 29 lines · Julien Grall
Quoted 26 lines · Razvan Cojocaru
Hello,
Quoted 23 lines · Razvan Cojocaru
Quoted 17 lines
xen/arch/arm/p2m.c +0
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d,
gfn_t
gfn,uint32_tnr,return 0;}
xen/arch/arm/p2m.c +2
-0+long p2m_set_mem_access_multi (struct domain *d, + const XEN_GUEST_HANDLE(const_uint64)
pfn_list,
+ constXEN_GUEST_HANDLE(const_uint8)access_list,
+uint32_tnr,uint32_tstart,uint32_t
mask,xen/arch/arm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1845
Quoted 3 lines
xen/arch/arm/p2m.c +3
-0+ unsigned int altp2m_idx) +{ +return -ENOTSUP ;Why didn't you implement this function for ARM?
Quoted 7 lines
Quoted 3 lines
Because unfortunately I don't have an ARM setup to test it on and I thought it would be unfair to publish the patch with untestable ARM support.
So what's the plan? Who will implement the ARM solution?
I don't think there is a technical challenge to implement the ARM one.
Quoted 7 lines
Are we going to require that all new functionality be implemented both on x86 and on ARM? That seems like a bit of a lot to ask of someone who's not going to use it (and as Razvan points out, can't even test it). The
mem_accessfunctionality is still fairly technical -- anyone who decides they want to use it and runs across the same problem Razvan did should have no trouble implementing this hypercall for ARM when they need it.
Quoted 7 lines
I am not saying we should every time implement the ARM version when the x86 version is added and vice-versa.
However, I don't think this is a lot to ask when an hypercall benefits both architecture. Note that nobody would have complained that the code was not tested on ARM if the hypercall was implemented in the common code. Even if it could break the platform...
So you really don't mind if Razvan submits a patch for code that he hasn't tested and isn't sure works?
For someone coming along later wanting to use this functionality, I would think "It's not implemented yet, but here is the x86 version you can easily copy" would be better than "It's been implemented but never tested -- we're not sure if it actually works or not".
Having common code not tested on ARM is slightly different. At least in that case you know that the basic algorithm is correct because the code works on one platform. The only things that might break are x86-specific assumptions. Having the code not tested *at all*, other than compile-tested, seems a lot worse to me.
Anyone else have an opinion?
Tamas and company have already implemented a fair amount of the mem_access stuff for ARM -- it seems likely that this is the sort of thing they would probably end up implementing at some point once they get around to it.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
George Dunlap writes ("Re: [PATCH V3] tools/libxc, xen/x86: Added xc_set_mem_access_multi()"):
Quoted 2 lines
So you really don't mind if Razvan submits a patch for code that he hasn't tested and isn't sure works?
I don't think that's a very good idea. (Are there possible security implications? It's not entirely clear to me...)
Under the circumstances I don't think it's reasonable to expect Razvan to write the patch, unless some ARM maintainer is willing to test it.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 9 lines · Ian Jackson
George Dunlap writes ("Re: [PATCH V3]
tools/libxc, xen/x86: Addedxc_set_mem_access_multi()"):Quoted 2 lines
So you really don't mind if Razvan submits a patch for code that he hasn't tested and isn't sure works?
I don't think that's a very good idea. (Are there possible security implications? It's not entirely clear to me...)
Under the circumstances I don't think it's reasonable to expect Razvan to write the patch, unless some ARM maintainer is willing to test it.
That was implied from my side. It has been done recently on other various patches which require modifications in the ARM code.
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 53 lines · George Dunlap
Quoted 52 lines · Julien Grall
Quoted 38 lines · George Dunlap
Quoted 29 lines · Julien Grall
Quoted 26 lines · Razvan Cojocaru
Hello,
Quoted 23 lines · Razvan Cojocaru
Quoted 17 lines
xen/arch/arm/p2m.c +0
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d,
gfn_t
gfn,uint32_tnr,return 0;}
xen/arch/arm/p2m.c +2
-0+long p2m_set_mem_access_multi (struct domain *d, + const XEN_GUEST_HANDLE(const_uint64)
pfn_list,
+ constXEN_GUEST_HANDLE(const_uint8)access_list,
+uint32_tnr,uint32_tstart,uint32_t
mask,xen/arch/arm/p2m.c
Quoted 3 lines
xen/arch/arm/p2m.c +3
-0+ unsigned int altp2m_idx) +{ +return -ENOTSUP ;Why didn't you implement this function for ARM?
Quoted 7 lines
Quoted 3 lines
Because unfortunately I don't have an ARM setup to test it on and I thought it would be unfair to publish the patch with untestable ARM support.
So what's the plan? Who will implement the ARM solution?
I don't think there is a technical challenge to implement the ARM one.
Quoted 7 lines
Are we going to require that all new functionality be implemented both on x86 and on ARM? That seems like a bit of a lot to ask of someone who's not going to use it (and as Razvan points out, can't even test it). The
mem_accessfunctionality is still fairly technical -- anyone who decides they want to use it and runs across the same problem Razvan did should have no trouble implementing this hypercall for ARM when they need it.I am not saying we should every time implement the ARM version when the x86 version is added and vice-versa.
Quoted 7 lines
Quoted 4 lines
However, I don't think this is a lot to ask when an hypercall benefits both architecture. Note that nobody would have complained that the code was not tested on ARM if the hypercall was implemented in the common code. Even if it could break the platform...
So you really don't mind if Razvan submits a patch for code that he hasn't tested and isn't sure works?
To be fair, I don't mind as long as it is marked untested. I already saw this kind of patch on the mailing list, and I always tested the patch myself.
It is much better than waiting another couple of release to have a simple hypercall implemented.
Quoted 11 lines
For someone coming along later wanting to use this functionality, I would think "It's not implemented yet, but here is the x86 version you can easily copy" would be better than "It's been implemented but never tested -- we're not sure if it actually works or not".
Having common code not tested on ARM is slightly different. At least in that case you know that the basic algorithm is correct because the code works on one platform. The only things that might break are x86-specific assumptions. Having the code not tested *at all*, other than compile-tested, seems a lot worse to me.
ARM is providing free model [1] which can boot Xen. It is not difficult to setup and does not take much time to test a patch series.
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 79 lines · Julien Grall
Quoted 55 lines · George Dunlap
Quoted 54 lines · Julien Grall
Quoted 39 lines · George Dunlap
Quoted 30 lines · Julien Grall
Quoted 27 lines · Razvan Cojocaru
Hello,
Quoted 24 lines · Razvan Cojocaru
Quoted 18 lines
xen/arch/arm/p2m.c +0
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d,
gfn_t
gfn,uint32_tnr,return 0;}
xen/arch/arm/p2m.c +2
-0+long p2m_set_mem_access_multi (struct domain *d, + const XEN_GUEST_HANDLE(const_uint64)
pfn_list,
+ constXEN_GUEST_HANDLE(const_uint8)access_list,
+uint32_tnr,uint32_tstart,uint32_t
mask,xen/arch/arm/p2m.c
Quoted 3 lines
xen/arch/arm/p2m.c +3
-0+ unsigned int altp2m_idx) +{ +return -ENOTSUP ;Why didn't you implement this function for ARM?
Quoted 7 lines
Quoted 3 lines
Because unfortunately I don't have an ARM setup to test it on and I thought it would be unfair to publish the patch with untestable ARM support.
So what's the plan? Who will implement the ARM solution?
I don't think there is a technical challenge to implement the ARM one.
Quoted 8 lines
Are we going to require that all new functionality be implemented both on x86 and on ARM? That seems like a bit of a lot to ask of someone who's not going to use it (and as Razvan points out, can't even test it). The
mem_accessfunctionality is still fairly technical -- anyone who decides they want to use it and runs across the same problem Razvan did should have no trouble implementing this hypercall for ARM when they
need it.I am not saying we should every time implement the ARM version when the x86 version is added and vice-versa.
Quoted 7 lines
Quoted 4 lines
However, I don't think this is a lot to ask when an hypercall benefits both architecture. Note that nobody would have complained that the code was not tested on ARM if the hypercall was implemented in the common code. Even if it could break the platform...
So you really don't mind if Razvan submits a patch for code that he hasn't tested and isn't sure works?
To be fair, I don't mind as long as it is marked untested. I already saw this kind of patch on the mailing list, and I always tested the patch myself.
It is much better than waiting another couple of release to have a simple hypercall implemented.
Quoted 6 lines
For someone coming along later wanting to use this functionality, I would think "It's not implemented yet, but here is the x86 version you can easily copy" would be better than "It's been implemented but never tested -- we're not sure if it actually works or not".
Quoted 8 lines
Quoted 5 lines
Having common code not tested on ARM is slightly different. At least in that case you know that the basic algorithm is correct because the code works on one platform. The only things that might break are x86-specific assumptions. Having the code not tested *at all*, other than compile-tested, seems a lot worse to me.
ARM is providing free model [1] which can boot Xen. It is not difficult to setup and does not take much time to test a patch series.
I'm sure it's very easy to use for someone already familiar with the tools. I did manage to download the Foundation Model and run the test application that comes with it, but still need some time to figure out how to run anything more complicated.
But before that, since Tamas has expressed interest in this feature and is already working with ARM projects, maybe he'd be interested in a follow-up patch implementing this for ARM? IMHO this would be the best case since he's got both the hardware and the ARM tools to do the actual testing of the patch. Tamas, what do you think?
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Razvan Cojocaru writes ("Re: [PATCH V3] tools/libxc, xen/x86: Added xc_set_mem_access_multi()"):
Quoted 5 lines
But before that, since Tamas has expressed interest in this feature and is already working with ARM projects, maybe he'd be interested in a follow-up patch implementing this for ARM? IMHO this would be the best case since he's got both the hardware and the ARM tools to do the actual testing of the patch. Tamas, what do you think?
Julien has volunteered to test a patch you provide. How hard would it be for you to do what seems like the obvious thing and hand it over to Julien ?
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 10 lines · Ian Jackson
Razvan Cojocaru writes ("Re: [PATCH V3]
tools/libxc, xen/x86: Addedxc_set_mem_access_multi()"):Quoted 5 lines
But before that, since Tamas has expressed interest in this feature and is already working with ARM projects, maybe he'd be interested in a follow-up patch implementing this for ARM? IMHO this would be the best case since he's got both the hardware and the ARM tools to do the actual testing of the patch. Tamas, what do you think?
Julien has volunteered to test a patch you provide. How hard would it be for you to do what seems like the obvious thing and hand it over to Julien ?
I was under the impression that still enough voices called for this to be done at a later time / by interested parties working on ARM, both if which fit Tamas' profile.
To answer your question, it wouldn't be very hard, so I guess I'm taking that route.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 49 lines · Julien Grall
Quoted 38 lines · George Dunlap
Quoted 29 lines · Julien Grall
Quoted 26 lines · Razvan Cojocaru
Hello,
Quoted 23 lines · Razvan Cojocaru
Quoted 17 lines
xen/arch/arm/p2m.c +0
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d,
gfn_t
gfn,uint32_tnr,return 0;}
xen/arch/arm/p2m.c +2
-0+long p2m_set_mem_access_multi (struct domain *d, + const XEN_GUEST_HANDLE(const_uint64)
pfn_list,
+ constXEN_GUEST_HANDLE(const_uint8)access_list,
+uint32_tnr,uint32_tstart,uint32_t
mask,xen/arch/arm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1845
Quoted 3 lines
xen/arch/arm/p2m.c +3
-0+ unsigned int altp2m_idx) +{ +return -ENOTSUP ;Why didn't you implement this function for ARM?
Quoted 7 lines
Quoted 3 lines
Because unfortunately I don't have an ARM setup to test it on and I thought it would be unfair to publish the patch with untestable ARM support.
So what's the plan? Who will implement the ARM solution?
I don't think there is a technical challenge to implement the ARM one.
Quoted 7 lines
Are we going to require that all new functionality be implemented both on x86 and on ARM? That seems like a bit of a lot to ask of someone who's not going to use it (and as Razvan points out, can't even test it). The
mem_accessfunctionality is still fairly technical -- anyone who decides they want to use it and runs across the same problem Razvan did should have no trouble implementing this hypercall for ARM when they need it.
Quoted 7 lines
I am not saying we should every time implement the ARM version when the x86 version is added and vice-versa.
However, I don't think this is a lot to ask when an hypercall benefits both architecture. Note that nobody would have complained that the code was not tested on ARM if the hypercall was implemented in the common code. Even if it could break the platform...
Yes, but in that case the code would actually have been tested, because the common code runs (or should run) in the same manner for both ARM and x86. So x86 testing would have implicitly tested the common code.
For our case, it is unfortunately impossible to implement this in the common part of the code. The main reason for this is that it's important to avoid a TLB flush until the very end, so we can't just iterate over the arrays and call the old p2m_set_mem_access() for each element, since p2m_set_mem_access() flushes the TLB on each call (the common code approach was my first thought going in).
I certainly want everyone to be happy, but even assuming I "blindly" write some passable ARM code, it's always possible that a problem will pop up, at which point it will be rightly expected of me to remedy the situation as quickly as possible - but I may not even be able to investigate the issue.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 53 lines · Razvan Cojocaru
Quoted 52 lines · Julien Grall
Quoted 38 lines · George Dunlap
Quoted 29 lines · Julien Grall
Quoted 26 lines · Razvan Cojocaru
Hello,
Quoted 23 lines · Razvan Cojocaru
Quoted 17 lines
xen/arch/arm/p2m.c +0
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d,
gfn_t
gfn,uint32_tnr,return 0;}
xen/arch/arm/p2m.c +2
-0+long p2m_set_mem_access_multi (struct domain *d, + const XEN_GUEST_HANDLE(const_uint64)
pfn_list,
+ constXEN_GUEST_HANDLE(const_uint8)access_list,
+uint32_tnr,uint32_tstart,uint32_t
mask,xen/arch/arm/p2m.c
Quoted 3 lines
xen/arch/arm/p2m.c +3
-0+ unsigned int altp2m_idx) +{ +return -ENOTSUP ;Why didn't you implement this function for ARM?
Quoted 7 lines
Quoted 3 lines
Because unfortunately I don't have an ARM setup to test it on and I thought it would be unfair to publish the patch with untestable ARM support.
So what's the plan? Who will implement the ARM solution?
I don't think there is a technical challenge to implement the ARM one.
Quoted 7 lines
Are we going to require that all new functionality be implemented both on x86 and on ARM? That seems like a bit of a lot to ask of someone who's not going to use it (and as Razvan points out, can't even test it). The
mem_accessfunctionality is still fairly technical -- anyone who decides they want to use it and runs across the same problem Razvan did should have no trouble implementing this hypercall for ARM when they need it.I am not saying we should every time implement the ARM version when the x86 version is added and vice-versa.
Quoted 8 lines
Quoted 4 lines
However, I don't think this is a lot to ask when an hypercall benefits both architecture. Note that nobody would have complained that the code was not tested on ARM if the hypercall was implemented in the common code. Even if it could break the platform...
Yes, but in that case the code would actually have been tested, because the common code runs (or should run) in the same manner for both ARM and x86. So x86 testing would have implicitly tested the common code.
That's quite a big assumption. I have seen common code patch touching memory subsystem breaking ARM because the way memory is handled is different.
Quoted 7 lines
For our case, it is unfortunately impossible to implement this in the common part of the code. The main reason for this is that it's important to avoid a TLB flush until the very end, so we can't just iterate over the arrays and call the old
p2m_set_mem_access()for each element, sincep2m_set_mem_access()flushes the TLB on each call (the common code approach was my first thought going in).
Quoted 5 lines
I certainly want everyone to be happy, but even assuming I "blindly" write some passable ARM code, it's always possible that a problem will pop up, at which point it will be rightly expected of me to remedy the situation as quickly as possible - but I may not even be able to investigate the issue.
There is a free ARM model [1] available that can boot Xen easily.
Regards,
[1] http://www.arm.com/products/tools/models/foundation-model.php
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 28 lines · Julien Grall
Quoted 25 lines · Razvan Cojocaru
Hello,
Quoted 22 lines · Razvan Cojocaru
Quoted 16 lines
xen/arch/arm/p2m.c +4
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, return 0; } +long p2m_set_mem_access_multi (struct domain *d, +const XEN_GUEST_HANDLE (const_uint64) pfn_list, +const XEN_GUEST_HANDLE (const_uint8) access_list, + uint32_t nr, uint32_t start, uint32_tmask,
xen/arch/arm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1845
Quoted 3 lines
xen/arch/arm/p2m.c +3
-0+ unsigned int altp2m_idx) +{ +return -ENOTSUP ;Why didn't you implement this function for ARM?
Quoted 5 lines
Quoted 3 lines
Because unfortunately I don't have an ARM setup to test it on and I thought it would be unfair to publish the patch with untestable ARM support.
So what's the plan? Who will implement the ARM solution?
My assumption has been that whoever first needs this functionality and is working on an ARM project would implement it. Touching the ARM code only occured because it became necessary in order to compile.
The patch subject mentions that these are mainly x86 changes ("xen/x86").
Quoted 1 line
I don't think there is a technical challenge to implement the ARM one.
apply_p2m_changes(), which would require modification, doesn't look trivial, and I would unfortunately not be able to test the changes beyond making sure the code still compiles.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 12:00, <[email protected]> wrote:
xen/arch/arm/p2m.c +0
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,return 0 ;
xen/arch/arm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1846
Quoted 10 lines
xen/arch/arm/p2m.c +8
-0} +long p2m_set_mem_access_multi (struct domain *d, +const XEN_GUEST_HANDLE (const_uint64) pfn_list, +const XEN_GUEST_HANDLE (const_uint8) access_list, +uint32_t nr,uint32_t start,uint32_t mask, +unsigned int altp2m_idx) +{ +return -ENOTSUP ; +}
If this indeed fixes the build problem on ARM, then I'd like to have an explanation (by you or the ARM maintainers) where ENOTSUP gets defined. I can't find any single instance of this throughout the tree, and headers outside of the tree aren't supposed to get included in the hypervisor build.
xen/arch/x86/mm/p2m.c line 32
Quoted 8 lines
xen/arch/x86/mm/p2m.c +1
-0@@ -28,6 +28,7 @@#include <xen/event.h> #include <public/vm_event.h> #include <asm/domain.h> +#include <xen/guest_access.h> /* copy_from_guest() */ #include <asm/page.h>
I thought we've been through this before: Why does this xen/ include get added in the middle of asm/ ones?
Quoted 5 lines
xen/arch/x86/mm/p2m.c +3
-1+static int set_mem_access (struct domain *d,struct p2m_domain *p2m, +struct p2m_domain *ap2m,p2m_access_t a, +unsigned long gfn_l) { -struct p2m_domain *p2m =p2m_get_hostp2m (d), *ap2m =NULL ;
xen/arch/x86/mm/p2m.c int p2m_set_altp2m_mem_access(struct domain *d, struct p2m_domain *hp2m, · line 1805
Quoted 10 lines
xen/arch/x86/mm/p2m.c +4
-5-p2m_access_t a, _a; -p2m_type_t t; -mfn_t mfn; -unsigned long gfn_l; -long rc =0 ; +int rc =0 ; +if ( ap2m ) + { + rc =p2m_set_altp2m_mem_access (d, p2m, ap2m, a,_gfn (gfn_l));
With this it becomes pretty clear that, following our general direction, set_mem_access()'s last parameter should itself be gfn_t.
Quoted 1 line
+static
bool_tp2m_xenmem_access_to_p2m_access(structp2m_domain*p2m,
The p2m_ prefix is kind of redundant here as long as the function is static.
Also plain bool please in new code, and ...
Quoted 4 lines
xen/arch/x86/mm/p2m.c +0
-0@@ -1823,6 +1839,34 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,#undef ACCESS };
xen/arch/x86/mm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1851
Quoted 10 lines
xen/arch/x86/mm/p2m.c +10
-0+switch ( xaccess ) + { + case 0 ... ARRAY_SIZE(memaccess) - 1: + *paccess = memaccess[xaccess]; +break ; +case XENMEM_access_default: + *paccess = p2m->default_access; +break ; +default : +return 0 ;
... false and ...
xen/arch/x86/mm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1854
Quoted 3 lines
xen/arch/x86/mm/p2m.c +3
-0+ } + +return 1 ;
... true respectively then.
xen/arch/x86/mm/p2m.c int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) · line 538
Quoted 6 lines
xen/arch/x86/mm/p2m.c +2
-0@@ -520,6 +534,9 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) rc = -EFAULT ;break ; +case XENMEM_access_op: +break ;
There's a group of several other XENMEM_* which also require no action (right above the XENMEM_get_vnumainfo handling). Please simply add this new case there.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 12:00, <[email protected]> wrote:
xen/arch/arm/p2m.c +0
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,return 0 ; }
Quoted 14 lines
xen/arch/arm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1846
Quoted 8 lines
xen/arch/arm/p2m.c +8
-0+long p2m_set_mem_access_multi (struct domain *d, +const XEN_GUEST_HANDLE (const_uint64) pfn_list, +const XEN_GUEST_HANDLE (const_uint8) access_list, +uint32_t nr,uint32_t start,uint32_t mask, +unsigned int altp2m_idx) +{ +return -ENOTSUP ; +}If this indeed fixes the build problem on ARM, then I'd like to have an explanation (by you or the ARM maintainers) where ENOTSUP gets defined. I can't find any single instance of this throughout the tree, and headers outside of the tree aren't supposed to get included in the hypervisor build.
It's defined in errno.h, which some in-tree files do include, but as stated I don't, at the moment, have access to an ARM setup, so it is theoretically possible that the code still doesn't compile on ARM. I thought it would, since it's trivial.
I won't send the next version until it becomes possible for me to at least compile it on ARM.
Quoted 11 lines
xen/arch/x86/mm/p2m.c line 32
Quoted 8 lines
xen/arch/x86/mm/p2m.c +1
-0@@ -28,6 +28,7 @@#include <xen/event.h> #include <public/vm_event.h> #include <asm/domain.h> +#include <xen/guest_access.h> /* copy_from_guest() */ #include <asm/page.h> I thought we've been through this before: Why does this xen/ include get added in the middle of asm/ ones?
I'll fix this. I initially #included <asm/guest_access.h>, then fixed it to be <xen/guest_access.h> but forgot to reorder the includes.
Quoted 12 lines
Quoted 12 lines
xen/arch/x86/mm/p2m.c +4
-6+static int set_mem_access (struct domain *d,struct p2m_domain *p2m, +struct p2m_domain *ap2m,p2m_access_t a, +unsigned long gfn_l) { -struct p2m_domain *p2m =p2m_get_hostp2m (d), *ap2m =NULL ; -p2m_access_t a, _a; -p2m_type_t t; -mfn_t mfn; -unsigned long gfn_l; -long rc =0 ; +int rc =0 ;
Quoted 6 lines
xen/arch/x86/mm/p2m.c int p2m_set_altp2m_mem_access(struct domain *d, struct p2m_domain *hp2m, · line 1805
Quoted 3 lines
xen/arch/x86/mm/p2m.c +3
-0+if ( ap2m ) + { + rc =p2m_set_altp2m_mem_access (d, p2m, ap2m, a,_gfn (gfn_l));With this it becomes pretty clear that, following our general direction, set_mem_access()'s last parameter should itself be
gfn_t.
I'll change it.
Quoted 24 lines
Quoted 1 line
+static
bool_tp2m_xenmem_access_to_p2m_access(structp2m_domain*p2m,The
p2m_prefix is kind of redundant here as long as the function is static.Also plain bool please in new code, and ...
Quoted 4 lines
xen/arch/x86/mm/p2m.c +0
-0@@ -1823,6 +1839,34 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,#undef ACCESS };xen/arch/x86/mm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1851
Quoted 10 lines
xen/arch/x86/mm/p2m.c +10
-0+switch ( xaccess ) + { + case 0 ... ARRAY_SIZE(memaccess) - 1: + *paccess = memaccess[xaccess]; +break ; +case XENMEM_access_default: + *paccess = p2m->default_access; +break ; +default : +return 0 ;... false and ...
Quoted 5 lines
xen/arch/x86/mm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1854
Quoted 3 lines
xen/arch/x86/mm/p2m.c +3
-0+ } + +return 1 ;... true respectively then.
I'll switch to bool.
Quoted 10 lines
xen/arch/x86/mm/p2m.c int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) · line 538
Quoted 6 lines
xen/arch/x86/mm/p2m.c +2
-0@@ -520,6 +534,9 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) rc = -EFAULT ;break ; +case XENMEM_access_op: +break ;There's a group of several other XENMEM_* which also require no action (right above the
XENMEM_get_vnumainfohandling). Please simply add this new case there.
I'll move it there.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 16:21, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 12:00, <[email protected]> wrote:
xen/arch/arm/p2m.c +0
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,return 0 ; }Quoted 14 lines
xen/arch/arm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1846
Quoted 8 lines
xen/arch/arm/p2m.c +8
-0+long p2m_set_mem_access_multi (struct domain *d, +const XEN_GUEST_HANDLE (const_uint64) pfn_list, +const XEN_GUEST_HANDLE (const_uint8) access_list, +uint32_t nr,uint32_t start,uint32_t mask, +unsigned int altp2m_idx) +{ +return -ENOTSUP ; +}If this indeed fixes the build problem on ARM, then I'd like to have an explanation (by you or the ARM maintainers) where ENOTSUP gets defined. I can't find any single instance of this throughout the tree, and headers outside of the tree aren't supposed to get included in the hypervisor build.
Quoted 4 lines
It's defined in
errno.h, which some in-tree files do include, but as stated I don't, at the moment, have access to an ARM setup, so it is theoretically possible that the code still doesn't compile on ARM. I thought it would, since it's trivial.
I can't find any inclusion of plain errno.h (apart in tools built to aid the building process). There are xen/errno.h and, public/errno.h, but those - afaics - don't define ENOTSUP.
Quoted 2 lines
I won't send the next version until it becomes possible for me to at least compile it on ARM.
Indeed, compile testing is the minimal requirement.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 24 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 16:21, <[email protected]> wrote:
Quoted 21 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 12:00, <[email protected]> wrote:
xen/arch/arm/p2m.c +0
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,return 0 ;xen/arch/arm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1846
Quoted 10 lines
xen/arch/arm/p2m.c +8
-0} +long p2m_set_mem_access_multi (struct domain *d, +const XEN_GUEST_HANDLE (const_uint64) pfn_list, +const XEN_GUEST_HANDLE (const_uint8) access_list, +uint32_t nr,uint32_t start,uint32_t mask, +unsigned int altp2m_idx) +{ +return -ENOTSUP ; +}If this indeed fixes the build problem on ARM, then I'd like to have an explanation (by you or the ARM maintainers) where ENOTSUP gets defined. I can't find any single instance of this throughout the tree, and headers outside of the tree aren't supposed to get included in the hypervisor build.
Quoted 8 lines
Quoted 4 lines
It's defined in
errno.h, which some in-tree files do include, but as stated I don't, at the moment, have access to an ARM setup, so it is theoretically possible that the code still doesn't compile on ARM. I thought it would, since it's trivial.I can't find any inclusion of plain
errno.h(apart in tools built to aid the building process). There arexen/errno.hand,public/errno.h, but those - afaics - don't define ENOTSUP.
You're right. And yet, cross-compiling Xen for ARM64 as recommended here:
works without a hitch.
Maybe the some standard libc header we include brings errno.h in? I'm not sure what to do, should I switch to an error number from the in-tree errno.h (if so, which one would be the most appropriate)?
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 36 lines · Razvan Cojocaru
Quoted 24 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 16:21, <[email protected]> wrote:
Quoted 21 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 06.09.16 at 12:00, <[email protected]> wrote:
xen/arch/arm/p2m.c +0
-0@@ -1836,6 +1836,15 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,return 0 ;xen/arch/arm/p2m.c long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, · line 1846
Quoted 10 lines
xen/arch/arm/p2m.c +8
-0} +long p2m_set_mem_access_multi (struct domain *d, +const XEN_GUEST_HANDLE (const_uint64) pfn_list, +const XEN_GUEST_HANDLE (const_uint8) access_list, +uint32_t nr,uint32_t start,uint32_t mask, +unsigned int altp2m_idx) +{ +return -ENOTSUP ; +}If this indeed fixes the build problem on ARM, then I'd like to have an explanation (by you or the ARM maintainers) where ENOTSUP gets defined. I can't find any single instance of this throughout the tree, and headers outside of the tree aren't supposed to get included in the hypervisor build.
Quoted 8 lines
Quoted 4 lines
It's defined in
errno.h, which some in-tree files do include, but as stated I don't, at the moment, have access to an ARM setup, so it is theoretically possible that the code still doesn't compile on ARM. I thought it would, since it's trivial.I can't find any inclusion of plain
errno.h(apart in tools built to aid the building process). There arexen/errno.hand,public/errno.h, but those - afaics - don't define ENOTSUP.You're right. And yet, cross-compiling Xen for ARM64 as recommended here:
Quoted 7 lines
works without a hitch.
Maybe the some standard libc header we include brings
errno.hin? I'm not sure what to do, should I switch to an error number from the in-treeerrno.h(if so, which one would be the most appropriate)?
Nevermind, make dist-tools does not build xen.gz. Sorry for the noise.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel