Introduce runstate area registration with phys address
cover Introduce runstate area registration with phys address
From: Andrii Anisov <[email protected]>
Following discussion [1] it is introduced and implemented a runstate registration interface which uses guest's phys address instead of a virtual one. The new hypercall employes the same data structures as a predecessor, but expects the vcpu_runstate_info structure to not cross a page boundary. The interface is implemented in a way vcpu_runstate_info structure is mapped to the hypervisor on the hypercall processing and is directly accessed during its updates. This runstate area mapping follows vcpu_info structure registration.
The series is tested for ARM64. Build tested for x86. I'd appreciate if someone could check it with x86.
The Linux kernel patch is here [2]. Though it is for 4.14.
[1] https://lists.xenproject.org/archives/html/xen-devel/2019-02/msg00416.html
[2] https://github.com/aanisov/linux/commit/ba34d2780f57ea43f81810cd695aace7b55c0f29
Andrii Anisov (2):
xen: introduce VCPUOP_register_runstate_phys_memory_area hypercall
xen: implement VCPUOP_register_runstate_phys_memory_area
xen/arch/arm/domain.c | 59 +++++++++++++++++++-------- xen/arch/x86/domain.c | 87 ++++++++++++++++++++++++++++------------ xen/common/domain.c | 95 +++++++++++++++++++++++++++++++++++++++++++- xen/include/asm-arm/domain.h | 2 + xen/include/public/vcpu.h | 16 ++++++++ xen/include/xen/domain.h | 5 +++ xen/include/xen/sched.h | 7 ++++ 7 files changed, 227 insertions(+), 44 deletions(-)
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 1/2 xen: introduce VCPUOP_register_runstate_phys_memory_area hypercall
From: Andrii Anisov <[email protected]>
The hypercall employs the same vcpu_register_runstate_memory_area structure for the interface, but requires registered area to not cross a page boundary.
--- xen/arch/arm/domain.c | 39 ++++++++++++++++++--------------- xen/arch/x86/domain.c | 55 ++++++++++++++++++++++++++--------------------- xen/common/domain.c | 7 ++++++ xen/include/public/vcpu.h | 16 ++++++++++++++ xen/include/xen/sched.h | 7 ++++++ 5 files changed, 83 insertions(+), 41 deletions(-)
xen/arch/arm/domain.c +22 -17
@@ -277,29 +277,33 @@ static void ctxt_switch_to(struct vcpu *n)/* Update per-VCPU guest runstate shared memory area (if registered). */ static void update_runstate_area (struct vcpu *v) { -void __user *guest_handle =NULL ; -if (guest_handle_is_null (runstate_guest (v)) )return ; -if (VM_ASSIST (v->domain, runstate_update_flag) ) +if ( v->runstate_guest_type ==RUNSTATE_VADDR ) { - guest_handle = &v->runstate_guest.p->state_entry_time +1 ; - guest_handle--; - v->runstate.state_entry_time |=XEN_RUNSTATE_UPDATE ; -__raw_copy_to_guest (guest_handle, - (void *)(&v->runstate.state_entry_time +1 ) -1 ,1 ); -smp_wmb (); - } +void __user *guest_handle =NULL ; +if (VM_ASSIST (v->domain, runstate_update_flag) ) + { + guest_handle = &v->runstate_guest.p->state_entry_time +1 ; + guest_handle--; + v->runstate.state_entry_time |=XEN_RUNSTATE_UPDATE ; +__raw_copy_to_guest (guest_handle, + (void *)(&v->runstate.state_entry_time +1 ) -1 , +1 ); +smp_wmb (); + } -__copy_to_guest (runstate_guest (v), &v->runstate,1 ); +__copy_to_guest (runstate_guest (v), &v->runstate,1 ); -if ( guest_handle ) - { - v->runstate.state_entry_time &= ~XEN_RUNSTATE_UPDATE ; -smp_wmb (); -__raw_copy_to_guest (guest_handle, - (void *)(&v->runstate.state_entry_time +1 ) -1 ,1 ); +if ( guest_handle ) + { + v->runstate.state_entry_time &= ~XEN_RUNSTATE_UPDATE ; +smp_wmb (); +__raw_copy_to_guest (guest_handle, + (void *)(&v->runstate.state_entry_time +1 ) -1 , +1 ); + } } }
@@ -998,6 +1002,7 @@ long do_arm_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) a {case VCPUOP_register_vcpu_info:case VCPUOP_register_runstate_memory_area: +case VCPUOP_register_runstate_phys_memory_area:return do_vcpu_op (cmd, vcpuid, arg);default :return -EINVAL ;
xen/arch/x86/domain.c +31 -24
67 lines not on this page · raw message
xen/common/domain.c +7 -0
@@ -1521,6 +1521,7 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) rc =0 ;runstate_guest (v) = area.addr.h; + v->runstate_guest_type =RUNSTATE_VADDR ;if ( v == current ) {
@@ -1535,6 +1536,12 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg)break ; } +case VCPUOP_register_runstate_phys_memory_area: + { + rc = -ENOSYS ; +break ; + } +#ifdef VCPU_TRAP_NMI case VCPUOP_send_nmi:if ( !guest_handle_is_null (arg) )
xen/include/public/vcpu.h +16 -0
@@ -235,6 +235,22 @@ struct vcpu_register_time_memory_area {typedef struct vcpu_register_time_memory_area vcpu_register_time_memory_area_t ;DEFINE_XEN_GUEST_HANDLE (vcpu_register_time_memory_area_t); +/* +* Register a shared memory area from which the guest may obtain its own +* runstate information without needing to execute a hypercall. +* Notes: +* 1. The registered address must be guest's physical address. +* 2. The registered runstate area should not cross page boundary. +* 3. Only one shared area may be registered per VCPU. The shared area is +* updated by the hypervisor each time the VCPU is scheduled. Thus +* runstate.state will always be RUNSTATE_running and +* runstate.state_entry_time will indicate the system time at which the +* VCPU was last scheduled to run. +* @extra_arg == pointer to vcpu_register_runstate_memory_area structure. +*/ +#define VCPUOP_register_runstate_phys_memory_area 14 + +#endif /* __XEN_PUBLIC_VCPU_H__ */ /*
xen/include/xen/sched.h +7 -0
@@ -163,6 +163,13 @@ struct vcpuvoid *sched_priv;/* scheduler-specific data */ struct vcpu_runstate_info runstate; + +enum { +RUNSTATE_NONE =0 , +RUNSTATE_PADDR =1 , +RUNSTATE_VADDR =2 , + } runstate_guest_type; +#ifndef CONFIG_COMPAT # define runstate_guest (v) ((v)->runstate_guest)XEN_GUEST_HANDLE (vcpu_runstate_info_t) runstate_guest;/* guest address */
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 1/2 for-4.12] xen: introduce VCPUOP_register_runstate_phys_memory_area hypercall
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 05.03.19 at 14:14, <[email protected]> wrote:
From: Andrii Anisov <[email protected]>
The hypercall employs the same
vcpu_register_runstate_memory_areastructure for the interface, but requires registered area to not cross a page boundary.Signed-off-by Andrii Anisov <[email protected]>
While first of all you'll need to settle the dispute with Julien, a couple of comments on the actual changes you do in case the approach is to be pursued.
xen/arch/arm/domain.c static void ctxt_switch_to(struct vcpu *n) · line 281
Quoted 10 lines
xen/arch/arm/domain.c +0
-2@@ -277,29 +277,33 @@ static void ctxt_switch_to(struct vcpu *n)/* Update per-VCPU guest runstate shared memory area (if registered). */ static void update_runstate_area (struct vcpu *v) { -void __user *guest_handle =NULL ; -if (guest_handle_is_null (runstate_guest (v)) )return ;
I think (seeing also patch 2) re-using the handle representation is a bad idea. If there's a Xen-internal mapping use a plain pointer. (All comments on Arm code respectively apply to the x86 version, also [if any] in patch 2.)
xen/arch/arm/domain.c static void ctxt_switch_to(struct vcpu *n) · line 282
Quoted 2 lines
xen/arch/arm/domain.c +1
-1-if (VM_ASSIST (v->domain, runstate_update_flag) ) +if ( v->runstate_guest_type ==RUNSTATE_VADDR )
Patch 2 shows that this wants to be switch().
Quoted 28 lines
xen/arch/arm/domain.c +12
-13{ - guest_handle = &v->runstate_guest.p->state_entry_time +1 ; - guest_handle--; - v->runstate.state_entry_time |=XEN_RUNSTATE_UPDATE ; -__raw_copy_to_guest (guest_handle, - (void *)(&v->runstate.state_entry_time +1 ) -1 ,1 ); -smp_wmb (); - } +void __user *guest_handle =NULL ; +if (VM_ASSIST (v->domain, runstate_update_flag) ) + { + guest_handle = &v->runstate_guest.p->state_entry_time +1 ; + guest_handle--; + v->runstate.state_entry_time |=XEN_RUNSTATE_UPDATE ; +__raw_copy_to_guest (guest_handle, + (void *)(&v->runstate.state_entry_time +1 ) -1 , +1 ); +smp_wmb (); + } -__copy_to_guest (runstate_guest (v), &v->runstate,1 ); +__copy_to_guest (runstate_guest (v), &v->runstate,1 ); -if ( guest_handle ) - { - v->runstate.state_entry_time &= ~XEN_RUNSTATE_UPDATE ; -smp_wmb (); - __raw_copy_to_guest(guest_handle,
xen/arch/arm/domain.c static void ctxt_switch_to(struct vcpu *n) · line 307
Quoted 10 lines
xen/arch/arm/domain.c +8
-1- (void *)(&v->runstate.state_entry_time + 1) - 1, 1); +if ( guest_handle ) + { + v->runstate.state_entry_time &= ~XEN_RUNSTATE_UPDATE ; +smp_wmb (); +__raw_copy_to_guest (guest_handle, + (void *)(&v->runstate.state_entry_time +1 ) -1 , +1 ); + } }
There looks to be an "else" missing here (or "default:" once changed to switch()), which you have on the x86 side. I'm unconvinced it should be "return true" there though (in which case having nothing here would indeed have been correct) - ASSERT_UNREACHABLE() would much rather seem appropriate.
xen/arch/arm/domain.c long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) · line 1543
Quoted 9 lines
xen/arch/arm/domain.c +5
-0@@ -1535,6 +1536,12 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg)break ; } +case VCPUOP_register_runstate_phys_memory_area: + { + rc = -ENOSYS ; +break ; + }
Stray braces and bad use of -ENOSYS (should be e.g. -EOPNOTSUPP).
Quoted 8 lines
xen/include/public/vcpu.h +2
-0@@ -235,6 +235,22 @@ struct vcpu_register_time_memory_area {typedef struct vcpu_register_time_memory_area vcpu_register_time_memory_area_t ;DEFINE_XEN_GUEST_HANDLE (vcpu_register_time_memory_area_t); +/* +* Register a shared memory area from which the guest may obtain its own
xen/include/public/vcpu.h struct vcpu_register_time_memory_area { · line 249
Quoted 10 lines
xen/include/public/vcpu.h +10
-0+* runstate information without needing to execute a hypercall. +* Notes: +* 1. The registered address must be guest's physical address. +* 2. The registered runstate area should not cross page boundary. +* 3. Only one shared area may be registered per VCPU. The shared area is +* updated by the hypervisor each time the VCPU is scheduled. Thus +* runstate.state will always be RUNSTATE_running and +* runstate.state_entry_time will indicate the system time at which the +* VCPU was last scheduled to run. +* @extra_arg == pointer to vcpu_register_runstate_memory_area structure.
I don't think re-use of that structure is appropriate to represent a physical address.
xen/include/public/vcpu.h struct vcpu_register_time_memory_area { · line 254
Quoted 5 lines
xen/include/public/vcpu.h +4
-0+*/ +#define VCPUOP_register_runstate_phys_memory_area 14 + +#endif /* __XEN_PUBLIC_VCPU_H__ */
Stray double blank lines.
xen/include/xen/sched.h struct vcpu · line 171
Quoted 12 lines
xen/include/xen/sched.h +6
-0@@ -163,6 +163,13 @@ struct vcpuvoid *sched_priv;/* scheduler-specific data */ struct vcpu_runstate_info runstate; + +enum { +RUNSTATE_NONE =0 , +RUNSTATE_PADDR =1 , +RUNSTATE_VADDR =2 , + } runstate_guest_type;
I can see that putting the new field here nicely groups with the other related fields. But this should be weighed against the introduction of a new padding hole, as opposed to fitting the field into a existing padding space. An abbreviated version of the reasoning should be put in the description.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 2/2 xen: implement VCPUOP_register_runstate_phys_memory_area
In reply to Andrii AnisovFrom: Andrii Anisov <[email protected]>
VCPUOP_register_runstate_phys_memory_area is implemented via runstate area mapping.
--- xen/arch/arm/domain.c | 22 ++++++++++- xen/arch/x86/domain.c | 34 ++++++++++++++-- xen/common/domain.c | 92 ++++++++++++++++++++++++++++++++++++++++++-- xen/include/asm-arm/domain.h | 2 + xen/include/xen/domain.h | 5 +++ 5 files changed, 148 insertions(+), 7 deletions(-)
xen/arch/arm/domain.c +21 -1
@@ -275,7 +275,7 @@ static void ctxt_switch_to(struct vcpu *n) }/* Update per-VCPU guest runstate shared memory area (if registered). */ -static void update_runstate_area (struct vcpu *v) +void update_runstate_area (struct vcpu *v) {if (guest_handle_is_null (runstate_guest (v)) )return ;
@@ -305,6 +305,26 @@ static void update_runstate_area(struct vcpu *v) 1); } } +else if ( v->runstate_guest_type ==RUNSTATE_PADDR ) + { +if (VM_ASSIST (v->domain, runstate_update_flag) ) + { +runstate_guest (v).p->state_entry_time |=XEN_RUNSTATE_UPDATE ; +smp_wmb (); + v->runstate.state_entry_time |=XEN_RUNSTATE_UPDATE ; + } + +memcpy (runstate_guest (v).p, &v->runstate,sizeof (v->runstate)); + +if (VM_ASSIST (v->domain, runstate_update_flag) ) + { +runstate_guest (v).p->state_entry_time &= ~XEN_RUNSTATE_UPDATE ; +smp_wmb (); + v->runstate.state_entry_time &= ~XEN_RUNSTATE_UPDATE ; + } + } +else + {/* No actions required */ } }static void schedule_tail (struct vcpu *prev)
xen/arch/x86/domain.c +31 -3
@@ -1605,7 +1605,7 @@ void paravirt_ctxt_switch_to(struct vcpu *v)/* Update per-VCPU guest runstate shared memory area (if registered). */ bool update_runstate_area (struct vcpu *v) { -bool rc; +bool rc = true;struct guest_memory_policy policy = { .nested_guest_mode = false };void __user *guest_handle =NULL ;
@@ -1648,9 +1648,37 @@ bool update_runstate_area(struct vcpu *v) (void *)(&v->runstate.state_entry_time + 1) - 1, 1); } } -else +else if ( v->runstate_guest_type ==RUNSTATE_PADDR ) { - rc = true; +if (VM_ASSIST (v->domain, runstate_update_flag) ) + { + v->runstate.state_entry_time |=XEN_RUNSTATE_UPDATE ; +if (has_32bit_shinfo ((v)->domain) ) + v->runstate_guest.compat.p->state_entry_time |=XEN_RUNSTATE_UPDATE ; +else +runstate_guest (v).p->state_entry_time |=XEN_RUNSTATE_UPDATE ; +smp_wmb (); + } + +if (has_32bit_shinfo (v->domain) ) + { +struct compat_vcpu_runstate_info info; + +XLAT_vcpu_runstate_info (&info, &v->runstate); +memcpy (v->runstate_guest.compat.p, &info,sizeof (info)); + } +else +memcpy (runstate_guest (v).p, &v->runstate,sizeof (v->runstate)); + +if (VM_ASSIST (v->domain, runstate_update_flag) ) + { + v->runstate.state_entry_time &= ~XEN_RUNSTATE_UPDATE ; +if (has_32bit_shinfo ((v)->domain) ) + v->runstate_guest.compat.p->state_entry_time &= ~XEN_RUNSTATE_UPDATE ; +else +runstate_guest (v).p->state_entry_time &= ~XEN_RUNSTATE_UPDATE ; +smp_wmb (); + } }update_guest_memory_policy (v, &policy);
xen/common/domain.c +89 -3
122 lines not on this page · raw message
xen/include/asm-arm/domain.h +2 -0
@@ -217,6 +217,8 @@ void vcpu_show_execution_state(struct vcpu *);void vcpu_show_registers (const struct vcpu *);void vcpu_switch_to_aarch64_mode (struct vcpu *); +void update_runstate_area (struct vcpu *); +/* * Due to the restriction of GICv3, the number of vCPUs in AFF0 is * limited to 16, thus only the first 4 bits of AFF0 are legal. We will
xen/include/xen/domain.h +5 -0
@@ -118,4 +118,9 @@ struct vnuma_info {void vnuma_destroy (struct vnuma_info *vnuma); +struct vcpu_register_runstate_memory_area ; +int map_runstate_area (struct vcpu *v, +struct vcpu_register_runstate_memory_area *area); +void unmap_runstate_area (struct vcpu *v); +#endif /* __XEN_DOMAIN_H__ */
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2 for-4.12] xen: implement VCPUOP_register_runstate_phys_memory_area
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 05.03.19 at 14:14, <[email protected]> wrote:
xen/arch/arm/domain.c +10
-0@@ -305,6 +305,26 @@ static void update_runstate_area(struct vcpu *v) 1); } } +else if ( v->runstate_guest_type ==RUNSTATE_PADDR ) + { +if (VM_ASSIST (v->domain, runstate_update_flag) ) + { +runstate_guest (v).p->state_entry_time |=XEN_RUNSTATE_UPDATE ; +smp_wmb (); + v->runstate.state_entry_time |=XEN_RUNSTATE_UPDATE ; + } + +memcpy (runstate_guest (v).p, &v->runstate,sizeof (v->runstate));
xen/arch/arm/domain.c static void update_runstate_area(struct vcpu *v) · line 327
Quoted 10 lines
xen/arch/arm/domain.c +10
-0+ +if (VM_ASSIST (v->domain, runstate_update_flag) ) + { +runstate_guest (v).p->state_entry_time &= ~XEN_RUNSTATE_UPDATE ; +smp_wmb (); + v->runstate.state_entry_time &= ~XEN_RUNSTATE_UPDATE ; + } + } +else + {/* No actions required */ }
See my respective comment on patch 1.
xen/arch/arm/domain.c bool update_runstate_area(struct vcpu *v) · line 1656
Quoted 12 lines
xen/arch/arm/domain.c +5
-2@@ -1648,9 +1648,37 @@ bool update_runstate_area(struct vcpu *v) (void *)(&v->runstate.state_entry_time + 1) - 1, 1); } } -else +else if ( v->runstate_guest_type ==RUNSTATE_PADDR ) { - rc = true; +if (VM_ASSIST (v->domain, runstate_update_flag) ) + { + v->runstate.state_entry_time |=XEN_RUNSTATE_UPDATE ; +if (has_32bit_shinfo ((v)->domain) )
Stray inner parentheses (at least one more instance further down).
xen/common/domain.c int domain_kill(struct domain *d) · line 745
Quoted 11 lines
xen/common/domain.c +5
-0@@ -738,7 +738,14 @@ int domain_kill(struct domain *d)if (cpupool_move_domain (d, cpupool0) )return -ERESTART ; for_each_vcpu ( d, v ) + { +if ( v->runstate_guest_type ==RUNSTATE_VADDR ) +set_xen_guest_handle (runstate_guest (v),NULL ); +else +unmap_runstate_area (v);
Since this recurs further down, can't the VADDR case also be taken care of by unmap_runstate_area()?
xen/common/domain.c void unmap_vcpu_info(struct vcpu *v) · line 1348
Quoted 6 lines
xen/common/domain.c +2
-0@@ -1333,6 +1344,65 @@ void unmap_vcpu_info(struct vcpu *v)put_page_and_type (mfn_to_page (mfn)); } +int map_runstate_area (struct vcpu *v, +struct vcpu_register_runstate_memory_area *area)
Neither this nor the unmap function look to be used outside this file, so should be static. It also looks as if the second parameter could be constified.
xen/common/domain.c void unmap_vcpu_info(struct vcpu *v) · line 1355
Quoted 7 lines
xen/common/domain.c +7
-0+{ +unsigned long offset = area->addr.p & ~PAGE_MASK ; +gfn_t gfn =gaddr_to_gfn (area->addr.p); +struct domain *d = v->domain; +void *mapping; +struct page_info *page; +size_t size =sizeof (struct vcpu_runstate_info );
Stray blanks.
xen/common/domain.c void unmap_vcpu_info(struct vcpu *v) · line 1357
Quoted 1 line
xen/common/domain.c +1
-0+ASSERT (v->runstate_guest_type ==RUNSTATE_PADDR );
Another one.
xen/common/domain.c void unmap_vcpu_info(struct vcpu *v) · line 1362
Quoted 4 lines
xen/common/domain.c +4
-0+if ( offset > (PAGE_SIZE - size) ) +return -EINVAL ; + + page =get_page_from_gfn (d,gfn_x (gfn),NULL ,P2M_ALLOC );
Don't you also need P2M_UNSHARE? And is the p2m type of the page really of no interest here?
xen/common/domain.c void unmap_vcpu_info(struct vcpu *v) · line 1395
Quoted 11 lines
xen/common/domain.c +11
-0+void unmap_runstate_area (struct vcpu *v) +{ +mfn_t mfn; + +if ( v->runstate_guest_type !=RUNSTATE_PADDR ) +return ; + +if (guest_handle_is_null (runstate_guest (v)) ) +return ; + + mfn =_mfn (virt_to_mfn (runstate_guest (v).p));
The pointer is the result of __map_domain_page_global() - I don't think you can legitimately use virt_to_mfn() on it, at least not on x86; domain_page_map_to_mfn() is what you want to use here.
xen/common/domain.c long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) · line 1606
Quoted 7 lines
xen/common/domain.c +0
-1@@ -1532,13 +1602,29 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg)vcpu_runstate_get (v, &runstate);__copy_to_guest (runstate_guest (v), &runstate,1 ); } -break ; }
Undue removal of a blank line.
Quoted 6 lines
xen/common/domain.c +3
-1case VCPUOP_register_runstate_phys_memory_area: { - rc = -ENOSYS ; +struct vcpu_register_runstate_memory_area area; + + rc = -EFAULT ;
xen/common/domain.c long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) · line 1622
Quoted 10 lines
xen/common/domain.c +10
-0+if (copy_from_guest (&area, arg,1 ) ) +break ; + +unmap_runstate_area (v); + v->runstate_guest_type =RUNSTATE_PADDR ; + rc =map_runstate_area (v, &area); + +if ( rc ) + { + v->runstate_guest_type =RUNSTATE_NONE ;
All of this updating of type and mapping are racy, and I guess that's also what Julien has already pointed out. As long as the mapping can be updated by remote CPUs, you have to make sure that the consuming side can't see partially updated values. On option _might_ be to switch to NONE first, and to PADDR upon success (with suitable barriers in between). The logic then of course needs mirroring to the VADDR path.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 21 lines · Andrii Anisov
From: Andrii Anisov <[email protected]>
Following discussion [1] it is introduced and implemented a runstate registration interface which uses guest's phys address instead of a virtual one. The new hypercall employes the same data structures as a predecessor, but expects the
vcpu_runstate_infostructure to not cross a page boundary. The interface is implemented in a wayvcpu_runstate_infostructure is mapped to the hypervisor on the hypercall processing and is directly accessed during its updates. This runstate area mapping followsvcpu_infostructure registration.The series is tested for ARM64. Build tested for x86. I'd appreciate if someone could check it with x86.
The Linux kernel patch is here [2]. Though it is for 4.14.[1] https://lists.xenproject.org/archives/html/xen-devel/2019-02/msg00416.html
[2] https://github.com/aanisov/linux/commit/ba34d2780f57ea43f81810cd695aace7b55c0f29Andrii Anisov (2):
xen: introduceVCPUOP_register_runstate_phys_memory_areahypercall
xen: implementVCPUOP_register_runstate_phys_memory_area
Quoted 9 lines
xen/arch/arm/domain.c | 59 +++++++++++++++++++-------- xen/arch/x86/domain.c | 87 ++++++++++++++++++++++++++++------------ xen/common/domain.c | 95 +++++++++++++++++++++++++++++++++++++++++++- xen/include/asm-arm/domain.h | 2 + xen/include/public/vcpu.h | 16 ++++++++ xen/include/xen/domain.h | 5 +++ xen/include/xen/sched.h | 7 ++++ 7 files changed, 227 insertions(+), 44 deletions(-)
No new features for 4.12. This series will have to wait until 4.13.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hello Juergen,
Quoted 1 line · Juergen Gross
No new features for 4.12. This series will have to wait until 4.13.
This is rather a complex fix for [1].
[1] https://lists.xenproject.org/archives/html/xen-devel/2019-01/msg02379.html
Signature · 7 lines
Sincerely, Andrii Anisov. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 1 line · Andrii Anisov
Hello Juergen,
Hi,
Quoted 4 lines · Juergen Gross
Quoted 1 line
No new features for 4.12. This series will have to wait until 4.13.
This is rather a complex fix for [1].
I will back Juergen here. As I said in that thread, I don't consider it as a critical issue because of the type of guest we support. This is just an annoyance in debug build because of the number of message printed.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hello Julien,
Quoted 1 line · Julien Grall
This is just an annoyance in debug build because of the number of message printed.
It is not an annoyance, but inaccurate runstate info passed (actually not passed) to KPTI enabled guests. Debug build only makes the problem visible.
Signature · 7 lines
Sincerely, Andrii Anisov. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi,
Quoted 5 lines · Andrii Anisov
Hello Julien,
Quoted 1 line · Julien Grall
This is just an annoyance in debug build because of the number of message printed.
It is not an annoyance, but inaccurate runstate info passed (actually not passed) to KPTI enabled guests.
The runstate is actually updated just not for the guest. It will be done at the next context switch. But I am not convinced you will actually see a major differences in number here. Do you have figures?
Lastly, as you can see, I don't have the same opinions as you for the issues. It may have helped if you provided a descriptive cover letter explaining the issues rather than assuming we are all on the same page.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 3 lines · Julien Grall
Quoted 1 line · Andrii Anisov
It is not an annoyance, but inaccurate runstate info passed (actually not passed) to KPTI enabled guests.
The runstate is actually updated just not for the guest.
That is what I said.
Quoted 1 line
It will be done at the next context switch.
It *may* be done at one of the next context switches.
Quoted 1 line
But I am not convinced you will actually see a major differences in number here. Do you have figures?
No, no figures to measure inaccuracy. Yet its existence is obvious.
Signature · 7 lines
Sincerely, Andrii Anisov. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Andrii Anisov
Hello Juergen,
Quoted 1 line · Juergen Gross
No new features for 4.12. This series will have to wait until 4.13.
This is rather a complex fix for [1].
[1]
https://lists.xenproject.org/archives/html/xen-devel/2019-01/msg02379.html
With the problem existing for about 1 year now I still don't see the urgency to rush it into 4.12 "at the last minute".
And as you are saying: this is a rather complex fix. I'd like to have only one further RC before branching off 4.12, so I'd like to see this series to go in later.
It might still be considered for 4.12.1 (you'd have to negotiate that with the stable maintainer, of course).
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Juergen Gross
Quoted 5 lines · Andrii Anisov
Hello Juergen,
Quoted 1 line · Juergen Gross
No new features for 4.12. This series will have to wait until 4.13.
Quoted 8 lines
Quoted 5 lines
This is rather a complex fix for [1].
[1]
https://lists.xenproject.org/archives/html/xen-devel/2019-01/msg02379.htmlWith the problem existing for about 1 year now I still don't see the urgency to rush it into 4.12 "at the last minute".
I hope, that problem will be listed in the release notes as a known issue.
Quoted 7 lines
And as you are saying: this is a rather complex fix. I'd like to have only one further RC before branching off 4.12, so I'd like to see this series to go in later.
It might still be considered for 4.12.1 (you'd have to negotiate that with the stable maintainer, of course).
Should I send the series without for-4.12 mark?
Signature · 7 lines
Sincerely, Andrii Anisov. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi,
Quoted 3 lines · Andrii Anisov
The interface is implemented in a way
vcpu_runstate_infostructure is mapped to the hypervisor on the hypercall processing and is directly accessed during its updates.
I had some concern about this solution in [1] that have not been addressed nor even mentioned in the series.
This is not the first time this is happening, so I am going to ignore this series until you finally address the problems.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Dear Julien,
Quoted 1 line · Julien Grall
I had some concern about this solution in [1] that have not been addressed nor even mentioned in the series.
You missed the link.
So I assume you say about you preferences to not have runstate area mapped because of consuming vmap space for arm64. Also, along that thread you mentioned you that guest might change gva mapping, what is irrelevant to registration with physical address.
My reasons to have that runstate mapped are following:
- Introducing the new interface we are not burden with legacy, so in charge to impose requirements. In this case - to have runstate area not crossing a page boundary
- Global mapping used here does not consume vmap space on arm64. It seems to me x86 guys are ok with mapping as well, at least Roger suggested it from the beginning. So it should be ok for them as well.
- In case domain is mapping runstate with physical address, it can not change the mapping.
- I suppose, normally, runstate area would be registered once per vcpu. While it is updated each context switch, I do estimate it more optimal to have it mapped once on registration. This reduces two mappings per context switch in the worst case (one for prev vcpu, one for the next).
- IMHO, this implementation is simpler and cleaner than what I have for runstate mapping on access.
So, taking in account all above, I really do not see, how runstate area registered with physical address differs from vcpu_info and does not deserve to be permanently mapped.
Signature · 7 lines
Sincerely, Andrii Anisov. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 1 line · Andrii Anisov
Dear Julien,
Hello,
Quoted 5 lines · Julien Grall
Quoted 1 line
I had some concern about this solution in [1] that have not been addressed nor even mentioned in the series.
You missed the link.
I was referring to your [1].
Quoted 7 lines
So I assume you say about you preferences to not have runstate area mapped because of consuming vmap space for arm64. Also, along that thread you mentioned you that guest might change gva mapping, what is irrelevant to registration with physical address.
My reasons to have that runstate mapped are following:
- Introducing the new interface we are not burden with legacy, so in charge to
impose requirements. In this case - to have runstate area not crossing a page boundary
- Global mapping used here does not consume vmap space on arm64. It seems to
me x86 guys are ok with mapping as well, at least Roger suggested it from the beginning. So it should be ok for them as well.
You left arm32 out of your equations here...
Quoted 2 lines
- In case domain is mapping runstate with physical address, it can not change
the mapping.
This is not entirely correct. The domain can not change the mapping under our feet, but it can still change via the hypercall. There are nothing preventing that with current hypercall and the one your propose.
AFAICT, the vCPU operation can happen from a different vCPU. So now you need to add some kind of synchronization to avoid the page disappearing under your feet if the mapping is replaced from another vCPU. The risk is to write to a page the has been allocated for another purpose and corrupt it.
I am not entirely sure we want to deny the call been done twice as this may have an impact on the way the OS is written. So the only way would be to introduce either reference counting or lock (if the former is not possible).
This is not an issue with the current code because we only store the guest virtual address. The worst thing that can happen is we are writing to the wrong guest virtual address, but at that point this is a guest problem. Although we may want to use ACCESS_ONCE() in both load and store to ensure atomicity.
Quoted 2 lines
- I suppose, normally, runstate area would be registered once per vcpu. While
it is updated each context switch, I do estimate it more optimal to have it mapped once on registration. This reduces two mappings per context switch in the worst case (one for prev vcpu, one for the next).
Well the number you showed in the other thread didn't show any improvement at all... So please explain why we should call map_domain_page_global() here and using more vmap on arm32.
Quoted 2 lines
- IMHO, this implementation is simpler and cleaner than what I have for
runstate mapping on access.
Did you implement it using access_guest_memory_by_ipa?
But I don't think the implementation you suggest will be that simpler once you deal with the problem above.
Quoted 2 lines
So, taking in account all above, I really do not see, how runstate area registered with physical address differs from
vcpu_infoand does not deserve to be permanently mapped.
As I said to the other thread, we should switch all the hypercalls to use physical address. However, I am not convinced that keep the runstate mapped in Xen is a good idea.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Julien Grall
Quoted 5 lines
So I assume you say about you preferences to not have runstate area mapped because of consuming vmap space for arm64. Also, along that thread you mentioned you that guest might change gva mapping, what is irrelevant to registration with physical address.
My reasons to have that runstate mapped are following:
- Introducing the new interface we are not burden with legacy, so in charge to impose requirements. In this case - to have runstate area not crossing a page boundary
- Global mapping used here does not consume vmap space on arm64. It seems to me x86 guys are ok with mapping as well, at least Roger suggested it from the beginning. So it should be ok for them as well.You left arm32 out of your equations here...
Yes, I left arm32 aside.
Quoted 3 lines
Quoted 1 line
- In case domain is mapping runstate with physical address, it can not change the mapping.
This is not entirely correct. The domain can not change the mapping under our feet, but it can still change via the hypercall. There are nothing preventing that with current hypercall and the one your propose.
Could you please describe the scenario with more details and the interface used for it? Also vcpu_info needs protections from it. Do you agree?
Quoted 1 line
Well the number you showed in the other thread didn't show any improvement at all... So please explain why we should call
map_domain_page_global()here and using more vmap on arm32
I'm not expecting vmap might be a practical problem for arm32 based system.
With the current implementation numbers are equal to those I have for runstate mapping on access. But I'm not sure my test setup able to distinguish the difference.
Quoted 3 lines
Quoted 1 line
- IMHO, this implementation is simpler and cleaner than what I have for runstate mapping on access.
Did you implement it using
access_guest_memory_by_ipa?
Not exactly, access_guest_memory_by_ipa() has no implementation for x86. But it is made around that code.
Quoted 1 line
But I don't think the implementation you suggest will be that simpler once you deal with the problem above.I missed that problem. Will look at it.
Signature · 7 lines
Sincerely, Andrii Anisov. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Andrii,
Quoted 8 lines · Andrii Anisov
Quoted 6 lines · Julien Grall
Quoted 5 lines
So I assume you say about you preferences to not have runstate area mapped because of consuming vmap space for arm64. Also, along that thread you mentioned you that guest might change gva mapping, what is irrelevant to registration with physical address.
My reasons to have that runstate mapped are following:
- Introducing the new interface we are not burden with legacy, so in charge to impose requirements. In this case - to have runstate area not crossing a page boundary
- Global mapping used here does not consume vmap space on arm64. It seems to me x86 guys are ok with mapping as well, at least Roger suggested it from the beginning. So it should be ok for them as well.You left arm32 out of your equations here...
Yes, I left arm32 aside.
Why? Arm32 is as equally supported as Arm64.
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
- In case domain is mapping runstate with physical address, it can not change the mapping.
This is not entirely correct. The domain can not change the mapping under our feet, but it can still change via the hypercall. There are nothing preventing that with current hypercall and the one your propose.
Could you please describe the scenario with more details and the interface used for it?
What scenario? You just need to read the implementation of the current hypercall and see there are nothing preventing the call to be done twice.
When you are designing a new hypercall you have to think how a guest can misuse it (yes I said misuse not use!). Think about a guest with two vCPUs. vCPU A is constantly modifying the runstate for vCPU B. What could happen if the hypervisor is in the middle of context switch vCPU B?
As I pointed
Quoted 1 line
Also
vcpu_infoneeds protections from it. Do you agree?
vcpu_info cannot be called twice thanks to the following check in map_vcpu_info:
if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
return -EINVAL;Quoted 3 lines
Quoted 2 lines
Well the number you showed in the other thread didn't show any improvement at all... So please explain why we should call
map_domain_page_global()here and using more vmap on arm32I'm not expecting vmap might be a practical problem for arm32 based system.
Well vmap is quite small on Arm. So why should we use more of it if...
Quoted 1 line
With the current implementation numbers are equal to those I have for runstate mapping on access.
it does not make an real improvement to the context switch? But I recall you said the interrupt latency were worst with keeping the runstate mapped (7000ns vs 7900ns). You also saw a performance drop when using glmark2 benchmark. So how come you can say they are equal? What did change?
In other words, I don't want to keep things mapped in Xen if we can achieve similar performance with "mapping"/"unmapping" at context switch.
Quoted 1 line
But I'm not sure my test setup able to distinguish the difference.
Well, there are a lot of stuff happening during context switch. So the benefit of keeping the mapping is probably lost in the noise.
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
- IMHO, this implementation is simpler and cleaner than what I have for runstate mapping on access.
Did you implement it using
access_guest_memory_by_ipa?Not exactly,
access_guest_memory_by_ipa()has no implementation for x86. But it is made around that code.
For the HVM, the equivalent function is hvm_copy_to_guest_phys. I don't know what would be the interface for PV. Roger, any idea?
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 17 lines · Julien Grall
Hi Andrii,
Quoted 8 lines · Andrii Anisov
Quoted 6 lines · Julien Grall
Quoted 5 lines
So I assume you say about you preferences to not have runstate area mapped because of consuming vmap space for arm64. Also, along that thread you mentioned you that guest might change gva mapping, what is irrelevant to registration with physical address.
My reasons to have that runstate mapped are following:
- Introducing the new interface we are not burden with legacy, so in charge to impose requirements. In this case - to have runstate area not crossing a page boundary
- Global mapping used here does not consume vmap space on arm64. It seems to me x86 guys are ok with mapping as well, at least Roger suggested it from the beginning. So it should be ok for them as well.You left arm32 out of your equations here...
Yes, I left arm32 aside.
Why? Arm32 is as equally supported as Arm64.
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
- In case domain is mapping runstate with physical address, it can not change the mapping.
Quoted 8 lines
Quoted 2 lines
Quoted 1 line
This is not entirely correct. The domain can not change the mapping under our feet, but it can still change via the hypercall. There are nothing preventing that with current hypercall and the one your propose.
Could you please describe the scenario with more details and the interface used for it?
What scenario? You just need to read the implementation of the current hypercall and see there are nothing preventing the call to be done twice.
When you are designing a new hypercall you have to think how a guest can misuse it (yes I said misuse not use!). Think about a guest with two vCPUs. vCPU A is constantly modifying the runstate for vCPU B. What could happen if the hypervisor is in the middle of context switch vCPU B?
As I pointed
Hmmm this is a left-over of a sentence I was thinking to add but dropped.
Another use case to think about is multiple vCPUs trying to register a runstate concurrently for the same vCPU.
Quoted 33 lines
Quoted 2 lines
Also
vcpu_infoneeds protections from it. Do you agree?
vcpu_infocannot be called twice thanks to the following check inmap_vcpu_info:
if ( !mfn_eq(v->vcpu_info_mfn,INVALID_MFN) )
return-EINVAL;Quoted 3 lines
Quoted 2 lines
Well the number you showed in the other thread didn't show any improvement at all... So please explain why we should call
map_domain_page_global()here and using more vmap on arm32I'm not expecting vmap might be a practical problem for arm32 based system.
Well vmap is quite small on Arm. So why should we use more of it if...
Quoted 1 line
With the current implementation numbers are equal to those I have for runstate mapping on access.
it does not make an real improvement to the context switch? But I recall you said the interrupt latency were worst with keeping the runstate mapped (7000ns vs 7900ns). You also saw a performance drop when using glmark2 benchmark. So how come you can say they are equal? What did change?
In other words, I don't want to keep things mapped in Xen if we can achieve similar performance with "mapping"/"unmapping" at context switch.
Quoted 1 line
But I'm not sure my test setup able to distinguish the difference.
Well, there are a lot of stuff happening during context switch. So the benefit of keeping the mapping is probably lost in the noise.
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
- IMHO, this implementation is simpler and cleaner than what I have for runstate mapping on access.
Did you implement it using
access_guest_memory_by_ipa?Not exactly,
access_guest_memory_by_ipa()has no implementation for x86. But it is made around that code.For the HVM, the equivalent function is
hvm_copy_to_guest_phys. I don't know what would be the interface for PV. Roger, any idea?Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines · Julien Grall
Hi Andrii,
Quoted 4 lines · Andrii Anisov
Quoted 3 lines · Julien Grall
Quoted 2 lines
- IMHO, this implementation is simpler and cleaner than what I have for runstate mapping on access.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Did you implement it using
access_guest_memory_by_ipa?Not exactly,
access_guest_memory_by_ipa()has no implementation for x86. But it is made around that code.For the HVM, the equivalent function is
hvm_copy_to_guest_phys. I don't know what would be the interface for PV. Roger, any idea?
For PV I think you will have to use get_page_from_gfn, check the permissions, map it, write and unmap it. The same flow would also work for HVM, so I'm not sure if there's much point in using hvm_copy_to_guest_phys. Or you can implement a generic copy_to_guest_phys helper that works for both PV and HVM.
Note that for translated guests you will have to walk the HAP page tables for each vCPU for each context switch, which I think will be expensive in terms of performance (I might be wrong however, since I have no proof of this).
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Roger,
Thank you for the answer.
Quoted 21 lines · Roger Pau Monné
Quoted 7 lines · Julien Grall
Hi Andrii,
Quoted 4 lines · Andrii Anisov
Quoted 3 lines · Julien Grall
Quoted 2 lines
- IMHO, this implementation is simpler and cleaner than what I
have for runstate mapping on access.Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Did you implement it using
access_guest_memory_by_ipa?Not exactly,
access_guest_memory_by_ipa()has no implementation for x86. But it is made around that code.For the HVM, the equivalent function is
hvm_copy_to_guest_phys. I don't know what would be the interface for PV. Roger, any idea?For PV I think you will have to use
get_page_from_gfn, check the permissions, map it, write and unmap it. The same flow would also work for HVM, so I'm not sure if there's much point in usinghvm_copy_to_guest_phys. Or you can implement a genericcopy_to_guest_physhelper that works for both PV and HVM.
Quoted 4 lines
Note that for translated guests you will have to walk the HAP page tables for each vCPU for each context switch, which I think will be expensive in terms of performance (I might be wrong however, since I have no proof of this).
AFAICT, we already walk the page-table with the current implementation. So this should be no different here, except we will not need to walk the guest-PT here. No?
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 26 lines · Julien Grall
Hi Roger,
Thank you for the answer.
Quoted 21 lines · Roger Pau Monné
Quoted 7 lines · Julien Grall
Hi Andrii,
Quoted 4 lines · Andrii Anisov
Quoted 3 lines · Julien Grall
Quoted 2 lines
- IMHO, this implementation is simpler and cleaner than what I
have for runstate mapping on access.Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Did you implement it using
access_guest_memory_by_ipa?Not exactly,
access_guest_memory_by_ipa()has no implementation for x86. But it is made around that code.For the HVM, the equivalent function is
hvm_copy_to_guest_phys. I don't know what would be the interface for PV. Roger, any idea?For PV I think you will have to use
get_page_from_gfn, check the permissions, map it, write and unmap it. The same flow would also work for HVM, so I'm not sure if there's much point in usinghvm_copy_to_guest_phys. Or you can implement a genericcopy_to_guest_physhelper that works for both PV and HVM.
Quoted 8 lines
Quoted 4 lines
Note that for translated guests you will have to walk the HAP page tables for each vCPU for each context switch, which I think will be expensive in terms of performance (I might be wrong however, since I have no proof of this).
AFAICT, we already walk the page-table with the current implementation. So this should be no different here, except we will not need to walk the guest-PT here. No?
Yes, current implementation is even worse because it walks both the guest page tables and the HAP page tables in the HVM case. It would be interesting IMO if we could avoid walking any of those page tables.
I see you have concerns about permanently mapping the runstate area, so I'm not going to oppose, albeit even with only 1G of VA space you can map plenty of runstate areas, and taking into account this is 32bit hardware I'm not sure you will ever have that many vCPUs that you will run out of VA space to map runstate areas.
That being said, if the implementation turns out to be more complicated because of this permanent mapping, walking the guest HAP page tables is certainly no worse than what's done ATM.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Roger,
Quoted 40 lines · Roger Pau Monné
Quoted 26 lines · Julien Grall
Hi Roger,
Thank you for the answer.
Quoted 21 lines · Roger Pau Monné
Quoted 7 lines · Julien Grall
Hi Andrii,
Quoted 4 lines · Andrii Anisov
Quoted 3 lines · Julien Grall
Quoted 2 lines
- IMHO, this implementation is simpler and cleaner than what I
have for runstate mapping on access.Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Did you implement it using
access_guest_memory_by_ipa?Not exactly,
access_guest_memory_by_ipa()has no implementation for x86. But it is made around that code.For the HVM, the equivalent function is
hvm_copy_to_guest_phys. I don't know what would be the interface for PV. Roger, any idea?For PV I think you will have to use
get_page_from_gfn, check the permissions, map it, write and unmap it. The same flow would also work for HVM, so I'm not sure if there's much point in usinghvm_copy_to_guest_phys. Or you can implement a genericcopy_to_guest_physhelper that works for both PV and HVM.Quoted 8 lines
Quoted 4 lines
Note that for translated guests you will have to walk the HAP page tables for each vCPU for each context switch, which I think will be expensive in terms of performance (I might be wrong however, since I have no proof of this).
AFAICT, we already walk the page-table with the current implementation. So this should be no different here, except we will not need to walk the guest-PT here. No?
Yes, current implementation is even worse because it walks both the guest page tables and the HAP page tables in the HVM case. It would be interesting IMO if we could avoid walking any of those page tables.
Quoted 5 lines
I see you have concerns about permanently mapping the runstate area, so I'm not going to oppose, albeit even with only 1G of VA space you can map plenty of runstate areas, and taking into account this is 32bit hardware I'm not sure you will ever have that many vCPUs that you will run out of VA space to map runstate areas.
Actually the vmap is only 768MB. The vmap is at the moment used for mapping:
- MMIO devices (through ioremap)
- event channel pages
As the runstate is far smaller than a page, this sounds like a waste of memory for a benefits that haven't not yet been shown. Indeed, number provided by Andrii either show worst performance or similar one.
But TBH, I am not expecting that a really clear performance improvement on Arm as there are a lot to do in the context switch.
Quoted 4 lines
That being said, if the implementation turns out to be more complicated because of this permanent mapping, walking the guest HAP page tables is certainly no worse than what's done ATM.
To be honest I am not fully against always mapping the runstate in Xen. But I need data to show this is worth it. So far, the performance promised are not there and the implementation is not foolproof yet.
If we want to keep the runstate mapped permanently, then we need to add either a lock or a refcounting. So the page does not disappear during context switch if we happen to update the runstate concurrently (via the hypercall).
This may increase the complexity of the implementation (not sure by how much thought).
Another solution is to prevent the runstate to be updated. But I think we will just add a bit more burden in the guest OS.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 78 lines · Julien Grall
Hi Roger,
Quoted 43 lines · Roger Pau Monné
Quoted 33 lines · Julien Grall
Hi Roger,
Thank you for the answer.
Quoted 23 lines · Roger Pau Monné
Quoted 7 lines · Julien Grall
Hi Andrii,
Quoted 4 lines · Andrii Anisov
Quoted 3 lines · Julien Grall
Quoted 2 lines
- IMHO, this implementation is simpler and cleaner than what I have for runstate mapping on access.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Did you implement it using
access_guest_memory_by_ipa?Not exactly,
access_guest_memory_by_ipa()has no implementation for x86.
But it is made around that code.For the HVM, the equivalent function is
hvm_copy_to_guest_phys. I don't know
what would be the interface for PV. Roger, any idea?For PV I think you will have to use
get_page_from_gfn, check the permissions, map it, write and unmap it. The same flow would also work for HVM, so I'm not sure if there's much point in usinghvm_copy_to_guest_phys. Or you can implement a genericcopy_to_guest_physhelper that works for both PV and HVM.Quoted 4 lines
Note that for translated guests you will have to walk the HAP page tables for each vCPU for each context switch, which I think will be expensive in terms of performance (I might be wrong however, since I have no proof of this).
Quoted 4 lines
AFAICT, we already walk the page-table with the current implementation. So
this should be no different here, except we will not need to walk the guest-PT here. No?Yes, current implementation is even worse because it walks both the guest page tables and the HAP page tables in the HVM case. It would be interesting IMO if we could avoid walking any of those page tables.
Quoted 5 lines
I see you have concerns about permanently mapping the runstate area, so I'm not going to oppose, albeit even with only 1G of VA space you can map plenty of runstate areas, and taking into account this is 32bit hardware I'm not sure you will ever have that many vCPUs that you will run out of VA space to map runstate areas.
Actually the vmap is only 768MB. The vmap is at the moment used for mapping:
- MMIO devices (through ioremap)
- event channel pagesAs the runstate is far smaller than a page, this sounds like a waste of memory for a benefits that haven't not yet been shown. Indeed, number provided by Andrii either show worst performance or similar one.
But TBH, I am not expecting that a really clear performance improvement on Arm as there are a lot to do in the context switch.
Quoted 4 lines
That being said, if the implementation turns out to be more complicated because of this permanent mapping, walking the guest HAP page tables is certainly no worse than what's done ATM.
To be honest I am not fully against always mapping the runstate in Xen. But I need data to show this is worth it. So far, the performance promised are not there and the implementation is not foolproof yet.
If we want to keep the runstate mapped permanently, then we need to add either a lock or a refcounting. So the page does not disappear during context switch if we happen to update the runstate concurrently (via the hypercall).
Quoted 5 lines
This may increase the complexity of the implementation (not sure by how much thought).
Another solution is to prevent the runstate to be updated. But I think we will just add a bit more burden in the guest OS.
Not sure about other systems, but current Linux kernel registers the runstate area for other cpus only if those are not up. So there is no way the runstate of that foreign vcpu could be updated during registering it. Of course this would need to be tested (e.g. -EBUSY for registering runstate of an active foreign vcpu).
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Juergen,
Quoted 82 lines · Juergen Gross
Quoted 81 lines · Julien Grall
Hi Roger,
Quoted 43 lines · Roger Pau Monné
Quoted 33 lines · Julien Grall
Hi Roger,
Thank you for the answer.
Quoted 23 lines · Roger Pau Monné
Quoted 7 lines · Julien Grall
Hi Andrii,
Quoted 4 lines · Andrii Anisov
Quoted 3 lines · Julien Grall
Quoted 2 lines
- IMHO, this implementation is simpler and cleaner than what I
have for runstate mapping on access.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Did you implement it using
access_guest_memory_by_ipa?Not exactly,
access_guest_memory_by_ipa()has no implementation for x86.
But it is made around that code.For the HVM, the equivalent function is
hvm_copy_to_guest_phys. I don't know
what would be the interface for PV. Roger, any idea?For PV I think you will have to use
get_page_from_gfn, check the permissions, map it, write and unmap it. The same flow would also work for HVM, so I'm not sure if there's much point in usinghvm_copy_to_guest_phys. Or you can implement a genericcopy_to_guest_physhelper that works for both PV and HVM.Quoted 4 lines
Note that for translated guests you will have to walk the HAP page tables for each vCPU for each context switch, which I think will be expensive in terms of performance (I might be wrong however, since I have no proof of this).
Quoted 4 lines
AFAICT, we already walk the page-table with the current implementation. So
this should be no different here, except we will not need to walk the guest-PT here. No?Yes, current implementation is even worse because it walks both the guest page tables and the HAP page tables in the HVM case. It would be interesting IMO if we could avoid walking any of those page tables.
Quoted 5 lines
I see you have concerns about permanently mapping the runstate area, so I'm not going to oppose, albeit even with only 1G of VA space you can map plenty of runstate areas, and taking into account this is 32bit hardware I'm not sure you will ever have that many vCPUs that you will run out of VA space to map runstate areas.
Actually the vmap is only 768MB. The vmap is at the moment used for mapping:
- MMIO devices (through ioremap)
- event channel pagesAs the runstate is far smaller than a page, this sounds like a waste of memory for a benefits that haven't not yet been shown. Indeed, number provided by Andrii either show worst performance or similar one.
But TBH, I am not expecting that a really clear performance improvement on Arm as there are a lot to do in the context switch.
Quoted 4 lines
That being said, if the implementation turns out to be more complicated because of this permanent mapping, walking the guest HAP page tables is certainly no worse than what's done ATM.
To be honest I am not fully against always mapping the runstate in Xen. But I need data to show this is worth it. So far, the performance promised are not there and the implementation is not foolproof yet.
If we want to keep the runstate mapped permanently, then we need to add either a lock or a refcounting. So the page does not disappear during context switch if we happen to update the runstate concurrently (via the hypercall).
This may increase the complexity of the implementation (not sure by how much thought).
Quoted 8 lines
Quoted 2 lines
Another solution is to prevent the runstate to be updated. But I think we will just add a bit more burden in the guest OS.
Not sure about other systems, but current Linux kernel registers the runstate area for other cpus only if those are not up. So there is no way the runstate of that foreign vcpu could be updated during registering it. Of course this would need to be tested (e.g.
-EBUSYfor registering runstate of an active foreign vcpu).
I was under the impression that xen_vcpu_restore() (see arch/x86/xen/enlighten.c) may update the runstate while the vCPU is up (at least on pre-Xen 4.5). Did I miss anything?
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 96 lines · Julien Grall
Hi Juergen,
Quoted 84 lines · Juergen Gross
Quoted 83 lines · Julien Grall
Hi Roger,
Quoted 45 lines · Roger Pau Monné
Quoted 35 lines · Julien Grall
Hi Roger,
Thank you for the answer.
Quoted 25 lines · Roger Pau Monné
Quoted 8 lines · Julien Grall
Hi Andrii,
Quoted 5 lines · Andrii Anisov
Quoted 4 lines · Julien Grall
Quoted 3 lines
- IMHO, this implementation is simpler and cleaner than what I
have for runstate mapping on access.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Did you implement it using
access_guest_memory_by_ipa?Not exactly,
access_guest_memory_by_ipa()has no implementation for x86.
But it is made around that code.For the HVM, the equivalent function is
hvm_copy_to_guest_phys. I don't know
what would be the interface for PV. Roger, any idea?For PV I think you will have to use
get_page_from_gfn, check the permissions, map it, write and unmap it. The same flow would also work
for HVM, so I'm not sure if there's much point in usinghvm_copy_to_guest_phys. Or you can implement a genericcopy_to_guest_physhelper that works for both PV and HVM.Quoted 4 lines
Note that for translated guests you will have to walk the HAP page tables for each vCPU for each context switch, which I think will be expensive in terms of performance (I might be wrong however, since I have no proof of this).
Quoted 4 lines
AFAICT, we already walk the page-table with the current implementation. So
this should be no different here, except we will not need to walk the guest-PT here. No?Yes, current implementation is even worse because it walks both the guest page tables and the HAP page tables in the HVM case. It would be interesting IMO if we could avoid walking any of those page tables.
Quoted 5 lines
I see you have concerns about permanently mapping the runstate area, so I'm not going to oppose, albeit even with only 1G of VA space you can map plenty of runstate areas, and taking into account this is 32bit hardware I'm not sure you will ever have that many vCPUs that you will run out of VA space to map runstate areas.
Actually the vmap is only 768MB. The vmap is at the moment used for mapping:
- MMIO devices (through ioremap)
- event channel pagesAs the runstate is far smaller than a page, this sounds like a waste of memory for a benefits that haven't not yet been shown. Indeed, number provided by Andrii either show worst performance or similar one.
But TBH, I am not expecting that a really clear performance improvement on Arm as there are a lot to do in the context switch.
Quoted 4 lines
That being said, if the implementation turns out to be more complicated because of this permanent mapping, walking the guest HAP page tables is certainly no worse than what's done ATM.
To be honest I am not fully against always mapping the runstate in Xen. But I need data to show this is worth it. So far, the performance promised are not there and the implementation is not foolproof yet.
If we want to keep the runstate mapped permanently, then we need to add either a lock or a refcounting. So the page does not disappear during context switch if we happen to update the runstate concurrently (via the hypercall).
This may increase the complexity of the implementation (not sure by how much thought).
Quoted 8 lines
Quoted 2 lines
Another solution is to prevent the runstate to be updated. But I think we will just add a bit more burden in the guest OS.
Not sure about other systems, but current Linux kernel registers the runstate area for other cpus only if those are not up. So there is no way the runstate of that foreign vcpu could be updated during registering it. Of course this would need to be tested (e.g.
-EBUSYfor registering runstate of an active foreign vcpu).
Quoted 3 lines
I was under the impression that
xen_vcpu_restore()(seearch/x86/xen/enlighten.c) may update the runstate while the vCPU is up (at least on pre-Xen 4.5). Did I miss anything?
Pre Xen 4.5: yes. But I don't think you want to introduce the new semantics in Xen 4.4 and older?
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Juergen,
Quoted 97 lines · Juergen Gross
Quoted 96 lines · Julien Grall
Hi Juergen,
Quoted 92 lines · Juergen Gross
Quoted 80 lines · Julien Grall
Hi Roger,
Quoted 45 lines · Roger Pau Monné
Quoted 35 lines · Julien Grall
Hi Roger,
Thank you for the answer.
Quoted 25 lines · Roger Pau Monné
Quoted 8 lines · Julien Grall
Hi Andrii,
Quoted 5 lines · Andrii Anisov
Quoted 4 lines · Julien Grall
Quoted 3 lines
- IMHO, this implementation is simpler and cleaner than
what I
have for runstate mapping on access.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Did you implement it using
access_guest_memory_by_ipa?Not exactly,
access_guest_memory_by_ipa()has no implementation for x86.
But it is made around that code.For the HVM, the equivalent function is
hvm_copy_to_guest_phys. I don't know
what would be the interface for PV. Roger, any idea?For PV I think you will have to use
get_page_from_gfn, check the permissions, map it, write and unmap it. The same flow would also work
for HVM, so I'm not sure if there's much point in usinghvm_copy_to_guest_phys. Or you can implement a genericcopy_to_guest_physhelper that works for both PV and HVM.Quoted 4 lines
Note that for translated guests you will have to walk the HAP page tables for each vCPU for each context switch, which I think will be expensive in terms of performance (I might be wrong however, since I have no proof of this).
Quoted 4 lines
AFAICT, we already walk the page-table with the current implementation. So
this should be no different here, except we will not need to walk the guest-PT here. No?Yes, current implementation is even worse because it walks both the guest page tables and the HAP page tables in the HVM case. It would be interesting IMO if we could avoid walking any of those page tables.
Quoted 5 lines
I see you have concerns about permanently mapping the runstate area, so I'm not going to oppose, albeit even with only 1G of VA space you can map plenty of runstate areas, and taking into account this is 32bit hardware I'm not sure you will ever have that many vCPUs that you will run out of VA space to map runstate areas.
Actually the vmap is only 768MB. The vmap is at the moment used for mapping:
- MMIO devices (through ioremap)
- event channel pagesAs the runstate is far smaller than a page, this sounds like a waste of memory for a benefits that haven't not yet been shown. Indeed, number provided by Andrii either show worst performance or similar one.
But TBH, I am not expecting that a really clear performance improvement on Arm as there are a lot to do in the context switch.
Quoted 4 lines
That being said, if the implementation turns out to be more complicated because of this permanent mapping, walking the guest HAP page tables is certainly no worse than what's done ATM.
To be honest I am not fully against always mapping the runstate in Xen. But I need data to show this is worth it. So far, the performance promised are not there and the implementation is not foolproof yet.
If we want to keep the runstate mapped permanently, then we need to add either a lock or a refcounting. So the page does not disappear during context switch if we happen to update the runstate concurrently (via the hypercall).
Quoted 5 lines
This may increase the complexity of the implementation (not sure by how much thought).
Another solution is to prevent the runstate to be updated. But I think we will just add a bit more burden in the guest OS.
Not sure about other systems, but current Linux kernel registers the runstate area for other cpus only if those are not up. So there is no way the runstate of that foreign vcpu could be updated during registering it. Of course this would need to be tested (e.g.
-EBUSYfor registering runstate of an active foreign vcpu).
Quoted 6 lines
Quoted 3 lines
I was under the impression that
xen_vcpu_restore()(seearch/x86/xen/enlighten.c) may update the runstate while the vCPU is up (at least on pre-Xen 4.5). Did I miss anything?Pre Xen 4.5: yes. But I don't think you want to introduce the new semantics in Xen 4.4 and older?
That's correct, the hypercall will only be added for future Xen releases.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hello Julien, Guys,
Sorry for a delayed answer. I caught a pretty nasty flu after last long weekend, it made me completely unavailable last week :(
Quoted 1 line · Julien Grall
Why? Arm32 is as equally supported as Arm64.
Yep, I believe that.
But I do not expect one would build arm32 based systems with many vcpus.
I have an expression arm32 do not target server applications. Whats left? Embedded with 4, no, ok up to 8 VMs, 8 vcpus each. How much would it cost for runstates mappings?
Quoted 1 line
What scenario? You just need to read the implementation of the current hypercall and see there are nothing preventing the call to be done twice.
Ah, OK, you are about those kind of races. Yes, it looks I've overlooked that scenario.
Quoted 2 lines
When you are designing a new hypercall you have to think how a guest can misuse it (yes I said misuse not use!). Think about a guest with two vCPUs. vCPU A is constantly modifying the runstate for vCPU B. What could happen if the hypervisor is in the middle of context switch vCPU B?
Effects I can imagine, might be different:
- New runstate area might be updated on Arm64, maybe partially and concurrently (IIRC, we have all the RAM permanently mapped to XEN)
- Paging fault might happen on Arm32
- Smth. similar or different might happen on x86 PV or HVM
Yet, all of them are out of design and are quite unexpected.
Quoted 7 lines
As I pointed
Quoted 1 line
Also
vcpu_infoneeds protections from it. Do you agree?
vcpu_infocannot be called twice thanks to the following check inmap_vcpu_info:
if ( !mfn_eq(v->vcpu_info_mfn,INVALID_MFN) )
return-EINVAL;
Right you are.
Quoted 8 lines
Quoted 2 lines
Quoted 1 line
Well the number you showed in the other thread didn't show any improvement at all... So please explain why we should call
map_domain_page_global()here and using more vmap on arm32I'm not expecting vmap might be a practical problem for arm32 based system.
Well vmap is quite small on Arm. So why should we use more of it if...
Quoted 1 line
With the current implementation numbers are equal to those I have for runstate mapping on access.
it does not make an real improvement to the context switch? But I recall you said the interrupt latency were worst with keeping the runstate mapped (7000ns vs 7900ns).
Yes, for Roger's patch.
Quoted 1 line
You also saw a performance drop when using glmark2 benchmark.
Yes, I did see it with Roger's patch. But with mine - numbers are slightly better (~1%) for runstate being mapped. Also introducing more races preventing code will introduce its impact.
Quoted 1 line
So how come you can say they are equal? What did change?
Nothing seems to change in context switch part, but numbers with TBM and glmark2 differ. I do not understand why it happens. As well as I do not understand why TBM shown me latency increase where I expected noticeable reduction.
Quoted 1 line
In other words, I don't want to keep things mapped in Xen if we can achieve similar performance with "mapping"/"unmapping" at context switch.
I understand that clearly.
Quoted 3 lines
Quoted 1 line
But I'm not sure my test setup able to distinguish the difference.
Well, there are a lot of stuff happening during context switch. So the benefit of keeping the mapping is probably lost in the noise.
Finaly we received the whole set for Lauterbach tracer. The last adapter to get things together arrived last week. So I really hope I would be able to get trustworthy measurements of those subtle things nested into context switch.
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
- IMHO, this implementation is simpler and cleaner than what I have for runstate mapping on access.
Did you implement it using
access_guest_memory_by_ipa?Not exactly,
access_guest_memory_by_ipa()has no implementation for x86. But it is made around that code.For the HVM, the equivalent function is
hvm_copy_to_guest_phys. I don't know what would be the interface for PV. Roger, any idea?
Will turn to map on access implementation as well. To have options and being able to compare.
Signature · 7 lines
Sincerely, Andrii Anisov. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 1 line · Andrii Anisov
Hello Julien, Guys,
Hi,
Quoted 1 line
Sorry for a delayed answer. I caught a pretty nasty flu after last long weekend, it made me completely unavailable last week :(
Sorry to hear that.
Quoted 5 lines · Julien Grall
Quoted 1 line
Why? Arm32 is as equally supported as Arm64.
Yep, I believe that.
But I do not expect one would build arm32 based systems with many vcpus.
I have an expression arm32 do not target server applications. Whats left? Embedded with 4, no, ok up to 8 VMs, 8 vcpus each. How much would it cost for runstates mappings?
As I already said multiple times before, please try to explain everything in your first e-mail...
The limitations you mention is only for GICv2. If you use GICv3, the number of CPUs can go much higher. Whether this is going to be use in the future is another question. However, I would rather try to not discard 32-bit from any discussion as you don't know how this is going to be used in the future.
The Arm32 port is interesting because all the memory is not mapped in Xen. There are chance that the Arm64 will go towards the same in the future.
I have been thinking a bit more about arm32.I don't think we ever map 2GB of on-demand-paging in one go, so this could probably be reduced to 1GB. The other 1GB could be used to increase the vmap. This would give us up to 1792MB of vmap.
Pending to the performance result, the global mapping could be a solution for arm32 as well.
Quoted 8 lines
Quoted 2 lines
What scenario? You just need to read the implementation of the current hypercall and see there are nothing preventing the call to be done twice.
Ah, OK, you are about those kind of races. Yes, it looks I've overlooked that scenario.
Quoted 2 lines
When you are designing a new hypercall you have to think how a guest can misuse it (yes I said misuse not use!). Think about a guest with two vCPUs. vCPU A is constantly modifying the runstate for vCPU B. What could happen if the hypervisor is in the middle of context switch vCPU B?
Effects I can imagine, might be different:
- New runstate area might be updated on Arm64, maybe partially and
concurrently (IIRC, we have all the RAM permanently mapped to XEN)
Today the RAM is always permanently mapped, I can't promise this is going to be the case in the future.
Quoted 1 line
- Paging fault might happen on Arm32
What do you mean?
Quoted 3 lines
- Smth. similar or different might happen on x86 PV or HVM
Yet, all of them are out of design and are quite unexpected.
We *must* protect hypervisor against any guest behavior. Particularly the unexpected one. If the Android VM hit itself, then I pretty much don't care assuming the VM was misbehaving. However, I don't think anyone would be happy if the Android VM is able to take down the whole platform. At least, I would not want to be the passenger of that car...
Quoted 14 lines
Quoted 7 lines
As I pointed
Quoted 1 line
Also
vcpu_infoneeds protections from it. Do you agree?
vcpu_infocannot be called twice thanks to the following check inmap_vcpu_info:
if ( !mfn_eq(v->vcpu_info_mfn,INVALID_MFN) )
return-EINVAL;Right you are.
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
Well the number you showed in the other thread didn't show any improvement at all... So please explain why we should call
map_domain_page_global()here and using more vmap on arm32I'm not expecting vmap might be a practical problem for arm32 based system.
Well vmap is quite small on Arm. So why should we use more of it if...
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
With the current implementation numbers are equal to those I have for runstate mapping on access.
it does not make an real improvement to the context switch? But I recall you said the interrupt latency were worst with keeping the runstate mapped (7000ns vs 7900ns).
Yes, for Roger's patch.
Quoted 1 line
You also saw a performance drop when using glmark2 benchmark.
Yes, I did see it with Roger's patch. But with mine - numbers are slightly better (~1%) for runstate being mapped. > Also introducing more races preventing code will introduce its impact.
Please provide the numbers once you fixed the race.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 1 line · Julien Grall
As I already said multiple times before, please try to explain everything in your first e-mail...
I know. I'm trying to provide enough info in the cover letter. But it seems I do not succeed. Putting all the thoughts might lead into overburdened text. But it looks it should be done. Going to do that next time.
Quoted 7 lines
The limitations you mention is only for GICv2. If you use GICv3, the number of CPUs can go much higher. Whether this is going to be use in the future is another question. However, I would rather try to not discard 32-bit from any discussion as you don't know how this is going to be used in the future.
The Arm32 port is interesting because all the memory is not mapped in Xen. There are chance that the Arm64 will go towards the same in the future.
I have been thinking a bit more about arm32.I don't think we ever map 2GB of on-demand-paging in one go, so this could probably be reduced to 1GB. The other 1GB could be used to increase the vmap. This would give us up to 1792MB of vmap.
Pending to the performance result, the global mapping could be a solution for arm32 as well.
Well.. OK.
Quoted 8 lines
Quoted 2 lines
Effects I can imagine, might be different:
- New runstate area might be updated on Arm64, maybe partially and concurrently (IIRC, we have all the RAM permanently mapped to XEN)Today the RAM is always permanently mapped, I can't promise this is going to be the case in the future.
Quoted 1 line
- Paging fault might happen on Arm32
What do you mean?
Ouch... I did mean translation fault.
Quoted 5 lines
Quoted 4 lines
- Smth. similar or different might happen on x86 PV or HVM
Yet, all of them are out of design and are quite unexpected.
We *must* protect hypervisor against any guest behavior.
Totally agree.
Quoted 1 line
Particularly the unexpected one. If the Android VM hit itself, then I pretty much don't care assuming the VM was misbehaving. However, I don't think anyone would be happy if the Android VM is able to take down the whole platform. At least, I would not want to be the passenger of that car...
Neither do I.
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
You also saw a performance drop when using glmark2 benchmark.
Yes, I did see it with Roger's patch. But with mine - numbers are slightly better (~1%) for runstate being mapped. > Also introducing more races preventing code will introduce its impact.
Please provide the numbers once you fixed the race.
I'm laying my hands on the tracer now. Want to get numbers from it as well.
Signature · 7 lines
Sincerely, Andrii Anisov. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Andrii,
Quoted 6 lines · Andrii Anisov
Quoted 1 line · Julien Grall
As I already said multiple times before, please try to explain everything in your first e-mail...
I know. I'm trying to provide enough info in the cover letter. But it seems I do not succeed. Putting all the thoughts might lead into overburdened text. But it looks it should be done. Going to do that next time.
I realize my point is maybe misleading. Overburderned text is indeed not very great. Missing something in the cover letter is not entirely a big deal. Then the reviewers can ask question for clarification afterwards.
However, when I pointed out that arm32 was left from the text, you should have provided more details on why rather than just confirming you left it. Maybe I should have been clearer in my review and ask a proper question.
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
- Smth. similar or different might happen on x86 PV or HVM
Yet, all of them are out of design and are quite unexpected.
We *must* protect hypervisor against any guest behavior.
Totally agree.
Quoted 8 lines
Quoted 1 line
Particularly the unexpected one. If the Android VM hit itself, then I pretty much don't care assuming the VM was misbehaving. However, I don't think anyone would be happy if the Android VM is able to take down the whole platform. At least, I would not want to be the passenger of that car...
Neither do I.
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
You also saw a performance drop when using glmark2 benchmark.
Yes, I did see it with Roger's patch. But with mine - numbers are slightly better (~1%) for runstate being mapped. > Also introducing more races preventing code will introduce its impact.
Please provide the numbers once you fixed the race.
I'm laying my hands on the tracer now. Want to get numbers from it as wel.
Thank you for doing the benchmark.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel