Preliminary working version of live migration
v2 cover Preliminary working version of live migration
Hello all,
Me and my colleagues have finally made a working version of live migration in xen-on-arndale. Using this patch series, we can xl save/restore and xl migrate <domid> <ip> successfully.
I have to further test the stability and the performance, I would like to get some comments and reviews if anything may not nicely fit to the xen framework.
It is quite preliminary version, but I hope it could be a start for supporting live migration in xen on arm.
Best,
Jaeyong
Alexey Sokolov (2):
xen/arm: Implement get_maximum_gpfn hypercall for arm xen/arm: Implement modify_returncode
Alexey Sokolov, Elena Pyatunina, Evgeny Fedotov, and Nikolay Martyanov (1):
xen/arm: Implement toolstack for xl restore/save and migrate
Elena Pyatunina (2):
xen/arm: Add handling write fault for dirty-page tracing xen/arm: Implement hypercall for dirty page tracing (shadow op)
Jaeyong Yoo (3):
xen-arm: Implement basic save/load for hvm context xen/arm: Add more registers for saving and restoring vcpu
registers
xen/arm: Missing impl of clear_guest_offset macro
Jaeyong Yoo and Evgeny Fedotov (1):
xen/arm: Implement save and restore for gic, vtimer, and ptimer
config/arm32.mk | 1 + tools/include/xen-foreign/reference.size | 2 +- tools/libxc/Makefile | 5 + tools/libxc/xc_arm_migrate.c | 586 +++++++++++++++++++++++++++++++ tools/libxc/xc_resume.c | 25 ++ tools/misc/Makefile | 4 + xen/arch/arm/Makefile | 2 +- xen/arch/arm/domain.c | 38 ++ xen/arch/arm/domctl.c | 134 ++++++- xen/arch/arm/hvm.c | 67 ---- xen/arch/arm/hvm/Makefile | 2 + xen/arch/arm/hvm/hvm.c | 209 +++++++++++ xen/arch/arm/hvm/save.c | 66 ++++ xen/arch/arm/mm.c | 62 +++- xen/arch/arm/p2m.c | 368 +++++++++++++++++++ xen/arch/arm/traps.c | 7 + xen/common/Makefile | 2 + xen/include/asm-arm/domain.h | 8 + xen/include/asm-arm/guest_access.h | 6 +- xen/include/asm-arm/hvm/support.h | 29 ++ xen/include/asm-arm/mm.h | 2 + xen/include/asm-arm/p2m.h | 8 + xen/include/public/arch-arm.h | 41 +++ xen/include/public/arch-arm/hvm/save.h | 55 +++ 24 files changed, 1655 insertions(+), 74 deletions(-) create mode 100644 tools/libxc/xc_arm_migrate.c delete mode 100644 xen/arch/arm/hvm.c create mode 100644 xen/arch/arm/hvm/Makefile create mode 100644 xen/arch/arm/hvm/hvm.c create mode 100644 xen/arch/arm/hvm/save.c create mode 100644 xen/include/asm-arm/hvm/support.h
Signature · 1 line
1.8.1.2
RFC PATCH v2 1/9 xen-arm: Implement basic save/load for hvm context
Create a hvm directory for arm and move all the hvm related files to that directory.
--- xen/arch/arm/Makefile | 2 +- xen/arch/arm/hvm.c | 67 ---------------------------------- xen/arch/arm/hvm/Makefile | 2 + xen/arch/arm/hvm/hvm.c | 67 ++++++++++++++++++++++++++++++++++ xen/arch/arm/hvm/save.c | 66 +++++++++++++++++++++++++++++++++ xen/include/asm-arm/hvm/support.h | 29 +++++++++++++++ xen/include/public/arch-arm/hvm/save.h | 17 +++++++++ 7 files changed, 182 insertions(+), 68 deletions(-) delete mode 100644 xen/arch/arm/hvm.c create mode 100644 xen/arch/arm/hvm/Makefile create mode 100644 xen/arch/arm/hvm/hvm.c create mode 100644 xen/arch/arm/hvm/save.c create mode 100644 xen/include/asm-arm/hvm/support.h
xen/arch/arm/Makefile +1 -1
@@ -1,6 +1,7 @@ subdir-$(arm32) += arm32 subdir-$(arm64) += arm64 subdir-y += platforms +subdir-y += hvm obj-$(EARLY_PRINTK) += early_printk.o obj-y += cpu.o
@@ -28,7 +29,6 @@ obj-y += traps.o obj-y += vgic.o obj-y += vtimer.o obj-y += vpl011.o -obj-y += hvm.o obj-y += device.o #obj-bin-y += ....o
xen/arch/arm/hvm.c deleted +0 -67
67 lines not on this page · raw message
xen/arch/arm/hvm/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-y += hvm.o +obj-y += save.o
xen/arch/arm/hvm/hvm.c new file +67 -0
67 lines not on this page · raw message
xen/arch/arm/hvm/save.c new file +66 -0
66 lines not on this page · raw message
xen/include/asm-arm/hvm/support.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* support.h: HVM support routines used by ARMv7 VE. +* +* Copyright (c) 2013, Samsung Electronics +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program; if not, write to the Free Software Foundation, Inc., 59 Temple +* Place - Suite 330, Boston, MA 02111-1307 USA. +*/ + +#ifndef __ASM_ARM_HVM_SUPPORT_H__ +#define __ASM_ARM_HVM_SUPPORT_H__ + +#include <xen/types.h> +#include <public/hvm/ioreq.h> +#include <xen/sched.h> +#include <xen/hvm/save.h> +#include <asm/processor.h> + +#endif /* __ASM_ARM_HVM_SUPPORT_H__ */
xen/include/public/arch-arm/hvm/save.h +17 -0
@@ -26,6 +26,23 @@#ifndef __XEN_PUBLIC_HVM_SAVE_ARM_H__#define __XEN_PUBLIC_HVM_SAVE_ARM_H__ +/* +* Save/restore header: general info about the save file. +*/ + +#define HVM_FILE_MAGIC 0x92385520 +#define HVM_FILE_VERSION 0x00000001 + +struct hvm_save_header +{ +uint32_t magic;/* Must be HVM_FILE_MAGIC */ +uint32_t version;/* File format version */ +uint64_t changeset;/* Version of Xen that saved this file */ +uint32_t cpuid;/* MIDR_EL1 on the saving machine */ +}; + +DECLARE_HVM_SAVE_TYPE(HEADER, 1, struct hvm_save_header); +#endif /*
Signature · 1 line
1.8.1.2
Re: [PATCH RFC v2 1/9] xen-arm: Implement basic save/load for hvm context
Quoted 5 lines · Jaeyong Yoo
Create a hvm directory for arm and move all the hvm related files to that directory.
Signed-off-by Jaeyong Yoo <[email protected]>
Quoted 7 lines
xen/arch/arm/Makefile | 2 +- xen/arch/arm/hvm.c | 67 ---------------------------------- xen/arch/arm/hvm/Makefile | 2 + xen/arch/arm/hvm/hvm.c | 67 ++++++++++++++++++++++++++++++++++ xen/arch/arm/hvm/save.c | 66 +++++++++++++++++++++++++++++++++ xen/include/asm-arm/hvm/support.h | 29 +++++++++++++++ xen/include/public/arch-arm/hvm/save.h | 17 +++++++++
Does it have to be a subdirectory?
I don't think it makes much sense to separate out the hvm files on ARM.
Re: [PATCH RFC v2 1/9] xen-arm: Implement basic save/load for hvm context
Quoted 10 lines
-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: Wednesday, July 03, 2013 8:29 PM
To: Jaeyong Yoo
Cc: [email protected]
Subject: Re: [Xen-devel] [PATCH RFC v2 1/9] xen-arm: Implement basic save/load for hvm context
Quoted 8 lines
Quoted 7 lines · Jaeyong Yoo
Create a hvm directory for arm and move all the hvm related files to that directory.
Signed-off-by Jaeyong Yoo <[email protected]>xen/arch/arm/Makefile | 2 +- xen/arch/arm/hvm.c | 67
--------------------------------
Quoted 11 lines
--
Quoted 2 lines
xen/arch/arm/hvm/Makefile | 2 + xen/arch/arm/hvm/hvm.c | 67++++++++++++++++++++++++++++++++++
Quoted 1 line
xen/arch/arm/hvm/save.c | 66+++++++++++++++++++++++++++++++++
Quoted 2 lines
xen/include/asm-arm/hvm/support.h | 29 +++++++++++++++ xen/include/public/arch-arm/hvm/save.h | 17 +++++++++Does it have to be a subdirectory?
I don't think it makes much sense to separate out the hvm files on ARM.
Got it.
RFC PATCH v2 2/9 xen/arm: Implement save and restore for gic, vtimer, and ptimer
In reply to Jaeyong YooIn save/load of hvm context, add registers for gic, vtimer, and ptimer.
--- xen/arch/arm/domctl.c | 80 ++++++++++++++++++- xen/arch/arm/hvm/hvm.c | 142 +++++++++++++++++++++++++++++++++ xen/common/Makefile | 2 + xen/include/public/arch-arm/hvm/save.h | 38 +++++++++ 4 files changed, 261 insertions(+), 1 deletion(-)
xen/arch/arm/domctl.c +79 -1
@@ -9,12 +9,90 @@#include <xen/lib.h> #include <xen/errno.h> #include <xen/sched.h> +#include <xen/hvm/save.h> +#include <xen/guest_access.h> #include <public/domctl.h> long arch_do_domctl (struct xen_domctl *domctl,struct domain *d,XEN_GUEST_HANDLE_PARAM (xen_domctl_t) u_domctl) { -return -ENOSYS ; +long ret =0 ; +bool_t copyback =0 ; + +switch ( domctl->cmd ) + { +case XEN_DOMCTL_sethvmcontext: + { +struct hvm_domain_context c = { .size = domctl->u.hvmcontext.size }; + + ret = -ENOMEM ; +if ( (c.data =xmalloc_bytes (c.size)) ==NULL ) + goto sethvmcontext_out; + + ret = -EFAULT ; +if (copy_from_guest (c.data, domctl->u.hvmcontext.buffer, c.size) !=0 ) + goto sethvmcontext_out; + +domain_pause (d); + ret =hvm_load (d, &c); +domain_unpause (d); + + sethvmcontext_out: +if ( c.data !=NULL ) +xfree (c.data); + } +break ; +case XEN_DOMCTL_gethvmcontext: + { +struct hvm_domain_context c = {0 }; + + ret = -EINVAL ; + + c.size =hvm_save_size (d); + +if (guest_handle_is_null (domctl->u.hvmcontext.buffer) ) + { +/* Client is querying for the correct buffer size */ + domctl->u.hvmcontext.size = c.size; + ret =0 ; + goto gethvmcontext_out; + } + +/* Check that the client has a big enough buffer */ + ret = -ENOSPC ; +if ( domctl->u.hvmcontext.size < c.size ) + { +printk ("(gethvmcontext) size error: %d and %d\n" , + domctl->u.hvmcontext.size, c.size ); + goto gethvmcontext_out; + } + +domain_pause (d); + ret =hvm_save (d, &c); +domain_unpause (d); + + domctl->u.hvmcontext.size = c.cur; +if (copy_to_guest (domctl->u.hvmcontext.buffer, c.data, c.size) !=0 ) + { +printk ("(gethvmcontext) copy to guest failed\n" ); + ret = -EFAULT ; + } + + gethvmcontext_out: + copyback =1 ; + +if ( c.data !=NULL ) +xfree (c.data); + } +break ; +default : +return -EINVAL ; + } + +if ( copyback &&__copy_to_guest (u_domctl, domctl,1 ) ) + ret = -EFAULT ; + +return ret; }void arch_get_info_guest (struct vcpu *v,vcpu_guest_context_u c)
xen/arch/arm/hvm/hvm.c +142 -0
154 lines not on this page · raw message
xen/common/Makefile +2 -0
@@ -60,6 +60,8 @@ subdir-$(CONFIG_COMPAT) += compat subdir-$(x86_64) += hvm +subdir-$(CONFIG_ARM) += hvm + subdir-$(coverage) += gcov subdir-y += libelf
xen/include/public/arch-arm/hvm/save.h +38 -0
@@ -43,6 +43,44 @@ struct hvm_save_header DECLARE_HVM_SAVE_TYPE(HEADER, 1, struct hvm_save_header); +struct hvm_hw_gic +{ +uint32_t gic_hcr; +uint32_t gic_vmcr; +uint32_t gic_apr; +}; + +DECLARE_HVM_SAVE_TYPE(GIC, 3, struct hvm_hw_gic); + +struct hvm_hw_vtimer +{ +uint64_t vtb_offset; +uint64_t vtb_cval; + +uint32_t ctl; +uint64_t offset; +uint64_t cval; +}; + +DECLARE_HVM_SAVE_TYPE(VTIMER, 4, struct hvm_hw_vtimer); + +struct hvm_hw_ptimer +{ +uint64_t ptb_offset; +uint64_t ptb_cval; + +uint32_t p_ctl; +uint64_t p_offset; +uint64_t p_cval; +}; + +DECLARE_HVM_SAVE_TYPE(PTIMER, 5, struct hvm_hw_ptimer); + +/* +* Largest type-code in use +*/ +#define HVM_SAVE_CODE_MAX 19 +#endif /*
Signature · 1 line
1.8.1.2
Re: [PATCH RFC v2 2/9] xen/arm: Implement save and restore for gic, vtimer, and ptimer
Quoted 82 lines · Jaeyong Yoo
xen/arch/arm/hvm/hvm.c +82
-0+static int vtimer_save (struct domain *d,hvm_domain_context_t *h) +{ +struct hvm_hw_vtimer ctxt; +struct vcpu *v; + + ctxt.vtb_offset = d->arch.virt_timer_base.offset; + +/* Save the state of vtimer */ +for_each_vcpu ( d, v ) + { + ctxt.cval = v->arch.virt_timer.cval; + ctxt.ctl = v->arch.virt_timer.ctl; +if (hvm_save_entry (VTIMER , v->vcpu_id, h, &ctxt) !=0 ) +return 1 ; + } + +return 0 ; +} + +static int vtimer_load (struct domain *d,hvm_domain_context_t *h) +{ +int vcpuid; +struct hvm_hw_vtimer ctxt; +struct vcpu *v; +/* Which vcpu is this? */ + vcpuid =hvm_load_instance (h); +if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) ==NULL ) + { +dprintk (XENLOG_G_ERR ,"HVM restore: dom%u has no vcpu%u\n" , + d->domain_id, vcpuid); +return -EINVAL ; + } + +if (hvm_load_entry (VTIMER , h, &ctxt) !=0 ) +return -EINVAL ; + + v->arch.virt_timer.cval = ctxt.cval; + v->arch.virt_timer.ctl = ctxt.ctl; + v->arch.virt_timer.v = v; + + d->arch.virt_timer_base.offset = ctxt.vtb_offset; + +return 0 ; +} + +HVM_REGISTER_SAVE_RESTORE (VTIMER , vtimer_save, vtimer_load,1 ,HVMSR_PER_VCPU ); + +static int ptimer_save (struct domain *d,hvm_domain_context_t *h) +{ +struct hvm_hw_ptimer ctxt; +struct vcpu *v; + + ctxt.ptb_offset = d->arch.phys_timer_base.offset; + +/* Save the state of ptimer */ +for_each_vcpu ( d, v ) + { + ctxt.p_cval = v->arch.phys_timer.cval; + ctxt.p_ctl = v->arch.phys_timer.ctl; + +if (hvm_save_entry (PTIMER , v->vcpu_id, h, &ctxt) !=0 ) +return 1 ; + } + +return 0 ; +} + +static int ptimer_load (struct domain *d,hvm_domain_context_t *h) +{ +int vcpuid; +struct hvm_hw_ptimer ctxt; +struct vcpu *v; +/* Which vcpu is this? */ + vcpuid =hvm_load_instance (h); +if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) ==NULL ) + { +dprintk (XENLOG_G_ERR ,"HVM restore: dom%u has no vcpu%u\n" , + d->domain_id, vcpuid); +return -EINVAL ; + } + +if (hvm_load_entry (PTIMER , h, &ctxt) !=0 )
xen/arch/arm/hvm/hvm.c long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg) · line 207
Quoted 10 lines
xen/arch/arm/hvm/hvm.c +10
-0+return -EINVAL ; + + v->arch.phys_timer.cval = ctxt.p_cval; + v->arch.phys_timer.ctl = ctxt.p_ctl; + v->arch.phys_timer.v = v; + + d->arch.phys_timer_base.offset = ctxt.ptb_offset; + +return 0 ; +}
Given that the ptimer and vtimer save and load functions as well as the save records are identical, I think it might be better to declare a single timer record with a timer type and reuse the same load and save functions for both ptimer and vtimer.
Re: [PATCH RFC v2 2/9] xen/arm: Implement save and restore for gic, vtimer, and ptimer
Quoted 95 lines
-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: Wednesday, July 03, 2013 8:30 PM
To: Jaeyong Yoo
Cc: [email protected]
Subject: Re: [Xen-devel] [PATCH RFC v2 2/9] xen/arm: Implement save and restore for gic, vtimer, and ptimerQuoted 86 lines · Jaeyong Yoo
xen/arch/arm/hvm/hvm.c +86
-0+static int vtimer_save (struct domain *d,hvm_domain_context_t *h) { +struct hvm_hw_vtimer ctxt; +struct vcpu *v; + + ctxt.vtb_offset = d->arch.virt_timer_base.offset; + +/* Save the state of vtimer */ +for_each_vcpu ( d, v ) + { + ctxt.cval = v->arch.virt_timer.cval; + ctxt.ctl = v->arch.virt_timer.ctl; +if (hvm_save_entry (VTIMER , v->vcpu_id, h, &ctxt) !=0 ) +return 1 ; + } + +return 0 ; +} + +static int vtimer_load (struct domain *d,hvm_domain_context_t *h) { +int vcpuid; +struct hvm_hw_vtimer ctxt; +struct vcpu *v; +/* Which vcpu is this? */ + vcpuid =hvm_load_instance (h); +if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) ==NULL ) + { +dprintk (XENLOG_G_ERR ,"HVM restore: dom%u has no vcpu%u\n" , + d->domain_id, vcpuid); +return -EINVAL ; + } + +if (hvm_load_entry (VTIMER , h, &ctxt) !=0 ) +return -EINVAL ; + + v->arch.virt_timer.cval = ctxt.cval; + v->arch.virt_timer.ctl = ctxt.ctl; + v->arch.virt_timer.v = v; + + d->arch.virt_timer_base.offset = ctxt.vtb_offset; + +return 0 ; +} + +HVM_REGISTER_SAVE_RESTORE (VTIMER , vtimer_save, vtimer_load,1 , +HVMSR_PER_VCPU ); + +static int ptimer_save (struct domain *d,hvm_domain_context_t *h) { +struct hvm_hw_ptimer ctxt; +struct vcpu *v; + + ctxt.ptb_offset = d->arch.phys_timer_base.offset; + +/* Save the state of ptimer */ +for_each_vcpu ( d, v ) + { + ctxt.p_cval = v->arch.phys_timer.cval; + ctxt.p_ctl = v->arch.phys_timer.ctl; + +if (hvm_save_entry (PTIMER , v->vcpu_id, h, &ctxt) !=0 ) +return 1 ; + } + +return 0 ; +} + +static int ptimer_load (struct domain *d,hvm_domain_context_t *h) { +int vcpuid; +struct hvm_hw_ptimer ctxt; +struct vcpu *v; +/* Which vcpu is this? */ + vcpuid =hvm_load_instance (h); +if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) ==NULL ) + { +dprintk (XENLOG_G_ERR ,"HVM restore: dom%u has no vcpu%u\n" , + d->domain_id, vcpuid); +return -EINVAL ; + } + +if (hvm_load_entry (PTIMER , h, &ctxt) !=0 ) +return -EINVAL ; + + v->arch.phys_timer.cval = ctxt.p_cval; + v->arch.phys_timer.ctl = ctxt.p_ctl; + v->arch.phys_timer.v = v; + + d->arch.phys_timer_base.offset = ctxt.ptb_offset;
Quoted 8 lines
xen/arch/arm/hvm/hvm.c long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg) · line 87
Quoted 3 lines
xen/arch/arm/hvm/hvm.c +3
-0+ +return 0 ; +}Given that the ptimer and vtimer save and load functions as well as the save records are identical, I think it might be better to declare a single timer record with a timer type and reuse the same load and save functions for both ptimer and vtimer.
Got it.
RFC PATCH v2 3/9 xen/arm: Add more registers for saving and restoring vcpu registers
In reply to Jaeyong YooAdd more registers for saving and restoring vcpu registers for live migration. Those registers are selected from the registers stored when vcpu context switching.
--- xen/arch/arm/domain.c | 34 ++++++++++++++++++++++++++++++++++ xen/arch/arm/domctl.c | 35 +++++++++++++++++++++++++++++++++++ xen/include/public/arch-arm.h | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+)
xen/arch/arm/domain.c +34 -0
@@ -572,6 +572,40 @@ int arch_set_info_guest( v->arch.ttbr1 = ctxt->ttbr1; v->arch.ttbcr = ctxt->ttbcr; + v->arch.dacr = ctxt->dacr; + v->arch.ifar = ctxt->ifar; + v->arch.ifsr = ctxt->ifsr; + v->arch.dfar = ctxt->dfar; + v->arch.dfsr = ctxt->dfsr; + +#ifdef CONFIG_ARM_32 + v->arch.mair0 = ctxt->mair0; + v->arch.mair1 = ctxt->mair1; +#else + v->arch.mair = ctxt->mair; +#endif + +/* Control Registers */ + v->arch.actlr = ctxt->actlr; + v->arch.cpacr = ctxt->cpacr; + + v->arch.contextidr = ctxt->contextidr; + v->arch.tpidr_el0 = ctxt->tpidr_el0; + v->arch.tpidr_el1 = ctxt->tpidr_el1; + v->arch.tpidrro_el0 = ctxt->tpidrro_el0; + +/* CP 15 */ + v->arch.csselr = ctxt->csselr; + + v->arch.afsr0 = ctxt->afsr0; + v->arch.afsr1 = ctxt->afsr1; + v->arch.vbar = ctxt->vbar; + v->arch.par = ctxt->par; + v->arch.teecr = ctxt->teecr; + v->arch.teehbr = ctxt->teehbr; + v->arch.joscr = ctxt->joscr; + v->arch.jmcr = ctxt->jmcr; + v->is_initialised =1 ;if ( ctxt->flags & VGCF_online )
xen/arch/arm/domctl.c +35 -0
@@ -107,6 +107,41 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c) ctxt->ttbr1 = v->arch.ttbr1; ctxt->ttbcr = v->arch.ttbcr; + ctxt->dacr = v->arch.dacr; + ctxt->ifar = v->arch.ifar; + ctxt->ifsr = v->arch.ifsr; + ctxt->dfar = v->arch.dfar; + ctxt->dfsr = v->arch.dfsr; + +#ifdef CONFIG_ARM_32 + ctxt->mair0 = v->arch.mair0; + ctxt->mair1 = v->arch.mair1; +#else + ctxt->mair = v->arch.mair; +#endif + +/* Control Registers */ + ctxt->actlr = v->arch.actlr; + ctxt->sctlr = v->arch.sctlr; + ctxt->cpacr = v->arch.cpacr; + + ctxt->contextidr = v->arch.contextidr; + ctxt->tpidr_el0 = v->arch.tpidr_el0; + ctxt->tpidr_el1 = v->arch.tpidr_el1; + ctxt->tpidrro_el0 = v->arch.tpidrro_el0; + +/* CP 15 */ + ctxt->csselr = v->arch.csselr; + + ctxt->afsr0 = v->arch.afsr0; + ctxt->afsr1 = v->arch.afsr1; + ctxt->vbar = v->arch.vbar; + ctxt->par = v->arch.par; + ctxt->teecr = v->arch.teecr; + ctxt->teehbr = v->arch.teehbr; + ctxt->joscr = v->arch.joscr; + ctxt->jmcr = v->arch.jmcr; +if ( !test_bit (_VPF_down, &v->pause_flags) ) ctxt->flags |= VGCF_online; }
xen/include/public/arch-arm.h +35 -0
@@ -191,6 +191,41 @@ struct vcpu_guest_context {uint32_t sctlr, ttbcr;uint64_t ttbr0, ttbr1; +uint32_t ifar, dfar; +uint32_t ifsr, dfsr; +uint32_t dacr; +uint64_t par; + +#ifdef CONFIG_ARM_32 +uint32_t mair0, mair1; +uint32_t tpidr_el0; +uint32_t tpidr_el1; +uint32_t tpidrro_el0; +uint32_t vbar; +#else +uint64_t mair; +uint64_t tpidr_el0; +uint64_t tpidr_el1; +uint64_t tpidrro_el0; +uint64_t vbar; +#endif + +/* Control Registers */ +uint32_t actlr; +uint32_t cpacr; + +uint32_t afsr0, afsr1; + +uint32_t contextidr; + +uint32_t teecr, teehbr;/* ThumbEE, 32-bit guests only */ + +#ifdef CONFIG_ARM_32 +uint32_t joscr, jmcr; +#endif + +/* CP 15 */ +uint32_t csselr; };typedef struct vcpu_guest_context vcpu_guest_context_t ;DEFINE_XEN_GUEST_HANDLE (vcpu_guest_context_t);
Signature · 1 line
1.8.1.2
Re: [PATCH RFC v2 3/9] xen/arm: Add more registers for saving and restoring vcpu registers
Quoted 6 lines · Jaeyong Yoo
Add more registers for saving and restoring vcpu registers for live migration. Those registers are selected from the registers stored when vcpu context switching.
Signed-off-by Jaeyong Yoo <[email protected]>Singed-off-by Alexey Sokolov <[email protected]>
Looks OK
RFC PATCH v2 4/9 xen/arm: Implement get_maximum_gpfn hypercall for arm
In reply to Jaeyong YooFrom: Alexey Sokolov <[email protected]>
Since we do not know the maximum gpfn size for guest domain, we walk the page table of guest in order to see the maximum size of gpfn.
--- xen/arch/arm/mm.c | 3 +- xen/arch/arm/p2m.c | 69 +++++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/p2m.h | 3 ++ xen/include/public/arch-arm.h | 6 ++++ 4 files changed, 80 insertions(+), 1 deletion(-)
xen/arch/arm/mm.c +2 -1
@@ -762,7 +762,8 @@ int page_is_ram_type(unsigned long mfn, unsigned long mem_type)unsigned long domain_get_maximum_gpfn (struct domain *d) { -return -ENOSYS ; +xen_pfn_t result =p2m_get_next_non_used_gpfn (d,GUEST_RAM_BASE >>PAGE_SHIFT ); +return result; } void share_xen_page_with_guest(struct page_info *page,
xen/arch/arm/p2m.c +69 -0
75 lines not on this page · raw message
xen/include/asm-arm/p2m.h +3 -0
@@ -57,6 +57,9 @@ void guest_physmap_remove_page(struct domain *d,unsigned long gmfn_to_mfn (struct domain *d,unsigned long gpfn); +/* walk the guest page table to find out the next non-used gpfn */ +xen_pfn_t p2m_get_next_non_used_gpfn (struct domain *d,xen_pfn_t start); +/* * Populate-on-demand */
xen/include/public/arch-arm.h +6 -0
@@ -274,6 +274,12 @@ typedef uint64_t xen_callback_t;#define PSR_GUEST_INIT (PSR_ABT_MASK|PSR_FIQ_MASK|PSR_IRQ_MASK|PSR_MODE_SVC) +/* +* Guest virtual RAM starts here. This must be consistent with the DTB +* appended to the guest kernel. +*/ +#define GUEST_RAM_BASE 0x80000000 +#endif /* __XEN_PUBLIC_ARCH_ARM_H__ */ /*
Signature · 1 line
1.8.1.2
Re: [PATCH RFC v2 4/9] xen/arm: Implement get_maximum_gpfn hypercall for arm
Quoted 19 lines · Jaeyong Yoo
From: Alexey Sokolov <[email protected]>
Since we do not know the maximum gpfn size for guest domain, we walk the page table of guest in order to see the maximum size of gpfn.
Singed-off-by Alexey Sokolov <[email protected]>--- xen/arch/arm/mm.c | 3 +- xen/arch/arm/p2m.c | 69 +++++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/p2m.h | 3 ++ xen/include/public/arch-arm.h | 6 ++++ 4 files changed, 80 insertions(+), 1 deletion(-)xen/arch/arm/mm.c +0
-0
xen/arch/arm/mm.c int page_is_ram_type(unsigned long mfn, unsigned long mem_type) · line 767
Quoted 7 lines
xen/arch/arm/mm.c +2
-1@@ -762,7 +762,8 @@ int page_is_ram_type(unsigned long mfn, unsigned long mem_type)unsigned long domain_get_maximum_gpfn (struct domain *d) { -return -ENOSYS ; +xen_pfn_t result =p2m_get_next_non_used_gpfn (d,GUEST_RAM_BASE >>PAGE_SHIFT ); +return result; }
Rather than implementing p2m_get_next_non_used_gpfn, I think we should keep track of the maximum gpfn, like we do on x86, see:
xen/arch/x86/mm.c:domain_get_maximum_gpfn
Re: [PATCH RFC v2 4/9] xen/arm: Implement get_maximum_gpfn hypercall for arm
Quoted 21 lines · Stefano Stabellini
Quoted 20 lines · Jaeyong Yoo
From: Alexey Sokolov <[email protected]>
Since we do not know the maximum gpfn size for guest domain, we walk the page table of guest in order to see the maximum size of gpfn.
Singed-off-by Alexey Sokolov <[email protected]>--- xen/arch/arm/mm.c | 3 +- xen/arch/arm/p2m.c | 69 +++++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/p2m.h | 3 ++ xen/include/public/arch-arm.h | 6 ++++ 4 files changed, 80 insertions(+), 1 deletion(-)xen/arch/arm/mm.c +0
-0@@ -762,7 +762,8 @@ int page_is_ram_type(unsigned long mfn, unsigned long mem_type)
Quoted 9 lines
xen/arch/arm/mm.c int page_is_ram_type(unsigned long mfn, unsigned long mem_type) · line 767
Quoted 6 lines
xen/arch/arm/mm.c +2
-1unsigned long domain_get_maximum_gpfn (struct domain *d) { -return -ENOSYS ; +xen_pfn_t result =p2m_get_next_non_used_gpfn (d,GUEST_RAM_BASE >>PAGE_SHIFT ); +return result; }Rather than implementing
p2m_get_next_non_used_gpfn, I think we should keep track of the maximum gpfn, like we do on x86, see:
ISTR Tim wanting to get rid of this concept on x86.
Anything which is walking the P2M should be doing so via iterator based interfaces and not by looping on O...N where N is potentially guest controlled. Not to mention 0...N might be quite sparse.
Ian.
Re: [PATCH RFC v2 4/9] xen/arm: Implement get_maximum_gpfn hypercall for arm
Quoted 10 lines
Quoted 3 lines
Rather than implementing
p2m_get_next_non_used_gpfn, I think we should keep track of the maximum gpfn, like we do on x86, see:ISTR Tim wanting to get rid of this concept on x86.
Anything which is walking the P2M should be doing so via iterator based interfaces and not by looping on O...N where N is potentially guest controlled. Not to mention 0...N might be quite sparse.
I guess we are now going to implment via iterator?
Jaeyong
Re: [PATCH RFC v2 4/9] xen/arm: Implement get_maximum_gpfn hypercall for arm
Quoted 4 lines · Jaeyong Yoo
Quoted 4 lines
Quoted 3 lines
Rather than implementing
p2m_get_next_non_used_gpfn, I think we should keep track of the maximum gpfn, like we do on x86, see:
Quoted 8 lines
Quoted 6 lines
ISTR Tim wanting to get rid of this concept on x86.
Anything which is walking the P2M should be doing so via iterator based interfaces and not by looping on O...N where N is potentially guest controlled. Not to mention 0...N might be quite sparse.
I guess we are now going to implment via iterator?
I think we should, Tim may have some ideas about what such an interface should look like.
RFC PATCH v2 5/9 xen/arm: Implement modify_returncode
In reply to Jaeyong YooFrom: Alexey Sokolov <[email protected]>
Making sched_op in do_suspend (driver/xen/manage.c) returns 0 on the success of suspend.
--- tools/include/xen-foreign/reference.size | 2 +- tools/libxc/xc_resume.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-)
tools/include/xen-foreign/reference.size +1 -1
@@ -5,7 +5,7 @@ start_info | - - 1112 1168 trap_info | - - 8 16 cpu_user_regs | - - 68 200 vcpu_guest_core_regs | 304 304 - - -vcpu_guest_context | 336 336 2800 5168 +vcpu_guest_context | 440 440 2800 5168 arch_vcpu_info | - - 24 16 vcpu_time_info | - - 32 32 vcpu_info | - - 64 64
tools/libxc/xc_resume.c +25 -0
@@ -87,6 +87,31 @@ static int modify_returncode(xc_interface *xch, uint32_t domid) return 0; } +#elif defined(__arm__) + +static int modify_returncode (xc_interface *xch,uint32_t domid) +{ +vcpu_guest_context_any_t ctxt; +xc_dominfo_t info; +int rc; + +if (xc_domain_getinfo (xch, domid,1 , &info) !=1 ) + { +PERROR ("Could not get domain info" ); +return -1 ; + } + +if ( (rc =xc_vcpu_getcontext (xch, domid,0 , &ctxt)) !=0 ) +return rc; + + ctxt.c.user_regs.r0_usr =1 ; + +if ( (rc =xc_vcpu_setcontext (xch, domid,0 , &ctxt)) !=0 ) +return rc; + +return 0 ; +} +#else static int modify_returncode (xc_interface *xch,uint32_t domid)
Signature · 1 line
1.8.1.2
RFC PATCH v2 6/9 xen/arm: Add handling write fault for dirty-page tracing
In reply to Jaeyong YooFrom: Elena Pyatunina <[email protected]>
Add handling write fault in do_trap_data_abort_guest for dirty-page tracing. Mark dirty function makes the bitmap of dirty pages.
--- xen/arch/arm/mm.c | 59 ++++++++++++++++++++++++++++++- xen/arch/arm/p2m.c | 84 ++++++++++++++++++++++++++++++++++++++++++++ xen/arch/arm/traps.c | 7 ++++ xen/include/asm-arm/domain.h | 8 +++++ xen/include/asm-arm/mm.h | 2 ++ xen/include/asm-arm/p2m.h | 3 ++ 6 files changed, 162 insertions(+), 1 deletion(-)
xen/arch/arm/mm.c +58 -1
@@ -680,7 +680,6 @@ void destroy_xen_mappings(unsigned long v, unsigned long e)create_xen_entries (REMOVE , v,0 , (e - v) >>PAGE_SHIFT ,0 ); } -enum mg { mg_clear, mg_ro, mg_rw, mg_rx };static void set_pte_flags_on_range (const char *p,unsigned long l,enum mg mg) {lpae_t pte;
@@ -1142,6 +1141,64 @@ int is_iomem_page(unsigned long mfn)return 1 ;return 0 ; } + +/* +* Set l3e entries of P2M table to be read-only. +* +* On first write, it page faults, its entry is changed to read-write, +* and on retry the write succeeds. +* +* Populate dirty_bitmap by looking for entries that have been +* switched to read-write. +*/ +int handle_page_fault (struct domain *d,paddr_t addr) +{ +lpae_t pte, *first =NULL , *second =NULL , *third =NULL ; +struct p2m_domain *p2m = &d->arch.p2m; + +if ( d->arch.dirty.mode ==0 ||first_table_offset (addr) >=LPAE_ENTRIES ) +return 1 ; + +spin_lock (&p2m->lock); + + first =__map_domain_page (p2m->first_level); + +if ( !first || + !first[first_table_offset (addr)].walk.valid || + !first[first_table_offset (addr)].walk.table ) + goto done; + + second =map_domain_page (first[first_table_offset (addr)].walk.base); + +if ( !second || + !second[second_table_offset (addr)].walk.valid || + !second[second_table_offset (addr)].walk.table ) + goto done; + + third =map_domain_page (second[second_table_offset (addr)].walk.base); + +if ( !third ) + goto done; + + pte = third[third_table_offset (addr)]; + +if (pte.p2m.valid && pte.p2m.write ==0 ) + { +mark_dirty (d, addr); + pte.p2m.write =1 ; +write_pte (&third[third_table_offset (addr)], pte); +flush_tlb_local (); + } + +done: +if (third)unmap_domain_page (third); +if (second)unmap_domain_page (second); +if (first)unmap_domain_page (first); + +spin_unlock (&p2m->lock); +return 0 ; +} +/* * Local variables: * mode: C
xen/arch/arm/p2m.c +84 -0
90 lines not on this page · raw message
xen/arch/arm/traps.c +7 -0
@@ -1011,6 +1011,13 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs,if ( rc == -EFAULT ) goto bad_data_abort; +/* handle permission fault on write */ +if ((dabt.dfsc &0x3f ) == (FSC_FLT_PERM +3 ) && dabt.write) + { +if (handle_page_fault (current->domain, info.gpa) ==0 ) +return ; + } +if (handle_mmio (&info)) { regs->pc += dabt.len ?4 :2 ;
xen/include/asm-arm/domain.h +8 -0
@@ -107,6 +107,14 @@ struct arch_domainspinlock_t lock; } uart0; +struct { +spinlock_t lock; +int mode; +unsigned int count; +struct page_info *top; +struct page_list_head pages; + } dirty; + } __cacheline_aligned;struct arch_vcpu
xen/include/asm-arm/mm.h +2 -0
@@ -327,6 +327,8 @@ static inline void put_page_and_type(struct page_info *page) put_page(page); } +int handle_page_fault (struct domain *d,paddr_t addr); +#endif /* __ARCH_ARM_MM__ */ /* * Local variables:
xen/include/asm-arm/p2m.h +3 -0
@@ -110,6 +110,9 @@ static inline int get_page_and_type(struct page_info *page, return rc; } +enum mg { mg_clear, mg_ro, mg_rw, mg_rx }; +void mark_dirty (struct domain *d,paddr_t addr); +#endif /* _XEN_P2M_H */ /*
Signature · 1 line
1.8.1.2
Re: [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracing
Quoted 39 lines · Jaeyong Yoo
From: Elena Pyatunina <[email protected]>
Add handling write fault in
do_trap_data_abort_guestfor dirty-page tracing. Mark dirty function makes the bitmap of dirty pages.Signed-off-by Elena Pyatunina <[email protected]>Singed-off-by Jaeyong Yoo <[email protected]>--- xen/arch/arm/mm.c | 59 ++++++++++++++++++++++++++++++- xen/arch/arm/p2m.c | 84 ++++++++++++++++++++++++++++++++++++++++++++ xen/arch/arm/traps.c | 7 ++++ xen/include/asm-arm/domain.h | 8 +++++ xen/include/asm-arm/mm.h | 2 ++ xen/include/asm-arm/p2m.h | 3 ++ 6 files changed, 162 insertions(+), 1 deletion(-)xen/arch/arm/mm.c +7
-1@@ -680,7 +680,6 @@ void destroy_xen_mappings(unsigned long v, unsigned long e)create_xen_entries (REMOVE , v,0 , (e - v) >>PAGE_SHIFT ,0 ); } -enum mg { mg_clear, mg_ro, mg_rw, mg_rx };static void set_pte_flags_on_range (const char *p,unsigned long l,enum mg mg) {lpae_t pte;@@ -1142,6 +1141,64 @@ int is_iomem_page(unsigned long mfn)return 1 ;return 0 ; } + +/* +* Set l3e entries of P2M table to be read-only. +* +* On first write, it page faults, its entry is changed to read-write, +* and on retry the write succeeds. +*
xen/arch/arm/mm.c int is_iomem_page(unsigned long mfn) · line 1160
Quoted 10 lines
xen/arch/arm/mm.c +10
-0+* Populate dirty_bitmap by looking for entries that have been +* switched to read-write. +*/ +int handle_page_fault (struct domain *d,paddr_t addr) +{ +lpae_t pte, *first =NULL , *second =NULL , *third =NULL ; +struct p2m_domain *p2m = &d->arch.p2m; + +if ( d->arch.dirty.mode ==0 ||first_table_offset (addr) >=LPAE_ENTRIES ) +return 1 ;
if this is an error condition, it would be better to return an error
Quoted 17 lines
xen/arch/arm/mm.c +17
-0+spin_lock (&p2m->lock); + + first =__map_domain_page (p2m->first_level); + +if ( !first || + !first[first_table_offset (addr)].walk.valid || + !first[first_table_offset (addr)].walk.table ) + goto done; + + second =map_domain_page (first[first_table_offset (addr)].walk.base); + +if ( !second || + !second[second_table_offset (addr)].walk.valid || + !second[second_table_offset (addr)].walk.table ) + goto done; + + third =map_domain_page (second[second_table_offset (addr)].walk.base);
xen/arch/arm/mm.c int is_iomem_page(unsigned long mfn) · line 1188
Quoted 10 lines
xen/arch/arm/mm.c +10
-0+ +if ( !third ) + goto done; + + pte = third[third_table_offset (addr)]; + +if (pte.p2m.valid && pte.p2m.write ==0 ) + { +mark_dirty (d, addr); + pte.p2m.write =1 ;
Would this bit be sufficient? Otherwise could we take one of the other available bits in the p2m pte? That would free us from having to handle a separate data structure to handle dirty bits.
xen/arch/arm/mm.c int is_iomem_page(unsigned long mfn) · line 1190
Quoted 2 lines
xen/arch/arm/mm.c +2
-0+write_pte (&third[third_table_offset (addr)], pte); +flush_tlb_local ();
flush_tlb_local should be OK because I think that we can always guarantee that the current VMID is the VMID of the guest we are handling the fault for.
Quoted 46 lines
xen/arch/arm/mm.c +11
-0+ } + +done: +if (third)unmap_domain_page (third); +if (second)unmap_domain_page (second); +if (first)unmap_domain_page (first); + +spin_unlock (&p2m->lock); +return 0 ; +} +/* * Local variables: * mode: C xen/arch/arm/p2m.c +24
-0@@ -412,6 +412,90 @@ unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn)return p >>PAGE_SHIFT ; } +static struct page_info *new_dirty_page (void ) +{ +struct page_info *page =NULL ; +void *p; + + page =alloc_domheap_page (NULL ,0 ); +if ( page ==NULL ) +return NULL ; + + p =__map_domain_page (page); + +clear_page (p); +unmap_domain_page (p); + +return page; +} + +void mark_dirty (struct domain *d,paddr_t addr) +{ +struct page_info *page; +xen_pfn_t *first =NULL , *second =NULL , *third =NULL ; +void *p; +int changed; +
xen/arch/arm/p2m.c unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn) · line 448
Quoted 10 lines
xen/arch/arm/p2m.c +10
-0+spin_lock (&d->arch.dirty.lock); + +if (d->arch.dirty.top ==NULL ) + { + page =alloc_domheap_pages (NULL ,1 ,0 ); +if (page ==NULL ) + { +printk ("Error: couldn't allocate page for dirty bitmap!\n" ); +spin_unlock (&d->arch.dirty.lock); +return ;
no error return codes?
Quoted 31 lines
xen/arch/arm/p2m.c +29
-0+ } + +INIT_PAGE_LIST_HEAD (&d->arch.dirty.pages); +page_list_add (page, &d->arch.dirty.pages); + +/* Clear both first level pages */ + p =__map_domain_page (page); +clear_page (p); +unmap_domain_page (p); + + p =__map_domain_page (page +1 ); +clear_page (p); +unmap_domain_page (p); + + d->arch.dirty.top = page; + } + + first =__map_domain_page (d->arch.dirty.top); +BUG_ON (!first &&"Can't map first level p2m." ); +if ( !first[first_table_offset (addr)]) + { + page =new_dirty_page (); +page_list_add (page, &d->arch.dirty.pages); + first[first_table_offset (addr)] =page_to_mfn (page); + } + + second =map_domain_page (first[first_table_offset (addr)]); +BUG_ON (!second &&"Can't map second level p2m." ); +if (!second[second_table_offset (addr)])
xen/arch/arm/p2m.c unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn) · line 486
Quoted 10 lines
xen/arch/arm/p2m.c +9
-0+ { + page =new_dirty_page (); +page_list_add (page, &d->arch.dirty.pages); + second[second_table_offset (addr)] =page_to_mfn (page); + } + + third =map_domain_page (second[second_table_offset (addr)]); +BUG_ON (!third &&"Can't map third level p2m." ); + changed = !__test_and_set_bit (third_table_offset (addr), third);
If I am not missing something, the third_table_offset was written to give you an index into a page to retrieve a 64 bit pte.
If you are only using 1 bit, shouldn't you be using a different indexing system? Otherwise you are wasting 63 bits for each entry.
xen/arch/arm/p2m.c unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn) · line 487
Quoted 1 line
xen/arch/arm/p2m.c +1
-0+if (changed)
^ code style
Quoted 14 lines
xen/arch/arm/p2m.c +11
-0+ { + d->arch.dirty.count++; + } + +if (third)unmap_domain_page (third); +if (second)unmap_domain_page (second); +if (first)unmap_domain_page (first); + +spin_unlock (&d->arch.dirty.lock); +} +/*
* Local variables:
* mode: C
Re: [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracing
Quoted 60 lines
-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: Wednesday, July 03, 2013 9:11 PM
To: Jaeyong Yoo
Cc: [email protected]; Elena Pyatunina
Subject: Re: [Xen-devel] [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracingQuoted 10 lines · Jaeyong Yoo
From: Elena Pyatunina <[email protected]>
Add handling write fault in
do_trap_data_abort_guestfor dirty-page tracing. Mark dirty function makes the bitmap of dirty pages.Signed-off-by Elena Pyatunina <[email protected]>Singed-off-by Jaeyong Yoo <[email protected]>--- xen/arch/arm/mm.c | 59 ++++++++++++++++++++++++++++++- xen/arch/arm/p2m.c | 84++++++++++++++++++++++++++++++++++++++++++++
xen/arch/arm/mm.c void destroy_xen_mappings(unsigned long v, unsigned
Quoted 11 lines
xen/arch/arm/traps.c | 7 ++++ xen/include/asm-arm/domain.h | 8 +++++ xen/include/asm-arm/mm.h | 2 ++ xen/include/asm-arm/p2m.h | 3 ++ 6 files changed, 162 insertions(+), 1 deletion(-)xen/arch/arm/mm.c index renamed from xen/arch/arm/mm.c +0
-0650b1fc..f509008 100644
xen/arch/arm/mm.c +0
-0@@ -680,7 +680,6 @@ void destroy_xen_mappings(unsigned long v, unsignedlong e)
Quoted 15 lines
xen/arch/arm/mm.c +6
-1create_xen_entries (REMOVE , v,0 , (e - v) >>PAGE_SHIFT ,0 ); } -enum mg { mg_clear, mg_ro, mg_rw, mg_rx };static void set_pte_flags_on_range(const char *p, unsigned long l, enum mg mg) { lpae_t pte;@@ -1142,6 +1141,64 @@ int is_iomem_page(unsigned long mfn)return 1 ;return 0 ; } + +/* +* Set l3e entries of P2M table to be read-only. +* +* On first write, it page faults, its entry is changed to +read-write, xen/arch/arm/mm.c int is_iomem_page(unsigned long mfn) · line 1159
Quoted 10 lines
xen/arch/arm/mm.c +10
-0+* and on retry the write succeeds. +* +* Populate dirty_bitmap by looking for entries that have been +* switched to read-write. +*/ +int handle_page_fault(struct domain *d, paddr_t addr) { + lpae_t pte, *first = NULL, *second = NULL, *third = NULL; + struct p2m_domain *p2m = &d->arch.p2m; + + if ( d->arch.dirty.mode == 0 || first_table_offset(addr) >=
LPAE_ENTRIES)
Quoted 3 lines
xen/arch/arm/mm.c int is_iomem_page(unsigned long mfn) · line 1160
Quoted 1 line
xen/arch/arm/mm.c +1
-0+return 1 ;if this is an error condition, it would be better to return an error
The first condition is not an error and the second one is. And, I got the idea.
Quoted 27 lines
Quoted 27 lines
xen/arch/arm/mm.c +25
-0+spin_lock (&p2m->lock); + + first =__map_domain_page (p2m->first_level); + +if ( !first || + !first[first_table_offset (addr)].walk.valid || + !first[first_table_offset (addr)].walk.table ) + goto done; + + second = +map_domain_page (first[first_table_offset (addr)].walk.base); + +if ( !second || + !second[second_table_offset (addr)].walk.valid || + !second[second_table_offset (addr)].walk.table ) + goto done; + + third = +map_domain_page (second[second_table_offset (addr)].walk.base); + +if ( !third ) + goto done; + + pte = third[third_table_offset (addr)]; +
Quoted 8 lines
xen/arch/arm/mm.c int is_iomem_page(unsigned long mfn) · line 1188
Quoted 4 lines
xen/arch/arm/mm.c +4
-0+if (pte.p2m.valid && pte.p2m.write ==0 ) + { +mark_dirty (d, addr); + pte.p2m.write =1 ;Would this bit be sufficient? Otherwise could we take one of the other available bits in the p2m pte? That would free us from having to handle a separate data structure to handle dirty bits.
I think it would fix the memory inefficiency problem. But, I would like to follow the way Ian suggested, making a linear dirty-bit map for guest p2m. I think it can increase the write fault handling performance and also peeking
performance.
Quoted 8 lines
xen/arch/arm/mm.c int is_iomem_page(unsigned long mfn) · line 1190
Quoted 4 lines
xen/arch/arm/mm.c +2
-0+write_pte (&third[third_table_offset (addr)], pte); +flush_tlb_local ();
flush_tlb_localshould be OK because I think that we can always guarantee that the current VMID is the VMID of the guest we are handling the fault for.
Got it.
Quoted 47 lines
xen/arch/arm/p2m.c unsigned long gmfn_to_mfn(struct domain *d,
Quoted 21 lines
xen/arch/arm/mm.c +11
-0+ } + +done: +if (third)unmap_domain_page (third); +if (second)unmap_domain_page (second); +if (first)unmap_domain_page (first); + +spin_unlock (&p2m->lock); +return 0 ; +} +/* * Local variables: * mode: C xen/arch/arm/p2m.c index renamed from xen/arch/arm/p2m.c +0
-08bf7eb7..bae7af7 100644
xen/arch/arm/p2m.c +0
-0@@ -412,6 +412,90 @@ unsigned long gmfn_to_mfn(struct domain *d,unsigned long gpfn)
Quoted 25 lines
xen/arch/arm/p2m.c +22
-0return p >>PAGE_SHIFT ; } +static struct page_info *new_dirty_page (void ) { +struct page_info *page =NULL ; +void *p; + + page =alloc_domheap_page (NULL ,0 ); +if ( page ==NULL ) +return NULL ; + + p =__map_domain_page (page); + +clear_page (p); +unmap_domain_page (p); + +return page; +} + +void mark_dirty (struct domain *d,paddr_t addr) { +struct page_info *page; +xen_pfn_t *first =NULL , *second =NULL , *third =NULL ; +void *p; +int changed; +
Quoted 8 lines
xen/arch/arm/p2m.c unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn)
Quoted 8 lines
xen/arch/arm/p2m.c +8
-0+spin_lock (&d->arch.dirty.lock); + +if (d->arch.dirty.top ==NULL ) + { + page =alloc_domheap_pages (NULL ,1 ,0 ); +if (page ==NULL ) + { + printk("Error: couldn't allocate page for dirty
bitmap!\n");
Quoted 4 lines
xen/arch/arm/p2m.c unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn) · line 448
Quoted 2 lines
xen/arch/arm/p2m.c +2
-0+spin_unlock (&d->arch.dirty.lock); +return ;no error return codes?
Got it.
Quoted 42 lines
Quoted 42 lines
xen/arch/arm/p2m.c +37
-0+ } + +INIT_PAGE_LIST_HEAD (&d->arch.dirty.pages); +page_list_add (page, &d->arch.dirty.pages); + +/* Clear both first level pages */ + p =__map_domain_page (page); +clear_page (p); +unmap_domain_page (p); + + p =__map_domain_page (page +1 ); +clear_page (p); +unmap_domain_page (p); + + d->arch.dirty.top = page; + } + + first =__map_domain_page (d->arch.dirty.top); +BUG_ON (!first &&"Can't map first level p2m." ); +if ( !first[first_table_offset (addr)]) + { + page =new_dirty_page (); +page_list_add (page, &d->arch.dirty.pages); + first[first_table_offset (addr)] =page_to_mfn (page); + } + + second =map_domain_page (first[first_table_offset (addr)]); +BUG_ON (!second &&"Can't map second level p2m." ); +if (!second[second_table_offset (addr)]) + { + page =new_dirty_page (); +page_list_add (page, &d->arch.dirty.pages); + second[second_table_offset (addr)] =page_to_mfn (page); + } + + third =map_domain_page (second[second_table_offset (addr)]); +BUG_ON (!third &&"Can't map third level p2m." );
Quoted 6 lines
xen/arch/arm/p2m.c unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn) · line 486
Quoted 1 line
xen/arch/arm/p2m.c +1
-0+ changed = !__test_and_set_bit (third_table_offset (addr), third);If I am not missing something, the
third_table_offsetwas written to give you an index into a page to retrieve a 64 bit pte.
If you are only using 1 bit, shouldn't you be using a different indexing system? Otherwise you are wasting 63 bits for each entry.
You got this right. It is also memory inefficient.
Quoted 4 lines
xen/arch/arm/p2m.c unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn) · line 487
Quoted 3 lines
xen/arch/arm/p2m.c +1
-0+if (changed)^ code style
Oops!
Quoted 14 lines
Quoted 14 lines
xen/arch/arm/p2m.c +10
-0+ { + d->arch.dirty.count++; + } + +if (third)unmap_domain_page (third); +if (second)unmap_domain_page (second); +if (first)unmap_domain_page (first); + +spin_unlock (&d->arch.dirty.lock); } +/* * Local variables: * mode: C
Re: [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracing
In reply to Jaeyong YooQuoted 4 lines · Jaeyong Yoo
From: Elena Pyatunina <[email protected]>
Add handling write fault in
do_trap_data_abort_guestfor dirty-page tracing. Mark dirty function makes the bitmap of dirty pages.
You've gone with the model of allocating a bitmap when logdirty is enabled and updating it directly from the fault handler? The bit map is based around a three level structure mirroring the p2m tables?
I had been considering the option of reusing one of the bits available for software use in the p2m entries to track the dirty status and walking the p2m when the toolstack asked for the current bitmap instead.
I think this would have less memory overhead and also would allow us to be lock free on the fault handling path (by using suitable atomic exchanges on the p2m entries), as well as avoiding memory allocations on that path.
I think we'd want to establish a linear map of the current guest p2m for these purposes so we could also avoid all the map_domain_page stuff in the fault path. I think there is enough virtual address space left for that even on 32-bit, it's less critical on 64-bit anyway since we are about to have a direct map of RAM available to us.
xen/arch/arm/traps.c static void do_trap_data_abort_guest(struct cpu_user_regs *regs, · line 1015
Quoted 10 lines
xen/arch/arm/traps.c +2
-0@@ -1011,6 +1011,13 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs,if ( rc == -EFAULT ) goto bad_data_abort; +/* handle permission fault on write */ +if ((dabt.dfsc &0x3f ) == (FSC_FLT_PERM +3 ) && dabt.write)
Can we get some #defines for these magic constants please.
xen/arch/arm/traps.c static void do_trap_data_abort_guest(struct cpu_user_regs *regs, · line 1021
Quoted 6 lines
xen/arch/arm/traps.c +5
-0+ { +if (handle_page_fault (current->domain, info.gpa) ==0 ) +return ; + } +if (handle_mmio (&info))
Since you handle page fault first, won't this make MMIO trapping regions writable?
Ian.
Re: [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracing
Quoted 11 lines
-----Original Message-----
From: Ian Campbell [mailto:[email protected]]
Sent: Wednesday, July 03, 2013 9:27 PM
To: Jaeyong Yoo
Cc: [email protected]; Elena Pyatunina
Subject: Re: [Xen-devel] [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracingOn Wed, 2013-07-03 at 18:15 +0900, Jaeyong Yoo wrote:
Quoted 8 lines
Quoted 4 lines
From: Elena Pyatunina <[email protected]>
Add handling write fault in
do_trap_data_abort_guestfor dirty-page tracing. Mark dirty function makes the bitmap of dirty pages.You've gone with the model of allocating a bitmap when logdirty is enabled and updating it directly from the fault handler? The bit map is based around a three level structure mirroring the p2m tables?
Yes, you got it right.
Quoted 9 lines
I had been considering the option of reusing one of the bits available for software use in the p2m entries to track the dirty status and walking the p2m when the toolstack asked for the current bitmap instead.
I think this would have less memory overhead and also would allow us to be lock free on the fault handling path (by using suitable atomic exchanges on the p2m entries), as well as avoiding memory allocations on that path.
Quoted 5 lines
I think we'd want to establish a linear map of the current guest p2m for these purposes so we could also avoid all the
map_domain_pagestuff in the fault path. I think there is enough virtual address space left for that even on 32-bit, it's less critical on 64-bit anyway since we are about to have a direct map of RAM available to us.
I think it is a good idea to have an ever-mapping linear dirty-bit map for guest p2m. Maybe between fixmap and frametable?
Quoted 7 lines
xen/arch/arm/traps.c static void do_trap_data_abort_guest(struct
Quoted 6 lines
xen/arch/arm/traps.c index renamed from xen/arch/arm/traps.c +0
-0398d209..9927712 100644
xen/arch/arm/traps.c +0
-0@@ -1011,6 +1011,13 @@ static void do_trap_data_abort_guest(struct
cpu_user_regs*regs,
Quoted 7 lines
xen/arch/arm/traps.c static void do_trap_data_abort_guest(struct cpu_user_regs *regs, · line 1015
Quoted 5 lines
xen/arch/arm/traps.c +2
-0if ( rc == -EFAULT ) goto bad_data_abort; +/* handle permission fault on write */ +if ((dabt.dfsc &0x3f ) == (FSC_FLT_PERM +3 ) && dabt.write)Can we get some #defines for these magic constants please.
Got it.
Quoted 10 lines
xen/arch/arm/traps.c static void do_trap_data_abort_guest(struct cpu_user_regs *regs, · line 1021
Quoted 7 lines
xen/arch/arm/traps.c +5
-0+ { +if (handle_page_fault (current->domain, info.gpa) ==0 ) +return ; + } +if (handle_mmio (&info))Since you handle page fault first, won't this make MMIO trapping regions writable?
Oops. I forget to exchange the sequence of handle_page_fault and handle_mmio. Then, it would fix the problem right?
Because handle_mmio is handling virtual emulated devices,
I don't think writing to mmio is necessary to be dirty-page traced.
Quoted 2 lines
Ian.
Re: [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracing
Quoted 9 lines
Quoted 5 lines
I think we'd want to establish a linear map of the current guest p2m for these purposes so we could also avoid all the
map_domain_pagestuff in the fault path. I think there is enough virtual address space left for that even on 32-bit, it's less critical on 64-bit anyway since we are about to have a direct map of RAM available to us.I think it is a good idea to have an ever-mapping linear dirty-bit map for guest p2m. Maybe between fixmap and frametable?
CTTOI, just mapping to xenheap is enough.
Jaeyong
Re: [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracing
In reply to Jaeyong YooQuoted 8 lines · Jaeyong Yoo
Quoted 8 lines
I had been considering the option of reusing one of the bits available for software use in the p2m entries to track the dirty status and walking the p2m when the toolstack asked for the current bitmap instead.
I think this would have less memory overhead and also would allow us to be lock free on the fault handling path (by using suitable atomic exchanges on the p2m entries), as well as avoiding memory allocations on that path.
Quoted 8 lines
Quoted 5 lines
I think we'd want to establish a linear map of the current guest p2m for these purposes so we could also avoid all the
map_domain_pagestuff in the fault path. I think there is enough virtual address space left for that even on 32-bit, it's less critical on 64-bit anyway since we are about to have a direct map of RAM available to us.I think it is a good idea to have an ever-mapping linear dirty-bit map for guest p2m.
By Linear map I meant slotting the p2m into the hypervisor's own page tables (I believe the relevant p2m and pte bits in the entries do not overlap, so this is possible), such that the p2m table entries are available at known virtual addresses and you can locate the L1, L2 and L3 entries corresponding to a given guest physical address with just arithmetic, i.e. something like:
http://www.technovelty.org/linux/virtual-linear-page-table.html
As opposed to an always mapped version of the dirty bitmap, which I think we can sync only when the tools ask.
Quoted 40 lines
Maybe between fixmap and frametable?
Quoted 7 lines
xen/arch/arm/traps.c static void do_trap_data_abort_guest(struct
Quoted 6 lines
xen/arch/arm/traps.c index renamed from xen/arch/arm/traps.c +0
-0398d209..9927712 100644
xen/arch/arm/traps.c +0
-0@@ -1011,6 +1011,13 @@ static void do_trap_data_abort_guest(struct
cpu_user_regs*regs,Quoted 7 lines
xen/arch/arm/traps.c static void do_trap_data_abort_guest(struct cpu_user_regs *regs, · line 1015
Quoted 5 lines
xen/arch/arm/traps.c +2
-0if ( rc == -EFAULT ) goto bad_data_abort; +/* handle permission fault on write */ +if ((dabt.dfsc &0x3f ) == (FSC_FLT_PERM +3 ) && dabt.write)Can we get some #defines for these magic constants please.
Got it.
Quoted 10 lines
xen/arch/arm/traps.c static void do_trap_data_abort_guest(struct cpu_user_regs *regs, · line 1021
Quoted 7 lines
xen/arch/arm/traps.c +5
-0+ { +if (handle_page_fault (current->domain, info.gpa) ==0 ) +return ; + } +if (handle_mmio (&info))Since you handle page fault first, won't this make MMIO trapping regions writable?
Oops. I forget to exchange the sequence of
handle_page_faultandhandle_mmio. Then, it would fix the problem right?
Becausehandle_mmiois handling virtual emulated devices,
I don't think writing to mmio is necessary to be dirty-page traced.Quoted 2 lines
Ian.
Re: [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracing
Quoted 29 lines
-----Original Message-----
From: Ian Campbell [mailto:[email protected]]
Sent: Thursday, July 04, 2013 5:47 PM
To: Jaeyong Yoo
Cc: [email protected]; 'Elena Pyatunina'
Subject: Re: [Xen-devel] [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracingQuoted 3 lines · Jaeyong Yoo
Quoted 3 lines
I had been considering the option of reusing one of the bits available for software use in the p2m entries to track the dirty status and walking the p2m when the toolstack asked for the current
bitmap instead.
Quoted 4 lines
Quoted 4 lines
I think this would have less memory overhead and also would allow us to be lock free on the fault handling path (by using suitable atomic exchanges on the p2m entries), as well as avoiding memory allocations
on that path.
Quoted 9 lines
Quoted 6 lines
I think we'd want to establish a linear map of the current guest p2m for these purposes so we could also avoid all the
map_domain_pagestuff in the fault path. I think there is enough virtual address space left for that even on 32-bit, it's less critical on 64-bit anyway since we are about to have a direct map of RAM available to us.I think it is a good idea to have an ever-mapping linear dirty-bit map for guest p2m.
Quoted 8 lines
By Linear map I meant slotting the p2m into the hypervisor's own page tables (I believe the relevant p2m and pte bits in the entries do not overlap, so this is possible), such that the p2m table entries are available at known virtual addresses and you can locate the L1, L2 and L3 entries corresponding to a given guest physical address with just arithmetic, i.e. something like:
http://www.technovelty.org/linux/virtual-linear-page-table.html
Oh it looks interesting. And we can try this. Thanks for the good tip :)
Quoted 2 lines
As opposed to an always mapped version of the dirty bitmap, which I think we can sync only when the tools ask.
Got it.
Jaeyong
Re: [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracing
In reply to Ian CampbellQuoted 9 lines
Quoted 8 lines
Quoted 5 lines
I think we'd want to establish a linear map of the current guest p2m for these purposes so we could also avoid all the
map_domain_pagestuff in the fault path. I think there is enough virtual address space left for that even on 32-bit, it's less critical on 64-bit anyway since we are about to have a direct map of RAM available to us.I think it is a good idea to have an ever-mapping linear dirty-bit map for guest p2m.
Quoted 7 lines
By Linear map I meant slotting the p2m into the hypervisor's own page tables (I believe the relevant p2m and pte bits in the entries do not overlap, so this is possible), such that the p2m table entries are available at known virtual addresses and you can locate the L1, L2 and L3 entries corresponding to a given guest physical address with just arithmetic, i.e. something like:
http://www.technovelty.org/linux/virtual-linear-page-table.html
Which virtual address range should we map the p2m? Would it be xenheap, domheap, or unassigned range (for instance, between frametable and vmap)?
Jaeyong
Re: [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracing
Quoted 17 lines · Jaeyong Yoo
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines
I think we'd want to establish a linear map of the current guest p2m for these purposes so we could also avoid all the
map_domain_pagestuff in the fault path. I think there is enough virtual address space left for that even on 32-bit, it's less critical on 64-bit anyway since we are about to have a direct map of RAM available to us.I think it is a good idea to have an ever-mapping linear dirty-bit map for guest p2m.
Quoted 7 lines
By Linear map I meant slotting the p2m into the hypervisor's own page tables (I believe the relevant p2m and pte bits in the entries do not overlap, so this is possible), such that the p2m table entries are available at known virtual addresses and you can locate the L1, L2 and L3 entries corresponding to a given guest physical address with just arithmetic, i.e. something like:
http://www.technovelty.org/linux/virtual-linear-page-table.html
Quoted 2 lines
Which virtual address range should we map the p2m? Would it be xenheap, domheap, or unassigned range (for instance, between frametable and vmap)?
Since it needs to take over a bunch of entries in the page tables it should be its own virtual address range. Looking at xen/include/asm-arm/config.h between the frametable and vmap seems sensible.
Ian.
Re: [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracing
Quoted 28 lines
-----Original Message-----
From: Ian Campbell [mailto:[email protected]]
Sent: Monday, July 08, 2013 1:53 AM
To: Jaeyong Yoo
Cc: 'Elena Pyatunina'; [email protected]
Subject: Re: [Xen-devel] [PATCH RFC v2 6/9] xen/arm: Add handling write fault for dirty-page tracingQuoted 5 lines · Jaeyong Yoo
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
I think we'd want to establish a linear map of the current guest p2m for these purposes so we could also avoid all the
map_domain_pagestuff in the fault path. I think there is enough virtual address space left for that even on 32-bit, it's less critical on 64-bit anyway since we are about to have a direct mapof RAM available to us.
Quoted 13 lines
Quoted 12 lines
Quoted 3 lines
I think it is a good idea to have an ever-mapping linear dirty-bit map for guest p2m.
By Linear map I meant slotting the p2m into the hypervisor's own page tables (I believe the relevant p2m and pte bits in the entries do not overlap, so this is possible), such that the p2m table entries are available at known virtual addresses and you can locate the L1, L2 and
L3 entries corresponding to a given guest physical address with just arithmetic, i.e. something like:
http://www.technovelty.org/linux/virtual-linear-page-table.html
Quoted 7 lines
Quoted 2 lines
Which virtual address range should we map the p2m? Would it be xenheap, domheap, or unassigned range (for instance, between frametable
and vmap)?
Since it needs to take over a bunch of entries in the page tables it should be its own virtual address range. Looking at xen/include/asm-
arm/config.hbetween the frametable and vmap seems sensible.
I have finished VLPT (virtual-linear-page-table) and it gives much faster speed for dirty-page marking. For original version, it took around 5 usec for marking a dirty-bit, but now it only takes around 1.5 usec since we remove all map/unmap domain pages.
Now, I'm thinking of migrating multiple VMs at a moment, then we need to assign virtual memory for VLPT to different each migrating domain. And, I'm thinking to implement similar to vmap assignment. Can you tell me your opinion about this?
Jaeyong
RFC PATCH v2 7/9 xen/arm: Missing impl of clear_guest_offset macro
In reply to Jaeyong YooThis macro is somehow accidently broken. Fill up the rest of it.
--- xen/include/asm-arm/guest_access.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
xen/include/asm-arm/guest_access.h +4 -2
@@ -77,8 +77,10 @@ unsigned long raw_clear_guest(void *to, unsigned len);* Clear an array of objects in guest context via a guest handle, * specifying an offset into the guest array. */ -#define clear_guest_offset (hnd, off, ptr, nr) ({ \ - raw_clear_guest(_d+(off), nr); \ +#define clear_guest_offset (hnd, off, ptr, nr) ({ \ + const typeof(*(ptr)) *_s = (ptr); \ + char (*_d)[sizeof(*_s)] = (void *)(hnd).p; \ + raw_clear_guest(_d+(off), nr); \ })/*
Signature · 1 line
1.8.1.2
Re: [PATCH RFC v2 7/9] xen/arm: Missing impl of clear_guest_offset macro
Quoted 12 lines · Jaeyong Yoo
This macro is somehow accidently broken. Fill up the rest of it.
Signed-off-by Jaeyong Yoo <[email protected]>--- xen/include/asm-arm/guest_access.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)xen/include/asm-arm/guest_access.h +0
-0
xen/include/asm-arm/guest_access.h unsigned long raw_clear_guest(void *to, unsigned len); · line 84
Quoted 10 lines
xen/include/asm-arm/guest_access.h +4
-2@@ -77,8 +77,10 @@ unsigned long raw_clear_guest(void *to, unsigned len);* Clear an array of objects in guest context via a guest handle, * specifying an offset into the guest array. */ -#define clear_guest_offset (hnd, off, ptr, nr) ({ \ - raw_clear_guest(_d+(off), nr); \ +#define clear_guest_offset (hnd, off, ptr, nr) ({ \ + const typeof(*(ptr)) *_s = (ptr); \ + char (*_d)[sizeof(*_s)] = (void *)(hnd).p; \ + raw_clear_guest(_d+(off), nr); \ })
You are right that is broken, in fact shouldn't this macro have only 3 arguments?
Re: [PATCH RFC v2 7/9] xen/arm: Missing impl of clear_guest_offset macro
Quoted 18 lines · Stefano Stabellini
Quoted 17 lines · Jaeyong Yoo
This macro is somehow accidently broken. Fill up the rest of it.
Signed-off-by Jaeyong Yoo <[email protected]>--- xen/include/asm-arm/guest_access.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)xen/include/asm-arm/guest_access.h +0
-2@@ -77,8 +77,10 @@ unsigned long raw_clear_guest(void *to, unsigned len);* Clear an array of objects in guest context via a guest handle, * specifying an offset into the guest array. */ -#define clear_guest_offset (hnd, off, ptr, nr) ({ \ - raw_clear_guest(_d+(off), nr); \
Quoted 8 lines
xen/include/asm-arm/guest_access.h unsigned long raw_clear_guest(void *to, unsigned len); · line 84
Quoted 5 lines
xen/include/asm-arm/guest_access.h +4
-0+#define clear_guest_offset (hnd, off, ptr, nr) ({ \ + const typeof(*(ptr)) *_s = (ptr); \ + char (*_d)[sizeof(*_s)] = (void *)(hnd).p; \ + raw_clear_guest(_d+(off), nr); \ })You are right that is broken, in fact shouldn't this macro have only 3 arguments?
It does everywhere else!
The implementation should be the same as the x86 one I think.
Ian.
Quoted 5 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH RFC v2 7/9] xen/arm: Missing impl of clear_guest_offset macro
In reply to Stefano StabelliniQuoted 16 lines
-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: Wednesday, July 03, 2013 8:37 PM
To: Jaeyong Yoo
Cc: [email protected]
Subject: Re: [Xen-devel] [PATCH RFC v2 7/9] xen/arm: Missing impl ofclear_guest_offsetmacroQuoted 7 lines · Jaeyong Yoo
This macro is somehow accidently broken. Fill up the rest of it.
Signed-off-by Jaeyong Yoo <[email protected]>--- xen/include/asm-arm/guest_access.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Quoted 6 lines
xen/include/asm-arm/guest_access.h unsigned long raw_clear_guest(void *to, unsigned
Quoted 6 lines
xen/include/asm-arm/guest_access.h +0
-0@@ -77,8 +77,10 @@ unsigned long raw_clear_guest(void *to, unsigned
len);
Quoted 5 lines
Quoted 5 lines
xen/include/asm-arm/guest_access.h +0
-2* Clear an array of objects in guest context via a guest handle, * specifying an offset into the guest array. */ -#define clear_guest_offset (hnd, off, ptr, nr) ({ \ - raw_clear_guest(_d+(off), nr); \
Quoted 8 lines
xen/include/asm-arm/guest_access.h unsigned long raw_clear_guest(void *to, unsigned len); · line 84
Quoted 5 lines
xen/include/asm-arm/guest_access.h +4
-0+#define clear_guest_offset (hnd, off, ptr, nr) ({ \ + const typeof(*(ptr)) *_s = (ptr); \ + char (*_d)[sizeof(*_s)] = (void *)(hnd).p; \ + raw_clear_guest(_d+(off), nr); \ })You are right that is broken, in fact shouldn't this macro have only 3 arguments?
Oops right!
Jaeyong
RFC PATCH v2 8/9 xen/arm: Implement hypercall for dirty page tracing (shadow op)
In reply to Jaeyong YooFrom: Elena Pyatunina <[email protected]>
Add hypercall (shadow op: enable/disable and clean/peek dirted page bitmap)
--- xen/arch/arm/domain.c | 4 + xen/arch/arm/domctl.c | 19 ++++ xen/arch/arm/p2m.c | 219 +++++++++++++++++++++++++++++++++++++++++++++- xen/include/asm-arm/p2m.h | 2 + 4 files changed, 242 insertions(+), 2 deletions(-)
xen/arch/arm/domain.c +4 -0
@@ -484,6 +484,10 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags) d->arch.vpidr = boot_cpu_data.midr.bits; d->arch.vmpidr = boot_cpu_data.mpidr.bits; +/* init for dirty-page tracing */ + d->arch.dirty.count =0 ; + d->arch.dirty.top =NULL ; +clear_page (d->shared_info);share_xen_page_with_guest (virt_to_page (d->shared_info), d, XENSHARE_writable);
xen/arch/arm/domctl.c +19 -0
@@ -67,6 +67,14 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d, goto gethvmcontext_out; } +/* Allocate our own marshalling buffer */ + ret = -ENOMEM ; +if ( (c.data =xmalloc_bytes (c.size)) ==NULL ) + { +printk ("(gethvmcontext) xmalloc_bytes failed: %d\n" , c.size ); + goto gethvmcontext_out; + } +domain_pause (d); ret =hvm_save (d, &c);domain_unpause (d);
@@ -85,6 +93,17 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,xfree (c.data); }break ; +case XEN_DOMCTL_shadow_op: + { + ret =dirty_mode_op (d, &domctl->u.shadow_op); +if ( (&domctl->u.shadow_op)->op ==XEN_DOMCTL_SHADOW_OP_CLEAN + || (&domctl->u.shadow_op)->op ==XEN_DOMCTL_SHADOW_OP_PEEK ) + { + copyback =1 ; + } + } +break ; +default :return -EINVAL ; }
xen/arch/arm/p2m.c +217 -2
231 lines not on this page · raw message
xen/include/asm-arm/p2m.h +2 -0
@@ -2,6 +2,7 @@#define _XEN_P2M_H#include <xen/mm.h> +#include <public/domctl.h> struct domain ;
@@ -112,6 +113,7 @@ static inline int get_page_and_type(struct page_info *page,enum mg { mg_clear, mg_ro, mg_rw, mg_rx };void mark_dirty (struct domain *d,paddr_t addr); +long dirty_mode_op (struct domain *d,xen_domctl_shadow_op_t *sc);#endif /* _XEN_P2M_H */
Signature · 1 line
1.8.1.2
Re: [PATCH RFC v2 8/9] xen/arm: Implement hypercall for dirty page tracing (shadow op)
Quoted 37 lines · Jaeyong Yoo
From: Elena Pyatunina <[email protected]>
Add hypercall (shadow op: enable/disable and clean/peek dirted page bitmap)
Signed-off-by Elena Pyatunina <[email protected]>Singed-off-by Alexey Sokolov <[email protected]>--- xen/arch/arm/domain.c | 4 + xen/arch/arm/domctl.c | 19 ++++ xen/arch/arm/p2m.c | 219 +++++++++++++++++++++++++++++++++++++++++++++- xen/include/asm-arm/p2m.h | 2 + 4 files changed, 242 insertions(+), 2 deletions(-)xen/arch/arm/domain.c +4
-0@@ -484,6 +484,10 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags) d->arch.vpidr = boot_cpu_data.midr.bits; d->arch.vmpidr = boot_cpu_data.mpidr.bits; +/* init for dirty-page tracing */ + d->arch.dirty.count =0 ; + d->arch.dirty.top =NULL ; +clear_page (d->shared_info);share_xen_page_with_guest (virt_to_page (d->shared_info), d, XENSHARE_writable);xen/arch/arm/domctl.c +1
-0@@ -67,6 +67,14 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d, goto gethvmcontext_out; } +/* Allocate our own marshalling buffer */
xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct domain *d, · line 80
Quoted 10 lines
xen/arch/arm/domctl.c +7
-0+ ret = -ENOMEM ; +if ( (c.data =xmalloc_bytes (c.size)) ==NULL ) + { +printk ("(gethvmcontext) xmalloc_bytes failed: %d\n" , c.size ); + goto gethvmcontext_out; + } +domain_pause (d); ret =hvm_save (d, &c);domain_unpause (d);
Shouldn't this hunk belong to patch #2?
Quoted 23 lines
xen/arch/arm/domctl.c +11
-0@@ -85,6 +93,17 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,xfree (c.data); }break ; +case XEN_DOMCTL_shadow_op: + { + ret =dirty_mode_op (d, &domctl->u.shadow_op); +if ( (&domctl->u.shadow_op)->op ==XEN_DOMCTL_SHADOW_OP_CLEAN + || (&domctl->u.shadow_op)->op ==XEN_DOMCTL_SHADOW_OP_PEEK ) + { + copyback =1 ; + } + } +break ; +default :return -EINVAL ; }xen/arch/arm/p2m.c +0
-0
xen/arch/arm/p2m.c out: · line 75
Quoted 9 lines
xen/arch/arm/p2m.c +2
-2@@ -69,8 +69,8 @@ out:spin_unlock (&p2m->lock); -return ( ((xen_pfn_t )first_index <<FIRST_SHIFT ) | - (second_index <<SECOND_SHIFT ) | +return ( ((xen_pfn_t )first_index <<FIRST_SHIFT ) | + (second_index <<SECOND_SHIFT ) | (third_index <<THIRD_SHIFT ) ) >>PAGE_SHIFT ;
Does this belong here? If so, why?
Quoted 19 lines
xen/arch/arm/p2m.c +15
-0@@ -496,6 +496,221 @@ void mark_dirty(struct domain *d, paddr_t addr)spin_unlock (&d->arch.dirty.lock); } +static void free_dirty_bitmap (struct domain *d) +{ +struct page_info *pg; + +spin_lock (&d->arch.dirty.lock); + +if (d->arch.dirty.top) + { +while ( (pg =page_list_remove_head (&d->arch.dirty.pages)) ) +free_domheap_page (pg); + } + d->arch.dirty.top =NULL ; + d->arch.dirty.count =0 ; + +spin_unlock (&d->arch.dirty.lock);
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 523
Quoted 10 lines
xen/arch/arm/p2m.c +10
-0+} + +/* Change types across all p2m entries in a domain */ +static void p2m_change_entry_type_global (struct domain *d,enum mg ot,enum mg nt) +{ +struct p2m_domain *p2m = &d->arch.p2m; +int i1, i2, i3; +int first_index =first_table_offset (GUEST_RAM_BASE ); +int second_index =second_table_offset (GUEST_RAM_BASE ); +int third_index =third_table_offset (GUEST_RAM_BASE );
you shouldn't assume GUEST_RAM_BASE is static anywhere
Quoted 81 lines
xen/arch/arm/p2m.c +81
-0+lpae_t *first =__map_domain_page (p2m->first_level); +lpae_t pte, *second =NULL , *third =NULL ; + +BUG_ON (!first &&"Can't map first level p2m." ); + +spin_lock (&p2m->lock); + +for (i1 = first_index; i1 <LPAE_ENTRIES *2 ; ++i1) + { +lpae_walk_t first_pte = first[i1].walk; +if (!first_pte.valid || !first_pte.table) + goto out; + + second =map_domain_page (first_pte.base); +BUG_ON (!second &&"Can't map second level p2m." ); +for (i2 = second_index; i2 <LPAE_ENTRIES ; ++i2) + { +lpae_walk_t second_pte = second[i2].walk; +if (!second_pte.valid || !second_pte.table) + goto out; + + third =map_domain_page (second_pte.base); +BUG_ON (!third &&"Can't map third level p2m." ); + +for (i3 = third_index; i3 <LPAE_ENTRIES ; ++i3) + { +lpae_walk_t third_pte = third[i3].walk; +int write =0 ; +if (!third_pte.valid) + goto out; + + pte = third[i3]; +if (pte.p2m.write ==1 && nt == mg_ro) + { + pte.p2m.write =0 ; + write =1 ; + } +else if (pte.p2m.write ==0 && nt == mg_rw) + { + pte.p2m.write =1 ; + write =1 ; + } +if (write) +write_pte (&third[i3], pte); + } +unmap_domain_page (third); + + third =NULL ; + third_index =0 ; + } +unmap_domain_page (second); + + second =NULL ; + second_index =0 ; + third_index =0 ; + } + +out: +flush_tlb_all_local (); +if (third)unmap_domain_page (third); +if (second)unmap_domain_page (second); +if (first)unmap_domain_page (first); + +spin_unlock (&p2m->lock); +} + +/* Read a domain's log-dirty bitmap and stats. +* If the operation is a CLEAN, clear the bitmap and stats. */ +static int log_dirty_op (struct domain *d,xen_domctl_shadow_op_t *sc) +{ +int i1, i2, rv =0 , clean =0 , peek =1 ; +xen_pfn_t *first =NULL , *second =NULL ; +unsigned long pages =0 , *third =NULL ; + + clean = (sc->op ==XEN_DOMCTL_SHADOW_OP_CLEAN ); + +if (guest_handle_is_null (sc->dirty_bitmap)) + peek =0 ; + +domain_pause (d); +
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 615
Quoted 10 lines
xen/arch/arm/p2m.c +10
-0+printk ("DEBUG: log-dirty %s: dom %u dirty=%u\n" , + (clean) ?"clean" :"peek" , + d->domain_id, d->arch.dirty.count); + + sc->stats.dirty_count = d->arch.dirty.count; + +spin_lock (&d->arch.dirty.lock); + first = d->arch.dirty.top ?__map_domain_page (d->arch.dirty.top) :NULL ; + +/* 32-bit address space starts from 0 and ends at ffffffff.
This should be a 40 bit address space due to LPAE support
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 620
Quoted 5 lines
xen/arch/arm/p2m.c +5
-0+* First level of p2m tables is indexed by bits 39-30. +* So significant bits for 32-bit addresses in first table are 31-30. +* So we need to iterate from 0 to 4. +* But RAM starts from 2 gigabytes. So start from 2 instead. +* TODO remove this hardcode
I wouldn't assume that the guest ram start at 2GB
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 632
Quoted 12 lines
xen/arch/arm/p2m.c +12
-0+*/ +for (i1 =2 ; (pages < sc->pages) && (i1 <4 ); ++i1) + { + second = (first && first[i1]) ?map_domain_page (first[i1]) :NULL ; + +for (i2 =0 ; (i2 <LPAE_ENTRIES ); ++i2) + { +unsigned int bytes =LPAE_ENTRIES /8 ; + third = (second && second[i2]) ?map_domain_page (second[i2]) :NULL ; +if (unlikely (((sc->pages - pages +7 ) >>3 ) < bytes) ) + bytes = (unsigned int )((sc->pages - pages +7 ) >>3 ); +if (peek)
^ code style
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 645
Quoted 13 lines
xen/arch/arm/p2m.c +13
-0+ { +if ( (third ?copy_to_guest_offset (sc->dirty_bitmap, pages >>3 , + (uint8_t *)third, bytes) + :clear_guest_offset (sc->dirty_bitmap, pages >>3 , + (uint8_t *)NULL /*only type matters*/ , + bytes)) !=0 ) + { + rv =1 ; + goto out; + } + } + pages += bytes <<3 ; +if (third)
^ code style
Quoted 5 lines
xen/arch/arm/p2m.c +5
-0+ { +if (clean)clear_page (third); +unmap_domain_page (third); + } + }
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 660
Quoted 10 lines
xen/arch/arm/p2m.c +10
-0+if (second)unmap_domain_page (second); + } +if (first)unmap_domain_page (first); + +spin_unlock (&d->arch.dirty.lock); + +if ( pages < sc->pages ) + sc->pages = pages; + +if (clean)
^ code style
Quoted 27 lines
xen/arch/arm/p2m.c +27
-0+ { +p2m_change_entry_type_global (d, mg_rw, mg_ro); +free_dirty_bitmap (d); + } + +out: +if (rv) + { +spin_unlock (&d->arch.dirty.lock); + } +domain_unpause (d); +return rv; +} + +long dirty_mode_op (struct domain *d,xen_domctl_shadow_op_t *sc) +{ +long ret =0 ; + +switch (sc->op) + { +case XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY : +case XEN_DOMCTL_SHADOW_OP_OFF : + { +enum mg ot = mg_clear, nt = mg_clear; + + ot = sc->op ==XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY ? mg_rw : mg_ro; + nt = sc->op ==XEN_DOMCTL_SHADOW_OP_OFF ? mg_rw : mg_ro;
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 697
Quoted 10 lines
xen/arch/arm/p2m.c +10
-0+ +domain_pause (d); + + d->arch.dirty.mode = sc->op ==XEN_DOMCTL_SHADOW_OP_OFF ?0 :1 ; +p2m_change_entry_type_global (d, ot, nt); + +if (sc->op ==XEN_DOMCTL_SHADOW_OP_OFF ) +free_dirty_bitmap (d); + +domain_unpause (d);
Do we need a lock to make sure that all the operations happen atomically?
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 706
Quoted 9 lines
xen/arch/arm/p2m.c +9
-0+ } +break ; + +case XEN_DOMCTL_SHADOW_OP_CLEAN : +case XEN_DOMCTL_SHADOW_OP_PEEK : + { + ret =log_dirty_op (d, sc); + } +break ;
For symmetry maybe it would be better to pause the domain outside log_dirty_op
Quoted 38 lines
xen/arch/arm/p2m.c +6
-0+default : +return -ENOSYS ; + } +return ret; +} +/* * Local variables: * mode: C xen/include/asm-arm/p2m.h +2
-0@@ -2,6 +2,7 @@#define _XEN_P2M_H#include <xen/mm.h> +#include <public/domctl.h> struct domain ;@@ -112,6 +113,7 @@ static inline int get_page_and_type(struct page_info *page,enum mg { mg_clear, mg_ro, mg_rw, mg_rx };void mark_dirty (struct domain *d,paddr_t addr); +long dirty_mode_op (struct domain *d,xen_domctl_shadow_op_t *sc);#endif /* _XEN_P2M_H */ Signature · 7 lines
1.8.1.2 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH RFC v2 8/9] xen/arm: Implement hypercall for dirty page tracing (shadow op)
Quoted 35 lines
-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: Wednesday, July 03, 2013 9:39 PM
To: Jaeyong Yoo
Cc: [email protected]; Elena Pyatunina
Subject: Re: [Xen-devel] [PATCH RFC v2 8/9] xen/arm: Implement hypercall for dirty page tracing (shadow op)Quoted 11 lines · Jaeyong Yoo
From: Elena Pyatunina <[email protected]>
Add hypercall (shadow op: enable/disable and clean/peek dirted page bitmap)
Signed-off-by Elena Pyatunina <[email protected]>Singed-off-by Alexey Sokolov <[email protected]>--- xen/arch/arm/domain.c | 4 + xen/arch/arm/domctl.c | 19 ++++ xen/arch/arm/p2m.c | 219+++++++++++++++++++++++++++++++++++++++++++++-
xen/arch/arm/domain.c int arch_domain_create(struct domain *d, unsigned
Quoted 8 lines
xen/include/asm-arm/p2m.h | 2 + 4 files changed, 242 insertions(+), 2 deletions(-)xen/arch/arm/domain.c index renamed from xen/arch/arm/domain.c +0
-073dd0de..e3fc533 100644
xen/arch/arm/domain.c +0
-0@@ -484,6 +484,10 @@ int arch_domain_create(struct domain *d, unsignedint
domcr_flags)Quoted 3 lines
xen/arch/arm/domain.c +0
-0d->arch.vpidr = boot_cpu_data.midr.bits; d->arch.vmpidr = boot_cpu_data.mpidr.bits;
Quoted 21 lines
xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct
Quoted 12 lines
xen/arch/arm/domain.c +4
-1+/* init for dirty-page tracing */ + d->arch.dirty.count =0 ; + d->arch.dirty.top =NULL ; +clear_page (d->shared_info);share_xen_page_with_guest (virt_to_page (d->shared_info), d, XENSHARE_writable); diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c indexa0719b0..bc06534 100644
xen/arch/arm/domctl.c +0
-0@@ -67,6 +67,14 @@ long arch_do_domctl(struct xen_domctl *domctl, structdomain *d,
Quoted 8 lines
xen/arch/arm/domctl.c +5
-0goto gethvmcontext_out; } +/* Allocate our own marshalling buffer */ + ret = -ENOMEM ; +if ( (c.data =xmalloc_bytes (c.size)) ==NULL ) + { + printk("(gethvmcontext) xmalloc_bytes failed: %d\n", c.size
);
Quoted 8 lines
xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct domain *d, · line 80
Quoted 6 lines
xen/arch/arm/domctl.c +3
-0+ goto gethvmcontext_out; + } +domain_pause (d); ret =hvm_save (d, &c);domain_unpause (d);Shouldn't this hunk belong to patch #2?
Oops my mistake!
Quoted 12 lines
xen/arch/arm/domctl.c long arch_do_domctl(struct xen_domctl *domctl, struct
Quoted 3 lines
xen/arch/arm/domctl.c +0
-0@@ -85,6 +93,17 @@ long arch_do_domctl(struct xen_domctl *domctl, structdomain *d,
Quoted 8 lines
xen/arch/arm/domctl.c +5
-0xfree (c.data); }break ; +case XEN_DOMCTL_shadow_op: + { + ret = dirty_mode_op(d, &domctl->u.shadow_op); + if ( (&domctl->u.shadow_op)->op == XEN_DOMCTL_SHADOW_OP_CLEAN + || (&domctl->u.shadow_op)->op ==
XEN_DOMCTL_SHADOW_OP_PEEK)
Quoted 17 lines
Quoted 17 lines
xen/arch/arm/domctl.c +6
-0+ { + copyback =1 ; + } + } +break ; +default :return -EINVAL ; }xen/arch/arm/p2m.c index renamed from xen/arch/arm/p2m.c +0
-0bae7af7..fb8ce10 100644
xen/arch/arm/p2m.c +0
-0@@ -69,8 +69,8 @@ out:spin_unlock (&p2m->lock);
Quoted 8 lines
xen/arch/arm/p2m.c out: · line 75
Quoted 6 lines
xen/arch/arm/p2m.c +2
-2-return ( ((xen_pfn_t )first_index <<FIRST_SHIFT ) | - (second_index <<SECOND_SHIFT ) | +return ( ((xen_pfn_t )first_index <<FIRST_SHIFT ) | + (second_index <<SECOND_SHIFT ) | (third_index <<THIRD_SHIFT ) ) >>PAGE_SHIFT ;Does this belong here? If so, why?
Oops, mistake again. It doesn't belong here. Sorry.
Quoted 22 lines
Quoted 22 lines
xen/arch/arm/p2m.c +17
-0@@ -496,6 +496,221 @@ void mark_dirty(struct domain *d, paddr_t addr)spin_unlock (&d->arch.dirty.lock); } +static void free_dirty_bitmap (struct domain *d) { +struct page_info *pg; + +spin_lock (&d->arch.dirty.lock); + +if (d->arch.dirty.top) + { +while ( (pg =page_list_remove_head (&d->arch.dirty.pages)) ) +free_domheap_page (pg); + } + d->arch.dirty.top =NULL ; + d->arch.dirty.count =0 ; + +spin_unlock (&d->arch.dirty.lock); } + +/* Change types across all p2m entries in a domain */ static void +p2m_change_entry_type_global(struct domain *d, enum mg ot, enum mg
Quoted 8 lines
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 523
Quoted 6 lines
xen/arch/arm/p2m.c +6
-0+nt) { +struct p2m_domain *p2m = &d->arch.p2m; +int i1, i2, i3; +int first_index =first_table_offset (GUEST_RAM_BASE ); +int second_index =second_table_offset (GUEST_RAM_BASE ); +int third_index =third_table_offset (GUEST_RAM_BASE );you shouldn't assume
GUEST_RAM_BASEis static anywhere
Yes, you are right. Since there is no way to figure out this value at the moment, we use this static value here. I think we need to parse dtb of domu guest and get this value from there. Do you have any suggestion?
Quoted 87 lines
Quoted 87 lines
xen/arch/arm/p2m.c +85
-0+lpae_t *first =__map_domain_page (p2m->first_level); +lpae_t pte, *second =NULL , *third =NULL ; + +BUG_ON (!first &&"Can't map first level p2m." ); + +spin_lock (&p2m->lock); + +for (i1 = first_index; i1 <LPAE_ENTRIES *2 ; ++i1) + { +lpae_walk_t first_pte = first[i1].walk; +if (!first_pte.valid || !first_pte.table) + goto out; + + second =map_domain_page (first_pte.base); +BUG_ON (!second &&"Can't map second level p2m." ); +for (i2 = second_index; i2 <LPAE_ENTRIES ; ++i2) + { +lpae_walk_t second_pte = second[i2].walk; +if (!second_pte.valid || !second_pte.table) + goto out; + + third =map_domain_page (second_pte.base); +BUG_ON (!third &&"Can't map third level p2m." ); + +for (i3 = third_index; i3 <LPAE_ENTRIES ; ++i3) + { +lpae_walk_t third_pte = third[i3].walk; +int write =0 ; +if (!third_pte.valid) + goto out; + + pte = third[i3]; +if (pte.p2m.write ==1 && nt == mg_ro) + { + pte.p2m.write =0 ; + write =1 ; + } +else if (pte.p2m.write ==0 && nt == mg_rw) + { + pte.p2m.write =1 ; + write =1 ; + } +if (write) +write_pte (&third[i3], pte); + } +unmap_domain_page (third); + + third =NULL ; + third_index =0 ; + } +unmap_domain_page (second); + + second =NULL ; + second_index =0 ; + third_index =0 ; + } + +out: +flush_tlb_all_local (); +if (third)unmap_domain_page (third); +if (second)unmap_domain_page (second); +if (first)unmap_domain_page (first); + +spin_unlock (&p2m->lock); +} + +/* Read a domain's log-dirty bitmap and stats. +* If the operation is a CLEAN, clear the bitmap and stats. */ static +int log_dirty_op (struct domain *d,xen_domctl_shadow_op_t *sc) { +int i1, i2, rv =0 , clean =0 , peek =1 ; +xen_pfn_t *first =NULL , *second =NULL ; +unsigned long pages =0 , *third =NULL ; + + clean = (sc->op ==XEN_DOMCTL_SHADOW_OP_CLEAN ); + +if (guest_handle_is_null (sc->dirty_bitmap)) + peek =0 ; + +domain_pause (d); + +printk ("DEBUG: log-dirty %s: dom %u dirty=%u\n" , + (clean) ?"clean" :"peek" , + d->domain_id, d->arch.dirty.count); + + sc->stats.dirty_count = d->arch.dirty.count;
Quoted 8 lines
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 615
Quoted 6 lines
xen/arch/arm/p2m.c +6
-0+ +spin_lock (&d->arch.dirty.lock); + first = d->arch.dirty.top ?__map_domain_page (d->arch.dirty.top) + :NULL ; + +/* 32-bit address space starts from 0 and ends at ffffffff. This should be a 40 bit address space due to LPAE support
Yes, you are right.
Quoted 4 lines
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 613
Quoted 4 lines
xen/arch/arm/p2m.c +2
-0+* First level of p2m tables is indexed by bits 39-30. +* So significant bits for 32-bit addresses in first table are
31-30.
Quoted 5 lines
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 620
Quoted 3 lines
xen/arch/arm/p2m.c +3
-0+* So we need to iterate from 0 to 4. +* But RAM starts from 2 gigabytes. So start from 2 instead. +* TODO remove this hardcode I wouldn't assume that the guest ram start at 2GB
Yes, right, and we are thinking of using dtb for guest
Quoted 12 lines
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr)
Quoted 12 lines
xen/arch/arm/p2m.c +10
-0+*/ +for (i1 =2 ; (pages < sc->pages) && (i1 <4 ); ++i1) + { + second = (first && first[i1]) ?map_domain_page (first[i1]) : +NULL ; + +for (i2 =0 ; (i2 <LPAE_ENTRIES ); ++i2) + { +unsigned int bytes =LPAE_ENTRIES /8 ; + third = (second && second[i2]) ?
map_domain_page(second[i2]) :
Quoted 7 lines
NULL;
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 632
Quoted 3 lines
xen/arch/arm/p2m.c +3
-0+if (unlikely (((sc->pages - pages +7 ) >>3 ) < bytes) ) + bytes = (unsigned int )((sc->pages - pages +7 ) >>3 ); +if (peek)^ code style
Quoted 2 lines
xen/arch/arm/p2m.c +2
-0+ { + if ( (third ? copy_to_guest_offset(sc->dirty_bitmap,
pages
Quoted 2 lines
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 633
Quoted 2 lines
xen/arch/arm/p2m.c +1
-0> 3, + (uint8_t *)third,
bytes)
Quoted 1 line
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 634
Quoted 1 line
xen/arch/arm/p2m.c +1
-0+ : clear_guest_offset(sc->dirty_bitmap,
pages >> 3,
Quoted 1 line
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 635
Quoted 1 line
xen/arch/arm/p2m.c +1
-0+ (uint8_t *)NULL /*only
type
Quoted 43 lines
matters*/,
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 645
Quoted 8 lines
xen/arch/arm/p2m.c +8
-0+ bytes)) != 0 ) + { + rv =1 ; + goto out; + } + } + pages += bytes <<3 ; +if (third)^ code style
Quoted 5 lines
xen/arch/arm/p2m.c +5
-0+ { +if (clean)clear_page (third); +unmap_domain_page (third); + } + }xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 660
Quoted 10 lines
xen/arch/arm/p2m.c +10
-0+if (second)unmap_domain_page (second); + } +if (first)unmap_domain_page (first); + +spin_unlock (&d->arch.dirty.lock); + +if ( pages < sc->pages ) + sc->pages = pages; + +if (clean)^ code style
Quoted 17 lines
xen/arch/arm/p2m.c +17
-0+ { +p2m_change_entry_type_global (d, mg_rw, mg_ro); +free_dirty_bitmap (d); + } + +out: +if (rv) + { +spin_unlock (&d->arch.dirty.lock); + } +domain_unpause (d); +return rv; +} + +long dirty_mode_op (struct domain *d,xen_domctl_shadow_op_t *sc) { +long ret =0 ; +
Quoted 8 lines
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr)
Quoted 8 lines
xen/arch/arm/p2m.c +8
-0+switch (sc->op) + { +case XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY : +case XEN_DOMCTL_SHADOW_OP_OFF : + { +enum mg ot = mg_clear, nt = mg_clear; + + ot = sc->op == XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY ? mg_rw
:
Quoted 6 lines
mg_ro;xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr)
Quoted 5 lines
xen/arch/arm/p2m.c +5
-0+ nt = sc->op ==XEN_DOMCTL_SHADOW_OP_OFF ? mg_rw : mg_ro; + +domain_pause (d); + + d->arch.dirty.mode = sc->op == XEN_DOMCTL_SHADOW_OP_OFF ? 0
:
Quoted 9 lines
1;
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 697
Quoted 6 lines
xen/arch/arm/p2m.c +6
-0+p2m_change_entry_type_global (d, ot, nt); + +if (sc->op ==XEN_DOMCTL_SHADOW_OP_OFF ) +free_dirty_bitmap (d); + +domain_unpause (d);Do we need a lock to make sure that all the operations happen atomically?
Yes right. Since anyone can call xl simultaneously.
Quoted 12 lines
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 706
Quoted 11 lines
xen/arch/arm/p2m.c +9
-0+ } +break ; + +case XEN_DOMCTL_SHADOW_OP_CLEAN : +case XEN_DOMCTL_SHADOW_OP_PEEK : + { + ret =log_dirty_op (d, sc); + } +break ;
Quoted 2 lines
For symmetry maybe it would be better to pause the domain outside
log_dirty_op
OK.
Quoted 41 lines
Quoted 41 lines
xen/arch/arm/p2m.c +6
-0+default : +return -ENOSYS ; + } +return ret; +} +/* * Local variables: * mode: C xen/include/asm-arm/p2m.h +2
-1@@ -2,6 +2,7 @@#define _XEN_P2M_H#include <xen/mm.h> +#include <public/domctl.h> struct domain ;@@ -112,6 +113,7 @@ static inline int get_page_and_type(structpage_info *page, enum mg { mg_clear, mg_ro, mg_rw, mg_rx }; void mark_dirty(structdomain *d,paddr_t addr); +long dirty_mode_op (struct domain *d,xen_domctl_shadow_op_t *sc);#endif /* _XEN_P2M_H */ --1.8.1.2
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH RFC v2 8/9] xen/arm: Implement hypercall for dirty page tracing (shadow op)
Quoted 29 lines · Jaeyong Yoo
Quoted 20 lines
Quoted 20 lines
xen/arch/arm/p2m.c +17
-0@@ -496,6 +496,221 @@ void mark_dirty(struct domain *d, paddr_t addr)spin_unlock (&d->arch.dirty.lock); } +static void free_dirty_bitmap (struct domain *d) { +struct page_info *pg; + +spin_lock (&d->arch.dirty.lock); + +if (d->arch.dirty.top) + { +while ( (pg =page_list_remove_head (&d->arch.dirty.pages)) ) +free_domheap_page (pg); + } + d->arch.dirty.top =NULL ; + d->arch.dirty.count =0 ; + +spin_unlock (&d->arch.dirty.lock); } + +/* Change types across all p2m entries in a domain */ static void +p2m_change_entry_type_global(struct domain *d, enum mg ot, enum mgQuoted 8 lines
xen/arch/arm/p2m.c void mark_dirty(struct domain *d, paddr_t addr) · line 523
Quoted 6 lines
xen/arch/arm/p2m.c +6
-0+nt) { +struct p2m_domain *p2m = &d->arch.p2m; +int i1, i2, i3; +int first_index =first_table_offset (GUEST_RAM_BASE ); +int second_index =second_table_offset (GUEST_RAM_BASE ); +int third_index =third_table_offset (GUEST_RAM_BASE );you shouldn't assume
GUEST_RAM_BASEis static anywhere
Quoted 3 lines
Yes, you are right. Since there is no way to figure out this value at the moment, we use this static value here. I think we need to parse dtb of domu guest and get this value from there. Do you have any suggestion?
The hypervisor should never be parsing (or even seeing) the domU DTB. Instead the toolstack should poke this sort of information down via a (presumably new) DOMCTL.
Ian.
Re: [PATCH RFC v2 8/9] xen/arm: Implement hypercall for dirty page tracing (shadow op)
Quoted 8 lines
Quoted 3 lines
Yes, you are right. Since there is no way to figure out this value at the moment, we use this static value here. I think we need to parse dtb of domu guest and get this value from there. Do you have any
suggestion?
The hypervisor should never be parsing (or even seeing) the domU DTB. Instead the toolstack should poke this sort of information down via a (presumably new) DOMCTL.
Got it.
Quoted 2 lines
Ian.
Re: [PATCH RFC v2 8/9] xen/arm: Implement hypercall for dirty page tracing (shadow op)
Quoted 10 lines · Jaeyong Yoo
Quoted 8 lines
Quoted 3 lines
Yes, you are right. Since there is no way to figure out this value at the moment, we use this static value here. I think we need to parse dtb of domu guest and get this value from there. Do you have any
suggestion?
The hypervisor should never be parsing (or even seeing) the domU DTB. Instead the toolstack should poke this sort of information down via a (presumably new) DOMCTL.
Got it.
I wonder whether we could find the start of memory by looking at the p2m and then storing the value in a per-domain variable to avoid a pagetable walk every time.
Re: [PATCH RFC v2 8/9] xen/arm: Implement hypercall for dirty page tracing (shadow op)
Quoted 10 lines · Stefano Stabellini
Quoted 9 lines · Jaeyong Yoo
Quoted 8 lines
Quoted 3 lines
Yes, you are right. Since there is no way to figure out this value at the moment, we use this static value here. I think we need to parse dtb of domu guest and get this value from there. Do you have any
suggestion?
The hypervisor should never be parsing (or even seeing) the domU DTB. Instead the toolstack should poke this sort of information down via a (presumably new) DOMCTL.
Quoted 5 lines
Quoted 1 line
Got it.
I wonder whether we could find the start of memory by looking at the p2m and then storing the value in a per-domain variable to avoid a pagetable walk every time.
I think the toolstack should just tell the hypervisor.
Ian.
Re: [PATCH RFC v2 8/9] xen/arm: Implement hypercall for dirty page tracing (shadow op)
1) Maybe it reasonable use a new HVM parameter for guest RAM base PFN instead of new DOMCTL and setup it from libxc through existing xc_set_hvm_param hypercall?
2) Since a static GUEST_RAM_BASE is also used in libxc zImage loader (xc_dom_armzimageloader.c) should we parse guest's DTB in function xc_dom_parse_zimage_kernel or simply provide dom->rambase_pfn to the hypervisor?
Best regards,
Evgeny
04.07.2013 14:36, Ian Campbell
Quoted 24 lines · Stefano Stabellini
Quoted 6 lines · Jaeyong Yoo
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Yes, you are right. Since there is no way to figure out this value at the moment, we use this static value here. I think we need to parse dtb of domu guest and get this value from there. Do you have any
suggestion?
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
The hypervisor should never be parsing (or even seeing) the domU DTB. Instead the toolstack should poke this sort of information down via a (presumably new) DOMCTL.
Got it.
I wonder whether we could find the start of memory by looking at the p2m and then storing the value in a per-domain variable to avoid a pagetable walk every time.
I think the toolstack should just tell the hypervisor.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH RFC v2 8/9] xen/arm: Implement hypercall for dirty page tracing (shadow op)
Quoted 3 lines · Eugene Fedotov
1) Maybe it reasonable use a new HVM parameter for guest RAM base PFN instead of new DOMCTL and setup it from libxc through existing
xc_set_hvm_paramhypercall?
Either that or perhaps reuse the existing set memory map hypercall?
Quoted 4 lines
2) Since a static
GUEST_RAM_BASEis also used in libxc zImage loader (xc_dom_armzimageloader.c) should we parse guest's DTB in functionxc_dom_parse_zimage_kernelor simply providedom->rambase_pfnto the hypervisor?
Actually, we should be generating the DTB based on the guest configuration, rather than parsing the DTB to determine the configuration IYSWIM.
Ian.
Re: [PATCH RFC v2 8/9] xen/arm: Implement hypercall for dirty page tracing (shadow op)
Hi.
Quoted 1 line
Either that or perhaps reuse the existing set memory map hypercall?
The HVM parameter is easy to implement since we have many of them unused on ARM. I'll think of reusing set_memory_map (this looks like a PV-specific on x86 and compat code for x86-64)
Quoted 3 lines
Actually, we should be generating the DTB based on the guest configuration, rather than parsing the DTB to determine the configuration IYSWIM.
Could guest's device tree generation be done automatically with some tool?
Best regards,
Evgeny.
Re: [PATCH RFC v2 8/9] xen/arm: Implement hypercall for dirty page tracing (shadow op)
Quoted 7 lines · Eugene Fedotov
Hi.
Quoted 1 line
Either that or perhaps reuse the existing set memory map hypercall?
The HVM parameter is easy to implement since we have many of them unused on ARM. I'll think of reusing
set_memory_map(this looks like a PV-specific on x86 and compat code for x86-64)
Right, I menat to cop-opt extend it to support ARM too. The benefit is that it gives you a complete map and not just a base. I don't know how useful that will be in practice but it seems like it might come up.
I suppose you could push a map into an hvm param but it would not be a very good fit for that interface.
Quoted 6 lines
Quoted 4 lines
Actually, we should be generating the DTB based on the guest configuration, rather than parsing the DTB to determine the configuration IYSWIM.
Could guest's device tree generation be done automatically with some tool?
My vague plan was to link against libfdt and use that.
Quoted 9 lines
Best regards,
Evgeny._______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
RFC PATCH v2 9/9 xen/arm: Implement toolstack for xl restore/save and migrate
In reply to Jaeyong YooFrom: "From: Alexey Sokolov" <[email protected]>
Implement for xl restore/save (which are also used for migrate) operation in xc_arm_migrate.c and make it compilable.
--- config/arm32.mk | 1 + tools/libxc/Makefile | 5 + tools/libxc/xc_arm_migrate.c | 586 +++++++++++++++++++++++++++++++++++++++++++ tools/misc/Makefile | 4 + 4 files changed, 596 insertions(+) create mode 100644 tools/libxc/xc_arm_migrate.c
config/arm32.mk +1 -0
@@ -1,6 +1,7 @@ CONFIG_ARM := y CONFIG_ARM_32 := y CONFIG_ARM_$(XEN_OS) := y +CONFIG_MIGRATE := y # -march= -mcpu=
tools/libxc/Makefile +5 -0
@@ -42,8 +42,13 @@ CTRL_SRCS-$(CONFIG_MiniOS) += xc_minios.c GUEST_SRCS-y := GUEST_SRCS-y += xg_private.c xc_suspend.c ifeq ($(CONFIG_MIGRATE),y) +ifeq ($(CONFIG_X86),y) GUEST_SRCS-y += xc_domain_restore.c xc_domain_save.c GUEST_SRCS-y += xc_offline_page.c xc_compression.c +endif +ifeq ($(CONFIG_ARM),y) +GUEST_SRCS-y += xc_arm_migrate.c +endif else GUEST_SRCS-y += xc_nomigrate.c endif
tools/libxc/xc_arm_migrate.c new file +586 -0
586 lines not on this page · raw message
tools/misc/Makefile +4 -0
@@ -11,7 +11,9 @@ HDRS = $(wildcard *.h) TARGETS-y := xenperf xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd xencov TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvmcrash xen-lowmemd +ifeq ($(CONFIG_X86),y) TARGETS-$(CONFIG_MIGRATE) += xen-hptool +endif TARGETS := $(TARGETS-y) SUBDIRS-$(CONFIG_LOMOUNT) += lomount
@@ -25,7 +27,9 @@ INSTALL_BIN := $(INSTALL_BIN-y) INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm xen-tmem-list-parse gtraceview \ gtracestat xenlockprof xenwatchdogd xen-ringwatch xencov INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvmcrash xen-lowmemd +ifeq ($(CONFIG_X86),y) INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool +endif INSTALL_SBIN := $(INSTALL_SBIN-y) INSTALL_PRIVBIN-y := xenpvnetboot
Signature · 1 line
1.8.1.2
Quoted 4 lines · Jaeyong Yoo
Hello all,
Me and my colleagues have finally made a working version of live migration in xen-on-arndale.
Wow, nice one! Congratulations and thanks!
Quoted 9 lines
Using this patch series, we can xl save/restore and
xl migrate <domid> <ip> successfully.I have to further test the stability and the performance, I would like to get some comments and reviews if anything may not nicely fit to the xen framework.
It is quite preliminary version, but I hope it could be a start for supporting live migration in xen on arm.
Absolutely, I'll put this on my queue of things to look at.
Quoted 57 lines
Best,
JaeyongAlexey Sokolov (2):
xen/arm: Implementget_maximum_gpfnhypercall for arm xen/arm: Implementmodify_returncodeAlexey Sokolov, Elena Pyatunina, Evgeny Fedotov, and Nikolay Martyanov (1):
xen/arm: Implement toolstack for xl restore/save and migrateElena Pyatunina (2):
xen/arm: Add handling write fault for dirty-page tracing xen/arm: Implement hypercall for dirty page tracing (shadow op)Jaeyong Yoo (3):
xen-arm: Implement basic save/load for hvm context xen/arm: Add more registers for saving and restoring vcpu
registers
xen/arm: Missing impl ofclear_guest_offsetmacroJaeyong Yoo and Evgeny Fedotov (1):
xen/arm: Implement save and restore for gic, vtimer, and ptimerconfig/arm32.mk | 1 + tools/include/xen-foreign/reference.size | 2 +- tools/libxc/Makefile | 5 + tools/libxc/xc_arm_migrate.c | 586 +++++++++++++++++++++++++++++++ tools/libxc/xc_resume.c | 25 ++ tools/misc/Makefile | 4 + xen/arch/arm/Makefile | 2 +- xen/arch/arm/domain.c | 38 ++ xen/arch/arm/domctl.c | 134 ++++++- xen/arch/arm/hvm.c | 67 ---- xen/arch/arm/hvm/Makefile | 2 + xen/arch/arm/hvm/hvm.c | 209 +++++++++++ xen/arch/arm/hvm/save.c | 66 ++++ xen/arch/arm/mm.c | 62 +++- xen/arch/arm/p2m.c | 368 +++++++++++++++++++ xen/arch/arm/traps.c | 7 + xen/common/Makefile | 2 + xen/include/asm-arm/domain.h | 8 + xen/include/asm-arm/guest_access.h | 6 +- xen/include/asm-arm/hvm/support.h | 29 ++ xen/include/asm-arm/mm.h | 2 + xen/include/asm-arm/p2m.h | 8 + xen/include/public/arch-arm.h | 41 +++ xen/include/public/arch-arm/hvm/save.h | 55 +++ 24 files changed, 1655 insertions(+), 74 deletions(-) create mode 100644 tools/libxc/xc_arm_migrate.c delete mode 100644 xen/arch/arm/hvm.c create mode 100644 xen/arch/arm/hvm/Makefile create mode 100644 xen/arch/arm/hvm/hvm.c create mode 100644 xen/arch/arm/hvm/save.c create mode 100644 xen/include/asm-arm/hvm/support.h
Quoted 5 lines · Jaeyong Yoo
Hello all,
Me and my colleagues have finally made a working version of live migration in xen-on-arndale. Using this patch series, we can xl save/restore and xl migrate <domid> <ip> successfully.
Good job!! Thanks for the patches!
Quoted 72 lines
I have to further test the stability and the performance, I would like to get some comments and reviews if anything may not nicely fit to the xen framework.
It is quite preliminary version, but I hope it could be a start for supporting live migration in xen on arm.
Best,
JaeyongAlexey Sokolov (2):
xen/arm: Implementget_maximum_gpfnhypercall for arm xen/arm: Implementmodify_returncodeAlexey Sokolov, Elena Pyatunina, Evgeny Fedotov, and Nikolay Martyanov (1):
xen/arm: Implement toolstack for xl restore/save and migrateElena Pyatunina (2):
xen/arm: Add handling write fault for dirty-page tracing xen/arm: Implement hypercall for dirty page tracing (shadow op)Jaeyong Yoo (3):
xen-arm: Implement basic save/load for hvm context xen/arm: Add more registers for saving and restoring vcpu
registers
xen/arm: Missing impl ofclear_guest_offsetmacroJaeyong Yoo and Evgeny Fedotov (1):
xen/arm: Implement save and restore for gic, vtimer, and ptimerconfig/arm32.mk | 1 + tools/include/xen-foreign/reference.size | 2 +- tools/libxc/Makefile | 5 + tools/libxc/xc_arm_migrate.c | 586 +++++++++++++++++++++++++++++++ tools/libxc/xc_resume.c | 25 ++ tools/misc/Makefile | 4 + xen/arch/arm/Makefile | 2 +- xen/arch/arm/domain.c | 38 ++ xen/arch/arm/domctl.c | 134 ++++++- xen/arch/arm/hvm.c | 67 ---- xen/arch/arm/hvm/Makefile | 2 + xen/arch/arm/hvm/hvm.c | 209 +++++++++++ xen/arch/arm/hvm/save.c | 66 ++++ xen/arch/arm/mm.c | 62 +++- xen/arch/arm/p2m.c | 368 +++++++++++++++++++ xen/arch/arm/traps.c | 7 + xen/common/Makefile | 2 + xen/include/asm-arm/domain.h | 8 + xen/include/asm-arm/guest_access.h | 6 +- xen/include/asm-arm/hvm/support.h | 29 ++ xen/include/asm-arm/mm.h | 2 + xen/include/asm-arm/p2m.h | 8 + xen/include/public/arch-arm.h | 41 +++ xen/include/public/arch-arm/hvm/save.h | 55 +++ 24 files changed, 1655 insertions(+), 74 deletions(-) create mode 100644 tools/libxc/xc_arm_migrate.c delete mode 100644 xen/arch/arm/hvm.c create mode 100644 xen/arch/arm/hvm/Makefile create mode 100644 xen/arch/arm/hvm/hvm.c create mode 100644 xen/arch/arm/hvm/save.c create mode 100644 xen/include/asm-arm/hvm/support.hSignature · 7 lines
1.8.1.2 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel