* [PATCH 0/2] runstate_memory_area on ARM
@ 2013-05-01 19:32 Stefano Stabellini
2013-05-01 19:32 ` [PATCH 1/2] xen: move VCPUOP_register_runstate_memory_area to common code Stefano Stabellini
2013-05-01 19:32 ` [PATCH 2/2] xen/arm: handle the runstate_memory_area Stefano Stabellini
0 siblings, 2 replies; 9+ messages in thread
From: Stefano Stabellini @ 2013-05-01 19:32 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Campbell, Stefano Stabellini
Hi all,
this patch series introduces support for runstate_memory_area on ARM.
The first patch moves VCPUOP_register_runstate_memory_area to common
code, while the second one add VCPUOP_register_runstate_memory_area to
the whilelist of vcpu_op hypercalls supported on ARM and properly
updates the runstate_memory_area during vcpu context switch.
Stefano Stabellini (2):
xen: move VCPUOP_register_runstate_memory_area to common code
xen/arm: handle the runstate_memory_area
xen/arch/arm/domain.c | 22 ++++++++++++++++------
xen/arch/x86/domain.c | 28 ----------------------------
xen/common/domain.c | 28 ++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 34 deletions(-)
Cheers,
Stefano
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/2] xen: move VCPUOP_register_runstate_memory_area to common code 2013-05-01 19:32 [PATCH 0/2] runstate_memory_area on ARM Stefano Stabellini @ 2013-05-01 19:32 ` Stefano Stabellini 2013-05-02 8:05 ` Ian Campbell 2013-05-08 9:59 ` Ian Campbell 2013-05-01 19:32 ` [PATCH 2/2] xen/arm: handle the runstate_memory_area Stefano Stabellini 1 sibling, 2 replies; 9+ messages in thread From: Stefano Stabellini @ 2013-05-01 19:32 UTC (permalink / raw) To: xen-devel; +Cc: Ian.Campbell, Stefano Stabellini Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- xen/arch/x86/domain.c | 28 ---------------------------- xen/common/domain.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index d1b6c64..87dcb73 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -960,34 +960,6 @@ arch_do_vcpu_op( switch ( cmd ) { - case VCPUOP_register_runstate_memory_area: - { - struct vcpu_register_runstate_memory_area area; - struct vcpu_runstate_info runstate; - - rc = -EFAULT; - if ( copy_from_guest(&area, arg, 1) ) - break; - - if ( !guest_handle_okay(area.addr.h, 1) ) - break; - - rc = 0; - runstate_guest(v) = area.addr.h; - - if ( v == current ) - { - __copy_to_guest(runstate_guest(v), &v->runstate, 1); - } - else - { - vcpu_runstate_get(v, &runstate); - __copy_to_guest(runstate_guest(v), &runstate, 1); - } - - break; - } - /* * XXX Disable for 4.0.0: __update_vcpu_system_time() writes to the given * virtual address even when running in another domain's address space. diff --git a/xen/common/domain.c b/xen/common/domain.c index d21909f..0752dd2 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1126,6 +1126,34 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) break; } + case VCPUOP_register_runstate_memory_area: + { + struct vcpu_register_runstate_memory_area area; + struct vcpu_runstate_info runstate; + + rc = -EFAULT; + if ( copy_from_guest(&area, arg, 1) ) + break; + + if ( !guest_handle_okay(area.addr.h, 1) ) + break; + + rc = 0; + runstate_guest(v) = area.addr.h; + + if ( v == current ) + { + __copy_to_guest(runstate_guest(v), &v->runstate, 1); + } + else + { + vcpu_runstate_get(v, &runstate); + __copy_to_guest(runstate_guest(v), &runstate, 1); + } + + break; + } + #ifdef VCPU_TRAP_NMI case VCPUOP_send_nmi: if ( !guest_handle_is_null(arg) ) -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] xen: move VCPUOP_register_runstate_memory_area to common code 2013-05-01 19:32 ` [PATCH 1/2] xen: move VCPUOP_register_runstate_memory_area to common code Stefano Stabellini @ 2013-05-02 8:05 ` Ian Campbell 2013-05-02 8:27 ` Keir Fraser 2013-05-08 9:59 ` Ian Campbell 1 sibling, 1 reply; 9+ messages in thread From: Ian Campbell @ 2013-05-02 8:05 UTC (permalink / raw) To: Stefano Stabellini Cc: xen-devel@lists.xensource.com, Keir Fraser, Jan Beulich On Wed, 2013-05-01 at 20:32 +0100, Stefano Stabellini wrote: > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Needs x86 and/or core acks, but lacks suitable CCs. Added. > --- > xen/arch/x86/domain.c | 28 ---------------------------- > xen/common/domain.c | 28 ++++++++++++++++++++++++++++ > 2 files changed, 28 insertions(+), 28 deletions(-) > > diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c > index d1b6c64..87dcb73 100644 > --- a/xen/arch/x86/domain.c > +++ b/xen/arch/x86/domain.c > @@ -960,34 +960,6 @@ arch_do_vcpu_op( > > switch ( cmd ) > { > - case VCPUOP_register_runstate_memory_area: > - { > - struct vcpu_register_runstate_memory_area area; > - struct vcpu_runstate_info runstate; > - > - rc = -EFAULT; > - if ( copy_from_guest(&area, arg, 1) ) > - break; > - > - if ( !guest_handle_okay(area.addr.h, 1) ) > - break; > - > - rc = 0; > - runstate_guest(v) = area.addr.h; > - > - if ( v == current ) > - { > - __copy_to_guest(runstate_guest(v), &v->runstate, 1); > - } > - else > - { > - vcpu_runstate_get(v, &runstate); > - __copy_to_guest(runstate_guest(v), &runstate, 1); > - } > - > - break; > - } > - > /* > * XXX Disable for 4.0.0: __update_vcpu_system_time() writes to the given > * virtual address even when running in another domain's address space. > diff --git a/xen/common/domain.c b/xen/common/domain.c > index d21909f..0752dd2 100644 > --- a/xen/common/domain.c > +++ b/xen/common/domain.c > @@ -1126,6 +1126,34 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) > break; > } > > + case VCPUOP_register_runstate_memory_area: > + { > + struct vcpu_register_runstate_memory_area area; > + struct vcpu_runstate_info runstate; > + > + rc = -EFAULT; > + if ( copy_from_guest(&area, arg, 1) ) > + break; > + > + if ( !guest_handle_okay(area.addr.h, 1) ) > + break; > + > + rc = 0; > + runstate_guest(v) = area.addr.h; > + > + if ( v == current ) > + { > + __copy_to_guest(runstate_guest(v), &v->runstate, 1); > + } > + else > + { > + vcpu_runstate_get(v, &runstate); > + __copy_to_guest(runstate_guest(v), &runstate, 1); > + } > + > + break; > + } > + > #ifdef VCPU_TRAP_NMI > case VCPUOP_send_nmi: > if ( !guest_handle_is_null(arg) ) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] xen: move VCPUOP_register_runstate_memory_area to common code 2013-05-02 8:05 ` Ian Campbell @ 2013-05-02 8:27 ` Keir Fraser 0 siblings, 0 replies; 9+ messages in thread From: Keir Fraser @ 2013-05-02 8:27 UTC (permalink / raw) To: Ian Campbell, Stefano Stabellini Cc: xen-devel@lists.xensource.com, Keir Fraser, Jan Beulich On 02/05/2013 09:05, "Ian Campbell" <Ian.Campbell@citrix.com> wrote: > On Wed, 2013-05-01 at 20:32 +0100, Stefano Stabellini wrote: >> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > > Needs x86 and/or core acks, but lacks suitable CCs. Added. Acked-by: Keir Fraser <keir@xen.org> >> --- >> xen/arch/x86/domain.c | 28 ---------------------------- >> xen/common/domain.c | 28 ++++++++++++++++++++++++++++ >> 2 files changed, 28 insertions(+), 28 deletions(-) >> >> diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c >> index d1b6c64..87dcb73 100644 >> --- a/xen/arch/x86/domain.c >> +++ b/xen/arch/x86/domain.c >> @@ -960,34 +960,6 @@ arch_do_vcpu_op( >> >> switch ( cmd ) >> { >> - case VCPUOP_register_runstate_memory_area: >> - { >> - struct vcpu_register_runstate_memory_area area; >> - struct vcpu_runstate_info runstate; >> - >> - rc = -EFAULT; >> - if ( copy_from_guest(&area, arg, 1) ) >> - break; >> - >> - if ( !guest_handle_okay(area.addr.h, 1) ) >> - break; >> - >> - rc = 0; >> - runstate_guest(v) = area.addr.h; >> - >> - if ( v == current ) >> - { >> - __copy_to_guest(runstate_guest(v), &v->runstate, 1); >> - } >> - else >> - { >> - vcpu_runstate_get(v, &runstate); >> - __copy_to_guest(runstate_guest(v), &runstate, 1); >> - } >> - >> - break; >> - } >> - >> /* >> * XXX Disable for 4.0.0: __update_vcpu_system_time() writes to the >> given >> * virtual address even when running in another domain's address space. >> diff --git a/xen/common/domain.c b/xen/common/domain.c >> index d21909f..0752dd2 100644 >> --- a/xen/common/domain.c >> +++ b/xen/common/domain.c >> @@ -1126,6 +1126,34 @@ long do_vcpu_op(int cmd, int vcpuid, >> XEN_GUEST_HANDLE_PARAM(void) arg) >> break; >> } >> >> + case VCPUOP_register_runstate_memory_area: >> + { >> + struct vcpu_register_runstate_memory_area area; >> + struct vcpu_runstate_info runstate; >> + >> + rc = -EFAULT; >> + if ( copy_from_guest(&area, arg, 1) ) >> + break; >> + >> + if ( !guest_handle_okay(area.addr.h, 1) ) >> + break; >> + >> + rc = 0; >> + runstate_guest(v) = area.addr.h; >> + >> + if ( v == current ) >> + { >> + __copy_to_guest(runstate_guest(v), &v->runstate, 1); >> + } >> + else >> + { >> + vcpu_runstate_get(v, &runstate); >> + __copy_to_guest(runstate_guest(v), &runstate, 1); >> + } >> + >> + break; >> + } >> + >> #ifdef VCPU_TRAP_NMI >> case VCPUOP_send_nmi: >> if ( !guest_handle_is_null(arg) ) > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] xen: move VCPUOP_register_runstate_memory_area to common code 2013-05-01 19:32 ` [PATCH 1/2] xen: move VCPUOP_register_runstate_memory_area to common code Stefano Stabellini 2013-05-02 8:05 ` Ian Campbell @ 2013-05-08 9:59 ` Ian Campbell 2013-05-08 11:43 ` Stefano Stabellini 1 sibling, 1 reply; 9+ messages in thread From: Ian Campbell @ 2013-05-08 9:59 UTC (permalink / raw) To: Stefano Stabellini; +Cc: xen-devel@lists.xensource.com On Wed, 2013-05-01 at 20:32 +0100, Stefano Stabellini wrote: I got conflicts apply this. I didn't look to see if they related to the problems applying the ARM guest SMP series or if it was some other change to the underlying tree. > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > --- > xen/arch/x86/domain.c | 28 ---------------------------- > xen/common/domain.c | 28 ++++++++++++++++++++++++++++ > 2 files changed, 28 insertions(+), 28 deletions(-) > > diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c > index d1b6c64..87dcb73 100644 > --- a/xen/arch/x86/domain.c > +++ b/xen/arch/x86/domain.c > @@ -960,34 +960,6 @@ arch_do_vcpu_op( > > switch ( cmd ) > { > - case VCPUOP_register_runstate_memory_area: > - { > - struct vcpu_register_runstate_memory_area area; > - struct vcpu_runstate_info runstate; > - > - rc = -EFAULT; > - if ( copy_from_guest(&area, arg, 1) ) > - break; > - > - if ( !guest_handle_okay(area.addr.h, 1) ) > - break; > - > - rc = 0; > - runstate_guest(v) = area.addr.h; > - > - if ( v == current ) > - { > - __copy_to_guest(runstate_guest(v), &v->runstate, 1); > - } > - else > - { > - vcpu_runstate_get(v, &runstate); > - __copy_to_guest(runstate_guest(v), &runstate, 1); > - } > - > - break; > - } > - > /* > * XXX Disable for 4.0.0: __update_vcpu_system_time() writes to the given > * virtual address even when running in another domain's address space. > diff --git a/xen/common/domain.c b/xen/common/domain.c > index d21909f..0752dd2 100644 > --- a/xen/common/domain.c > +++ b/xen/common/domain.c > @@ -1126,6 +1126,34 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) > break; > } > > + case VCPUOP_register_runstate_memory_area: > + { > + struct vcpu_register_runstate_memory_area area; > + struct vcpu_runstate_info runstate; > + > + rc = -EFAULT; > + if ( copy_from_guest(&area, arg, 1) ) > + break; > + > + if ( !guest_handle_okay(area.addr.h, 1) ) > + break; > + > + rc = 0; > + runstate_guest(v) = area.addr.h; > + > + if ( v == current ) > + { > + __copy_to_guest(runstate_guest(v), &v->runstate, 1); > + } > + else > + { > + vcpu_runstate_get(v, &runstate); > + __copy_to_guest(runstate_guest(v), &runstate, 1); > + } > + > + break; > + } > + > #ifdef VCPU_TRAP_NMI > case VCPUOP_send_nmi: > if ( !guest_handle_is_null(arg) ) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] xen: move VCPUOP_register_runstate_memory_area to common code 2013-05-08 9:59 ` Ian Campbell @ 2013-05-08 11:43 ` Stefano Stabellini 2013-05-08 12:30 ` Ian Campbell 0 siblings, 1 reply; 9+ messages in thread From: Stefano Stabellini @ 2013-05-08 11:43 UTC (permalink / raw) To: Ian Campbell; +Cc: xen-devel@lists.xensource.com, Stefano Stabellini I guess it needs to be applied on top of the guest SMP patch series because I don't get any conflicts. Let me know if you are still having issues. On Wed, 8 May 2013, Ian Campbell wrote: > On Wed, 2013-05-01 at 20:32 +0100, Stefano Stabellini wrote: > > I got conflicts apply this. I didn't look to see if they related to the > problems applying the ARM guest SMP series or if it was some other > change to the underlying tree. > > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > > --- > > xen/arch/x86/domain.c | 28 ---------------------------- > > xen/common/domain.c | 28 ++++++++++++++++++++++++++++ > > 2 files changed, 28 insertions(+), 28 deletions(-) > > > > diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c > > index d1b6c64..87dcb73 100644 > > --- a/xen/arch/x86/domain.c > > +++ b/xen/arch/x86/domain.c > > @@ -960,34 +960,6 @@ arch_do_vcpu_op( > > > > switch ( cmd ) > > { > > - case VCPUOP_register_runstate_memory_area: > > - { > > - struct vcpu_register_runstate_memory_area area; > > - struct vcpu_runstate_info runstate; > > - > > - rc = -EFAULT; > > - if ( copy_from_guest(&area, arg, 1) ) > > - break; > > - > > - if ( !guest_handle_okay(area.addr.h, 1) ) > > - break; > > - > > - rc = 0; > > - runstate_guest(v) = area.addr.h; > > - > > - if ( v == current ) > > - { > > - __copy_to_guest(runstate_guest(v), &v->runstate, 1); > > - } > > - else > > - { > > - vcpu_runstate_get(v, &runstate); > > - __copy_to_guest(runstate_guest(v), &runstate, 1); > > - } > > - > > - break; > > - } > > - > > /* > > * XXX Disable for 4.0.0: __update_vcpu_system_time() writes to the given > > * virtual address even when running in another domain's address space. > > diff --git a/xen/common/domain.c b/xen/common/domain.c > > index d21909f..0752dd2 100644 > > --- a/xen/common/domain.c > > +++ b/xen/common/domain.c > > @@ -1126,6 +1126,34 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) > > break; > > } > > > > + case VCPUOP_register_runstate_memory_area: > > + { > > + struct vcpu_register_runstate_memory_area area; > > + struct vcpu_runstate_info runstate; > > + > > + rc = -EFAULT; > > + if ( copy_from_guest(&area, arg, 1) ) > > + break; > > + > > + if ( !guest_handle_okay(area.addr.h, 1) ) > > + break; > > + > > + rc = 0; > > + runstate_guest(v) = area.addr.h; > > + > > + if ( v == current ) > > + { > > + __copy_to_guest(runstate_guest(v), &v->runstate, 1); > > + } > > + else > > + { > > + vcpu_runstate_get(v, &runstate); > > + __copy_to_guest(runstate_guest(v), &runstate, 1); > > + } > > + > > + break; > > + } > > + > > #ifdef VCPU_TRAP_NMI > > case VCPUOP_send_nmi: > > if ( !guest_handle_is_null(arg) ) > > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] xen: move VCPUOP_register_runstate_memory_area to common code 2013-05-08 11:43 ` Stefano Stabellini @ 2013-05-08 12:30 ` Ian Campbell 0 siblings, 0 replies; 9+ messages in thread From: Ian Campbell @ 2013-05-08 12:30 UTC (permalink / raw) To: Stefano Stabellini; +Cc: xen-devel@lists.xensource.com On Wed, 2013-05-08 at 12:43 +0100, Stefano Stabellini wrote: > I guess it needs to be applied on top of the guest SMP patch series > because I don't get any conflicts. > Let me know if you are still having issues. It applied fine now that the SMP stuff is in. thanks. Ian. ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] xen/arm: handle the runstate_memory_area 2013-05-01 19:32 [PATCH 0/2] runstate_memory_area on ARM Stefano Stabellini 2013-05-01 19:32 ` [PATCH 1/2] xen: move VCPUOP_register_runstate_memory_area to common code Stefano Stabellini @ 2013-05-01 19:32 ` Stefano Stabellini 2013-05-02 8:07 ` Ian Campbell 1 sibling, 1 reply; 9+ messages in thread From: Stefano Stabellini @ 2013-05-01 19:32 UTC (permalink / raw) To: xen-devel; +Cc: Ian.Campbell, Stefano Stabellini Support VCPUOP_register_runstate_memory_area on ARM. Update_runstate_area on context switch. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- xen/arch/arm/domain.c | 22 ++++++++++++++++------ 1 files changed, 16 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 2d018cf..40bf963 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -22,6 +22,7 @@ #include <asm/current.h> #include <asm/event.h> +#include <asm/guest_access.h> #include <asm/regs.h> #include <asm/p2m.h> #include <asm/irq.h> @@ -212,16 +213,25 @@ static void ctxt_switch_to(struct vcpu *n) virt_timer_restore(n); } +/* Update per-VCPU guest runstate shared memory area (if registered). */ +static void update_runstate_area(struct vcpu *v) +{ + if ( guest_handle_is_null(runstate_guest(v)) ) + return; + + __copy_to_guest(runstate_guest(v), &v->runstate, 1); +} + static void schedule_tail(struct vcpu *prev) { ctxt_switch_from(prev); local_irq_enable(); - /* TODO - update_runstate_area(current); - */ ctxt_switch_to(current); + + if ( prev != current ) + update_runstate_area(current); } static void continue_new_vcpu(struct vcpu *prev) @@ -241,9 +251,8 @@ void context_switch(struct vcpu *prev, struct vcpu *next) ASSERT(prev != next); ASSERT(cpumask_empty(next->vcpu_dirty_cpumask)); - /* TODO - update_runstate_area(prev); - */ + if ( prev != next ) + update_runstate_area(prev); local_irq_disable(); @@ -636,6 +645,7 @@ long do_arm_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) switch ( cmd ) { case VCPUOP_register_vcpu_info: + case VCPUOP_register_runstate_memory_area: return do_vcpu_op(cmd, vcpuid, arg); default: return -EINVAL; -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] xen/arm: handle the runstate_memory_area 2013-05-01 19:32 ` [PATCH 2/2] xen/arm: handle the runstate_memory_area Stefano Stabellini @ 2013-05-02 8:07 ` Ian Campbell 0 siblings, 0 replies; 9+ messages in thread From: Ian Campbell @ 2013-05-02 8:07 UTC (permalink / raw) To: Stefano Stabellini; +Cc: xen-devel@lists.xensource.com On Wed, 2013-05-01 at 20:32 +0100, Stefano Stabellini wrote: > Support VCPUOP_register_runstate_memory_area on ARM. > Update_runstate_area on context switch. > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-05-08 12:30 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-05-01 19:32 [PATCH 0/2] runstate_memory_area on ARM Stefano Stabellini 2013-05-01 19:32 ` [PATCH 1/2] xen: move VCPUOP_register_runstate_memory_area to common code Stefano Stabellini 2013-05-02 8:05 ` Ian Campbell 2013-05-02 8:27 ` Keir Fraser 2013-05-08 9:59 ` Ian Campbell 2013-05-08 11:43 ` Stefano Stabellini 2013-05-08 12:30 ` Ian Campbell 2013-05-01 19:32 ` [PATCH 2/2] xen/arm: handle the runstate_memory_area Stefano Stabellini 2013-05-02 8:07 ` Ian Campbell
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.