VM forking
v10 cover VM forking
The following series implements VM forking for Intel HVM guests to allow for the fast creation of identical VMs without the assosciated high startup costs of booting or restoring the VM from a savefile.
JIRA issue: https://xenproject.atlassian.net/browse/XEN-89
The fork operation is implemented as part of the "xl fork-vm" command:
xl fork-vm -C <config> -Q <qemu-save-file> -m <max-vcpus> <parent_domid>
By default a fully functional fork is created. The user is in charge however to create the appropriate config file for the fork and to generate the QEMU save file before the fork-vm call is made. The config file needs to give the fork a new name at minimum but other settings may also require changes. Certain settings in the config file of both the parent and the fork have to be set to default. Details are documented.
The interface also allows to split the forking into two steps:
xl fork-vm --launch-dm no \
-m <max-vcpus> \
-p <parent_domid>
xl fork-vm --launch-dm late \
-C <config_file_for_fork> \
-Q <qemu_save_file> \
<fork_domid>The split creation model is useful when the VM needs to be created as fast as possible. The forked VM can be unpaused without the device model being launched to be monitored and accessed via VMI. Note however that without its device model running (depending on what is executing in the VM) it is bound to misbehave or even crash when its trying to access devices that would be emulated by QEMU. We anticipate that for certain use-cases this would be an acceptable situation, in case for example when fuzzing is performed of code segments that don't access such devices.
Launching the device model requires the QEMU Xen savefile to be generated manually from the parent VM. This can be accomplished simply by connecting to its QMP socket and issuing the "xen-save-devices-state" command. For example using the standard tool socat these commands can be used to generate the file:
socat - UNIX-CONNECT:/var/run/xen/qmp-libxl-<parent_domid>
{ "execute": "qmp_capabilities" }
{ "execute": "xen-save-devices-state", \
"arguments": { "filename": "/path/to/save/qemu_state", \
"live": false} }At runtime the forked VM starts running with an empty p2m which gets lazily populated when the VM generates EPT faults, similar to how altp2m views are populated. If the memory access is a read-only access, the p2m entry is populated with a memory shared entry with its parent. For write memory accesses or in case memory sharing wasn't possible (for example in case a reference is held by a third party), a new page is allocated and the page contents are copied over from the parent VM. Forks can be further forked if needed, thus allowing for further memory savings.
A VM fork reset hypercall is also added that allows the fork to be reset to the state it was just after a fork, also accessible via xl:
xl fork-vm --fork-reset -p <fork_domid>
This is an optimization for cases where the forks are very short-lived and run without a device model, so resetting saves some time compared to creating a brand new fork provided the fork has not aquired a lot of memory. If the fork has a lot of memory deduplicated it is likely going to be faster to create a new fork from scratch and asynchronously destroying the old one.
The series has been tested with Windows VMs and functions as expected. Linux VMs when forked from a running VM will have a frozen VNC screen. Linux VMs at this time can only be forked with a working device model when the parent VM was restored from a snapshot using "xl restore -p". This is a known limitation.
Forking time has been measured to be 0.0007s, device model launch to be around 1s depending largely on the number of devices being emulated. Fork resets have been measured to be 0.0001s under the optimal circumstances.
New in v10:
Rebased on staging and minor fixes for things pointed out by Roger Allocate pages for vcpu_info if used by parent
Document limitation of guest settings that have to be set to default Require max-vcpus to be specified by toolstack-side
Code movement in toolstack & compile tested on ARM Implement hypercall continuation for reset operation
Patch 1-2 implements the VM fork & reset operation hypervisor side bits
Patch 3 adds the toolstack-side code implementing VM forking and reset
Tamas K Lengyel (3):
xen/mem_sharing: VM forking
x86/mem_sharing: reset a fork
xen/tools: VM forking toolstack side
docs/man/xl.1.pod.in | 44 ++++ tools/libxc/include/xenctrl.h | 13 + tools/libxc/xc_memshr.c | 22 ++ tools/libxl/libxl.h | 11 + tools/libxl/libxl_create.c | 361 ++++++++++++++------------ tools/libxl/libxl_dm.c | 2 +- tools/libxl/libxl_dom.c | 43 +++- tools/libxl/libxl_internal.h | 7 + tools/libxl/libxl_types.idl | 1 + tools/libxl/libxl_x86.c | 41 +++ tools/xl/Makefile | 2 +- tools/xl/xl.h | 5 + tools/xl/xl_cmdtable.c | 15 ++ tools/xl/xl_forkvm.c | 147 +++++++++++ tools/xl/xl_vmcontrol.c | 14 + xen/arch/x86/domain.c | 11 + xen/arch/x86/hvm/hvm.c | 4 +- xen/arch/x86/mm/hap/hap.c | 3 +- xen/arch/x86/mm/mem_sharing.c | 411 ++++++++++++++++++++++++++++++ xen/arch/x86/mm/p2m.c | 9 +- xen/common/domain.c | 3 + xen/include/asm-x86/hap.h | 1 + xen/include/asm-x86/hvm/hvm.h | 2 + xen/include/asm-x86/mem_sharing.h | 17 ++ xen/include/public/memory.h | 9 + xen/include/xen/sched.h | 5 + 26 files changed, 1032 insertions(+), 171 deletions(-) create mode 100644 tools/xl/xl_forkvm.c
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v10 3/3 xen/tools: VM forking toolstack side
Add necessary bits to implement "xl fork-vm" commands. The command allows the user to specify how to launch the device model allowing for a late-launch model in which the user can execute the fork without the device model and decide to only later launch it.
---
v10: move code into x86 specific code so it doesn't get compiled on ARM
compile tested on ARM
require user to specify parent's max-vcpu setting document limitation on certain options having to be set to default
--- docs/man/xl.1.pod.in | 44 +++++ tools/libxc/include/xenctrl.h | 13 ++ tools/libxc/xc_memshr.c | 22 +++ tools/libxl/libxl.h | 11 ++ tools/libxl/libxl_create.c | 361 +++++++++++++++++++--------------- tools/libxl/libxl_dm.c | 2 +- tools/libxl/libxl_dom.c | 43 +++- tools/libxl/libxl_internal.h | 7 + tools/libxl/libxl_types.idl | 1 + tools/libxl/libxl_x86.c | 41 ++++ tools/xl/Makefile | 2 +- tools/xl/xl.h | 5 + tools/xl/xl_cmdtable.c | 15 ++ tools/xl/xl_forkvm.c | 147 ++++++++++++++ tools/xl/xl_vmcontrol.c | 14 ++ 15 files changed, 562 insertions(+), 166 deletions(-) create mode 100644 tools/xl/xl_forkvm.c
docs/man/xl.1.pod.in +44 -0
@@ -708,6 +708,50 @@ above). =back +=item B<fork-vm> [I<OPTIONS>] I<domain-id> + +Create a fork of a running VM. The domain will be paused after the operation +and remains paused while forks of it exist. Experimental and x86 only. +Forks can only be made of domains with HAP enabled and on Intel hardware. The +parent domain must be created with the xl toolstack and its configuration must +not manually define max_grant_frames, max_maptrack_frames or max_event_channels. + +B<OPTIONS> + +=over 4 + +=item B<-p> + +Leave the fork paused after creating it. + +=item B<--launch-dm> + +Specify whether the device model (QEMU) should be launched for the fork. Late +launch allows to start the device model for an already running fork. + +=item B<-C> + +The config file to use when launching the device model. Currently required when +launching the device model. Most config settings MUST match the parent domain +exactly, only change VM name, disk path and network configurations. + +=item B<-Q> + +The path to the qemu save file to use when launching the device model. Currently +required when launching the device model. + +=item B<--fork-reset> + +Perform a reset operation of an already running fork. Note that resetting may +be less performant then creating a new fork depending on how much memory the +fork has deduplicated during its runtime. + +=item B<--max-vcpus> + +Specify the max-vcpus matching the parent domain when not launching the dm. + +=back + =item B<sharing> [I<domain-id>] Display the number of shared pages for a specified domain. If no domain is
tools/libxc/include/xenctrl.h +13 -0
@@ -2225,6 +2225,19 @@ int xc_memshr_range_share(xc_interface *xch,uint64_t first_gfn, uint64_t last_gfn); +int xc_memshr_fork (xc_interface *xch, +uint32_t source_domain, +uint32_t client_domain); + +/* +* Note: this function is only intended to be used on short-lived forks that +* haven't yet aquired a lot of memory. In case the fork has a lot of memory +* it is likely more performant to create a new fork with xc_memshr_fork. +* +* With VMs that have a lot of memory this call may block for a long time. +*/ +int xc_memshr_fork_reset (xc_interface *xch,uint32_t forked_domain); +/* Debug calls: return the number of pages referencing the shared frame backing * the input argument. Should be one or greater. *
tools/libxc/xc_memshr.c +22 -0
@@ -239,6 +239,28 @@ int xc_memshr_debug_gref(xc_interface *xch,return xc_memshr_memop (xch, domid, &mso); } +int xc_memshr_fork (xc_interface *xch,uint32_t pdomid,uint32_t domid) +{ +xen_mem_sharing_op_t mso; + +memset (&mso,0 ,sizeof (mso)); + + mso.op = XENMEM_sharing_op_fork; + mso.u.fork.parent_domain = pdomid; + +return xc_memshr_memop (xch, domid, &mso); +} + +int xc_memshr_fork_reset (xc_interface *xch,uint32_t domid) +{ +xen_mem_sharing_op_t mso; + +memset (&mso,0 ,sizeof (mso)); + mso.op = XENMEM_sharing_op_fork_reset; + +return xc_memshr_memop (xch, domid, &mso); +} +int xc_memshr_audit (xc_interface *xch) {xen_mem_sharing_op_t mso;
tools/libxl/libxl.h +11 -0
@@ -2657,6 +2657,17 @@ int libxl_psr_get_hw_info(libxl_ctx *ctx, libxl_psr_feat_type type, unsigned int lvl, unsigned int *nr, libxl_psr_hw_info **info);void libxl_psr_hw_info_list_free (libxl_psr_hw_info *list,unsigned int nr); + +int libxl_domain_fork_vm(libxl_ctx *ctx, uint32_t pdomid, uint32_t max_vcpus, uint32_t *domid) + LIBXL_EXTERNAL_CALLERS_ONLY; + +int libxl_domain_fork_launch_dm(libxl_ctx *ctx, libxl_domain_config *d_config, + uint32_t domid, + const libxl_asyncprogress_how *aop_console_how) + LIBXL_EXTERNAL_CALLERS_ONLY; + +int libxl_domain_fork_reset(libxl_ctx *ctx, uint32_t domid) + LIBXL_EXTERNAL_CALLERS_ONLY;#endif /* misc */
tools/libxl/libxl_create.c +204 -157
482 lines not on this page · raw message
tools/libxl/libxl_dm.c +1 -1
@@ -2787,7 +2787,7 @@ static void device_model_spawn_outcome(libxl__egc *egc,libxl__domain_build_state *state = dmss->build_state; -if (state->saved_state) { +if (state->saved_state && !state->forked_vm) { ret2 =unlink (state->saved_state);if (ret2) { LOGED(ERROR, dmss->guest_domid, "%s: failed to remove device-model state %s",
tools/libxl/libxl_dom.c +36 -7
105 lines not on this page · raw message
tools/libxl/libxl_internal.h +7 -0
@@ -1374,6 +1374,7 @@ typedef struct {char *saved_state;int dm_monitor_fd; +bool forked_vm;libxl__file_reference pv_kernel;libxl__file_reference pv_ramdisk;
@@ -4813,6 +4814,12 @@ _hidden int libxl__domain_pvcontrol(libxl__egc *egc,/* Check whether a domid is recent */ int libxl__is_domid_recent (libxl__gc *gc,uint32_t domid,bool *recent); +_hidden int libxl__do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config, +uint32_t *domid,int restore_fd,int send_back_fd, +const libxl_domain_restore_params *params, +const libxl_asyncop_how *ao_how, +const libxl_asyncprogress_how *aop_console_how); +#endif /*
tools/libxl/libxl_types.idl +1 -0
@@ -957,6 +957,7 @@ libxl_domain_config = Struct("domain_config", [ ("on_watchdog", libxl_action_on_shutdown), ("on_crash", libxl_action_on_shutdown), ("on_soft_reset", libxl_action_on_shutdown), + ("dm_restore_file", string, {'const': True}), ], dir=DIR_IN) libxl_diskinfo = Struct("diskinfo", [
tools/libxl/libxl_x86.c +41 -0
53 lines not on this page · raw message
tools/xl/Makefile +1 -1
@@ -15,7 +15,7 @@ LDFLAGS += $(PTHREAD_LDFLAGS) CFLAGS_XL += $(CFLAGS_libxenlight) CFLAGS_XL += -Wshadow -XL_OBJS-$(CONFIG_X86) = xl_psr.o +XL_OBJS-$(CONFIG_X86) = xl_psr.o xl_forkvm.o XL_OBJS = xl.o xl_cmdtable.o xl_sxp.o xl_utils.o $(XL_OBJS-y) XL_OBJS += xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o
tools/xl/xl.h +5 -0
@@ -31,6 +31,7 @@ struct cmd_spec { };struct domain_create { +uint32_t ddomid;/* fork launch dm for this domid */ int debug;int daemonize;int monitor;/* handle guest reboots etc */
@@ -45,6 +46,7 @@ struct domain_create {const char *config_file;char *extra_config;/* extra config string */ const char *restore_file; +const char *dm_restore_file;char *colo_proxy_script;bool userspace_colo_proxy;int migrate_fd;/* -1 means none */
@@ -128,6 +130,8 @@ int main_pciassignable_remove(int argc, char **argv);int main_pciassignable_list (int argc,char **argv);#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME int main_restore (int argc,char **argv); +int main_fork_launch_dm (int argc,char **argv); +int main_fork_reset (int argc,char **argv);int main_migrate_receive (int argc,char **argv);int main_save (int argc,char **argv);int main_migrate (int argc,char **argv);
@@ -212,6 +216,7 @@ int main_psr_cat_cbm_set(int argc, char **argv);int main_psr_cat_show (int argc,char **argv);int main_psr_mba_set (int argc,char **argv);int main_psr_mba_show (int argc,char **argv); +int main_fork_vm (int argc,char **argv);#endif int main_qemu_monitor_command (int argc,char **argv);
tools/xl/xl_cmdtable.c +15 -0
@@ -187,6 +187,21 @@ struct cmd_spec cmd_table[] = { "Restore a domain from a saved state", "- for internal use only", }, +#if defined(__i386__) || defined(__x86_64__) + { "fork-vm", + &main_fork_vm, 0, 1, + "Fork a domain from the running parent domid. Experimental. Most config settings must match parent.", + "[options] <Domid>", + "-h Print this help.\n" + "-C <config> Use config file for VM fork.\n" + "-Q <qemu-save-file> Use qemu save file for VM fork.\n" + "--launch-dm <yes|no|late> Launch device model (QEMU) for VM fork.\n" + "--fork-reset Reset VM fork.\n" + "--max-vcpus Specify max-vcpus matching the parent domain when not launching dm\n" + "-p Do not unpause fork VM after operation.\n" + "-d Enable debug messages.\n" + }, +#endif #endif { "dump-core", &main_dump_core, 0, 1,
tools/xl/xl_forkvm.c new file +147 -0
147 lines not on this page · raw message
tools/xl/xl_vmcontrol.c +14 -0
@@ -676,6 +676,12 @@ int create_domain(struct domain_create *dom_info)int restoring = (restore_file || (migrate_fd >=0 )); +#if defined(__i386__) || defined(__x86_64__) +/* VM forking */ +uint32_t ddomid = dom_info->ddomid;// launch dm for this domain iff set +const char *dm_restore_file = dom_info->dm_restore_file; +#endif +libxl_domain_config_init (&d_config);if (restoring) {
@@ -926,6 +932,14 @@ start:* restore/migrate-receive it again. */ restoring =0 ; +#if defined(__i386__) || defined(__x86_64__) + } else if ( ddomid ) { + d_config.dm_restore_file = dm_restore_file; + ret =libxl_domain_fork_launch_dm (ctx, &d_config, ddomid, + autoconnect_console_how); + domid = ddomid; + ddomid =INVALID_DOMID ; +#endif }else if (domid_soft_reset !=INVALID_DOMID ) {/* Do soft reset. */ ret = libxl_domain_soft_reset(ctx, &d_config, domid_soft_reset,
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v10 2/3 x86/mem_sharing: reset a fork
In reply to Tamas K LengyelImplement hypercall that allows a fork to shed all memory that got allocated for it during its execution and re-load its vCPU context from the parent VM. This allows the forked VM to reset into the same state the parent VM is in a faster way then creating a new fork would be. Measurements show about a 2x speedup during normal fuzzing operations. Performance may vary depending how much memory got allocated for the forked VM. If it has been completely deduplicated from the parent VM then creating a new fork would likely be more performant.
---
v10: implemented hypercall continuation similar to the existing range_share op
--- xen/arch/x86/mm/mem_sharing.c | 126 +++++++++++++++++++++++++++++++++- xen/include/public/memory.h | 4 ++ 2 files changed, 129 insertions(+), 1 deletion(-)
xen/arch/x86/mm/mem_sharing.c +125 -1
@@ -1673,7 +1673,6 @@ static int fork(struct domain *d, struct domain *cd)domain_pause (d); cd->parent_paused = true; cd->max_pages = d->max_pages; - cd->max_vcpus = d->max_vcpus; }/* this is preemptible so it's the first to get done */
@@ -1704,6 +1703,91 @@ static int fork(struct domain *d, struct domain *cd)return rc; } +/* +* The fork reset operation is intended to be used on short-lived forks only. +*/ +static int fork_reset (struct domain *d,struct domain *cd, +struct mem_sharing_op_fork_reset *fr) +{ +int rc =0 ; +struct p2m_domain * p2m =p2m_get_hostp2m (cd); +struct page_info *page, *tmp; +unsigned long list_position =0 , preempt_count =0 , start = fr->opaque; + +domain_pause (cd); + +page_list_for_each_safe (page, tmp, &cd->page_list) + { +p2m_type_t p2mt; +p2m_access_t p2ma; +gfn_t gfn; +mfn_t mfn; +bool shared = false; + + list_position++; + +/* Resume were we left of before preemption */ +if ( start && list_position < start ) +continue ; + + mfn =page_to_mfn (page); +if (mfn_valid (mfn) ) + { + + gfn =mfn_to_gfn (cd, mfn); + mfn =__get_gfn_type_access (p2m,gfn_x (gfn), &p2mt, &p2ma, +0 ,NULL , false); + +if (p2m_is_ram (p2mt) && !p2m_is_shared (p2mt) ) + { +/* take an extra reference, must work for a shared page */ +if ( !get_page (page, cd) ) + { +ASSERT_UNREACHABLE (); +return -EINVAL ; + } + + shared = true; + preempt_count +=0x10 ; + +/* +* Must succeed, it's a shared page that exists and +* thus its size is guaranteed to be 4k so we are not splitting +* large pages. +*/ + rc = p2m->set_entry (p2m, gfn,INVALID_MFN ,PAGE_ORDER_4K , + p2m_invalid, p2m_access_rwx,-1 ); +ASSERT (!rc); + +put_page_alloc_ref (page); +put_page (page); + } + } + +if ( !shared ) + preempt_count++; + +/* Preempt every 2MiB (shared) or 32MiB (unshared) - arbitrary. */ +if ( preempt_count >=0x2000 ) + { +if (hypercall_preempt_check () ) + { + rc = -ERESTART ; +break ; + } + preempt_count =0 ; + } + } + +if ( rc ) + fr->opaque = list_position; +else if ( !(rc =hvm_copy_context_and_params (cd, d)) ) +fork_tsc (cd, d); + +domain_unpause (cd); +return rc; +} +int mem_sharing_memop (XEN_GUEST_HANDLE_PARAM (xen_mem_sharing_op_t) arg) {int rc;
@@ -1973,7 +2057,17 @@ int mem_sharing_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_sharing_op_t) arg) goto out;if ( !mem_sharing_enabled (pd) && (rc =mem_sharing_control (pd, true)) ) + { +rcu_unlock_domain (pd); goto out; + } + + rc = -EINVAL ; +if ( pd->max_vcpus != d->max_vcpus ) + { +rcu_unlock_domain (pd); + goto out; + } rc =fork (pd, d);
@@ -1985,6 +2079,36 @@ int mem_sharing_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_sharing_op_t) arg)break ; } +case XENMEM_sharing_op_fork_reset: + { +struct domain *pd; + + rc = -ENOSYS ; +if ( !mem_sharing_is_fork (d) ) + goto out; + + rc =rcu_lock_live_remote_domain_by_id (d->parent->domain_id, &pd); +if ( rc ) + goto out; + + rc =fork_reset (pd, d, &mso.u.fork_reset); + +rcu_unlock_domain (pd); + +if ( rc >0 ) + { +if (__copy_to_guest (arg, &mso,1 ) ) + rc = -EFAULT ; +else + rc =hypercall_create_continuation (__HYPERVISOR_memory_op, +"lh" , XENMEM_sharing_op, + arg); + } +else + mso.u.fork_reset.opaque =0 ; +break ; + } +default : rc = -ENOSYS ;break ;
xen/include/public/memory.h +4 -0
@@ -483,6 +483,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_mem_access_op_t);#define XENMEM_sharing_op_audit 7#define XENMEM_sharing_op_range_share 8#define XENMEM_sharing_op_fork 9 +#define XENMEM_sharing_op_fork_reset 10#define XENMEM_SHARING_OP_S_HANDLE_INVALID (-10)#define XENMEM_SHARING_OP_C_HANDLE_INVALID (-9)
@@ -537,6 +538,9 @@ struct xen_mem_sharing_op {domid_t parent_domain;/* IN: parent's domain id */ uint16_t _pad[3 ];/* Must be set to 0 */ } fork; +struct mem_sharing_op_fork_reset {/* OP_FORK_RESET */ +uint64_aligned_t opaque;/* Must be set to 0 */ + } fork_reset; } u; };typedef struct xen_mem_sharing_op xen_mem_sharing_op_t ;
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v10 1/3 xen/mem_sharing: VM forking
In reply to Tamas K LengyelVM forking is the process of creating a domain with an empty memory space and a parent domain specified from which to populate the memory when necessary. For the new domain to be functional the VM state is copied over as part of the fork operation (HVM params, hap allocation, etc).
---
v10: setup vcpu_info pages for vCPUs in the fork if the parent has them
setup pages for special HVM PFNs if the parent has them minor adjustments based on Roger's comments
--- xen/arch/x86/domain.c | 11 ++ xen/arch/x86/hvm/hvm.c | 4 +- xen/arch/x86/mm/hap/hap.c | 3 +- xen/arch/x86/mm/mem_sharing.c | 287 ++++++++++++++++++++++++++++++ xen/arch/x86/mm/p2m.c | 9 +- xen/common/domain.c | 3 + xen/include/asm-x86/hap.h | 1 + xen/include/asm-x86/hvm/hvm.h | 2 + xen/include/asm-x86/mem_sharing.h | 17 ++ xen/include/public/memory.h | 5 + xen/include/xen/sched.h | 5 + 11 files changed, 342 insertions(+), 5 deletions(-)
xen/arch/x86/domain.c +11 -0
@@ -2203,6 +2203,17 @@ int domain_relinquish_resources(struct domain *d) ret =relinquish_shared_pages (d);if ( ret )return ret; + +/* +* If the domain is forked, decrement the parent's pause count +* and release the domain. +*/ +if ( d->parent ) + { +domain_unpause (d->parent); +put_domain (d->parent); + d->parent =NULL ; + } }#endif
xen/arch/x86/hvm/hvm.c +2 -2
@@ -1915,7 +1915,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla, }#endif -/* Spurious fault? PoD and log-dirty also take this path. */ +/* Spurious fault? PoD, log-dirty and VM forking also take this path. */ if (p2m_is_ram (p2mt) ) { rc =1 ;
@@ -4429,7 +4429,7 @@ static int hvm_allow_get_param(struct domain *d,return rc; } -static int hvm_get_param (struct domain *d,uint32_t index,uint64_t *value) +int hvm_get_param (struct domain *d,uint32_t index,uint64_t *value) {int rc;
xen/arch/x86/mm/hap/hap.c +1 -2
@@ -321,8 +321,7 @@ static void hap_free_p2m_page(struct domain *d, struct page_info *pg) }/* Return the size of the pool, rounded up to the nearest MB */ -static unsigned int -hap_get_allocation (struct domain *d) +unsigned int hap_get_allocation (struct domain *d) {unsigned int pg = d->arch.paging.hap.total_pages + d->arch.paging.hap.p2m_pages;
xen/arch/x86/mm/mem_sharing.c +287 -0
311 lines not on this page · raw message
xen/arch/x86/mm/p2m.c +8 -1
@@ -509,6 +509,12 @@ mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l, mfn = p2m->get_entry (p2m, gfn, t, a, q, page_order,NULL ); +/* Check if we need to fork the page */ +if ( (q &P2M_ALLOC ) &&p2m_is_hole (*t) && + !mem_sharing_fork_page (p2m->domain, gfn, !!(q &P2M_UNSHARE )) ) + mfn = p2m->get_entry (p2m, gfn, t, a, q, page_order,NULL ); + +/* Check if we need to unshare the page */ if ( (q &P2M_UNSHARE ) &&p2m_is_shared (*t) ) {ASSERT (p2m_is_hostp2m (p2m));
@@ -588,7 +594,8 @@ struct page_info *p2m_get_page_from_gfn(return page;/* Error path: not a suitable GFN at all */ -if ( !p2m_is_ram (*t) && !p2m_is_paging (*t) && !p2m_is_pod (*t) ) +if ( !p2m_is_ram (*t) && !p2m_is_paging (*t) && !p2m_is_pod (*t) && + !mem_sharing_is_fork (p2m->domain) )return NULL ; }
xen/common/domain.c +3 -0
@@ -1269,6 +1269,9 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset) v->vcpu_info = new_info; v->vcpu_info_mfn =page_to_mfn (page); +#ifdef CONFIG_MEM_SHARING + v->vcpu_info_offset = offset; +#endif /* Set new vcpu_info pointer /before/ setting pending flags. */ smp_wmb ();
xen/include/asm-x86/hap.h +1 -0
@@ -45,6 +45,7 @@ int hap_track_dirty_vram(struct domain *d,extern const struct paging_mode *hap_paging_get_mode (struct vcpu *);int hap_set_allocation (struct domain *d,unsigned int pages,bool *preempted); +unsigned int hap_get_allocation (struct domain *d);#endif /* XEN_HAP_H */
xen/include/asm-x86/hvm/hvm.h +2 -0
@@ -339,6 +339,8 @@ bool hvm_flush_vcpu_tlb(bool (*flush_vcpu)(void *ctxt, struct vcpu *v),int hvm_copy_context_and_params (struct domain *src,struct domain *dst); +int hvm_get_param (struct domain *d,uint32_t index,uint64_t *value); +#ifdef CONFIG_HVM #define hvm_get_guest_tsc (v) hvm_get_guest_tsc_fixed(v, 0)
xen/include/asm-x86/mem_sharing.h +17 -0
@@ -39,6 +39,9 @@ struct mem_sharing_domain#define mem_sharing_enabled (d) ((d)->arch.hvm.mem_sharing.enabled) +#define mem_sharing_is_fork (d) \ + (mem_sharing_enabled(d) && !!((d)->parent)) +/* Auditing of memory sharing code? */ #ifndef NDEBUG #define MEM_SHARING_AUDIT 1
@@ -88,6 +91,9 @@ static inline int mem_sharing_unshare_page(struct domain *d,return rc; } +int mem_sharing_fork_page (struct domain *d,gfn_t gfn, +bool unsharing); +/* * If called by a foreign domain, possible errors are * -EBUSY -> ring full
@@ -117,6 +123,7 @@ int relinquish_shared_pages(struct domain *d);#else #define mem_sharing_enabled (d) false +#define mem_sharing_is_fork (p2m) falsestatic inline unsigned int mem_sharing_get_nr_saved_mfns (void ) {
@@ -141,6 +148,16 @@ static inline int mem_sharing_notify_enomem(struct domain *d, unsigned long gfn,return -EOPNOTSUPP ; } +static inline int mem_sharing_fork (struct domain *d,struct domain *cd,bool vcpu) +{ +return -EOPNOTSUPP ; +} + +static inline int mem_sharing_fork_page (struct domain *d,gfn_t gfn,bool lock) +{ +return -EOPNOTSUPP ; +} +#endif #endif /* __MEM_SHARING_H__ */
xen/include/public/memory.h +5 -0
@@ -482,6 +482,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_mem_access_op_t);#define XENMEM_sharing_op_add_physmap 6#define XENMEM_sharing_op_audit 7#define XENMEM_sharing_op_range_share 8 +#define XENMEM_sharing_op_fork 9#define XENMEM_SHARING_OP_S_HANDLE_INVALID (-10)#define XENMEM_SHARING_OP_C_HANDLE_INVALID (-9)
@@ -532,6 +533,10 @@ struct xen_mem_sharing_op {uint32_t gref;/* IN: gref to debug */ } u; } debug; +struct mem_sharing_op_fork {/* OP_FORK */ +domid_t parent_domain;/* IN: parent's domain id */ +uint16_t _pad[3 ];/* Must be set to 0 */ + } fork; } u; };typedef struct xen_mem_sharing_op xen_mem_sharing_op_t ;
xen/include/xen/sched.h +5 -0
@@ -248,6 +248,9 @@ struct vcpu/* Guest-specified relocation of vcpu_info. */ mfn_t vcpu_info_mfn; +#ifdef CONFIG_MEM_SHARING +uint32_t vcpu_info_offset; +#endif struct evtchn_fifo_vcpu *evtchn_fifo;
@@ -503,6 +506,8 @@ struct domain/* Memory sharing support */ #ifdef CONFIG_MEM_SHARING struct vm_event_domain *vm_event_share; +struct domain *parent;/* VM fork parent */ +bool parent_paused;#endif /* Memory paging support */ #ifdef CONFIG_HAS_MEM_PAGING
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v10 1/3] xen/mem_sharing: VM forking
Quoted 196 lines · Tamas K Lengyel
VM forking is the process of creating a domain with an empty memory space and a parent domain specified from which to populate the memory when necessary. For the new domain to be functional the VM state is copied over as part of the fork operation (HVM params, hap allocation, etc).
Signed-off-by Tamas K Lengyel <[email protected]>---
v10: setupvcpu_infopages for vCPUs in the fork if the parent has them
setup pages for special HVM PFNs if the parent has them minor adjustments based on Roger's comments--- xen/arch/x86/domain.c | 11 ++ xen/arch/x86/hvm/hvm.c | 4 +- xen/arch/x86/mm/hap/hap.c | 3 +- xen/arch/x86/mm/mem_sharing.c | 287 ++++++++++++++++++++++++++++++ xen/arch/x86/mm/p2m.c | 9 +- xen/common/domain.c | 3 + xen/include/asm-x86/hap.h | 1 + xen/include/asm-x86/hvm/hvm.h | 2 + xen/include/asm-x86/mem_sharing.h | 17 ++ xen/include/public/memory.h | 5 + xen/include/xen/sched.h | 5 + 11 files changed, 342 insertions(+), 5 deletions(-)xen/arch/x86/domain.c +11
-0@@ -2203,6 +2203,17 @@ int domain_relinquish_resources(struct domain *d) ret =relinquish_shared_pages (d);if ( ret )return ret; + +/* +* If the domain is forked, decrement the parent's pause count +* and release the domain. +*/ +if ( d->parent ) + { +domain_unpause (d->parent); +put_domain (d->parent); + d->parent =NULL ; + } }#endif xen/arch/x86/hvm/hvm.c +2
-2@@ -1915,7 +1915,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla, }#endif -/* Spurious fault? PoD and log-dirty also take this path. */ +/* Spurious fault? PoD, log-dirty and VM forking also take this path. */ if (p2m_is_ram (p2mt) ) { rc =1 ;@@ -4429,7 +4429,7 @@ static int hvm_allow_get_param(struct domain *d,return rc; } -static int hvm_get_param (struct domain *d,uint32_t index,uint64_t *value) +int hvm_get_param (struct domain *d,uint32_t index,uint64_t *value) {int rc;xen/arch/x86/mm/hap/hap.c +1
-2@@ -321,8 +321,7 @@ static void hap_free_p2m_page(struct domain *d, struct page_info *pg) }/* Return the size of the pool, rounded up to the nearest MB */ -static unsigned int -hap_get_allocation (struct domain *d) +unsigned int hap_get_allocation (struct domain *d) {unsigned int pg = d->arch.paging.hap.total_pages + d->arch.paging.hap.p2m_pages;xen/arch/x86/mm/mem_sharing.c +92
-0@@ -22,6 +22,7 @@#include <xen/types.h> #include <xen/domain_page.h> +#include <xen/event.h> #include <xen/spinlock.h> #include <xen/rwlock.h> #include <xen/mm.h> @@ -36,6 +37,8 @@#include <asm/altp2m.h> #include <asm/atomic.h> #include <asm/event.h> +#include <asm/hap.h> +#include <asm/hvm/hvm.h> #include <xsm/xsm.h> #include "mm-locks.h" @@ -1444,6 +1447,263 @@ static inline int mem_sharing_control(struct domain *d, bool enable)return 0 ; } +/* +* Forking a page only gets called when the VM faults due to no entry being +* in the EPT for the access. Depending on the type of access we either +* populate the physmap with a shared entry for read-only access or +* fork the page if its a write access. +* +* The client p2m is already locked so we only need to lock +* the parent's here. +*/ +int mem_sharing_fork_page (struct domain *d,gfn_t gfn,bool unsharing) +{ +int rc = -ENOENT ; +shr_handle_t handle; +struct domain *parent = d->parent; +struct p2m_domain *p2m; +unsigned long gfn_l =gfn_x (gfn); +mfn_t mfn, new_mfn; +p2m_type_t p2mt; +struct page_info *page; + +if ( !mem_sharing_is_fork (d) ) +return -ENOENT ; + +if ( !unsharing ) + { +/* For read-only accesses we just add a shared entry to the physmap */ +while ( parent ) + { +if ( !(rc =nominate_page (parent, gfn,0 , &handle)) ) +break ; + + parent = parent->parent; + } + +if ( !rc ) + { +/* The client's p2m is already locked */ +struct p2m_domain *pp2m =p2m_get_hostp2m (parent); + +p2m_lock (pp2m); + rc =add_to_physmap (parent, gfn_l, handle, d, gfn_l, false); +p2m_unlock (pp2m); + +if ( !rc ) +return 0 ; + } + } + +/* +* If it's a write access (ie. unsharing) or if adding a shared entry to +* the physmap failed we'll fork the page directly. +*/ + p2m =p2m_get_hostp2m (d); + parent = d->parent; + +while ( parent ) + { + mfn =get_gfn_query (parent, gfn_l, &p2mt); + +/* +* We can't fork grant memory from the parent, only regular ram. +*/ +if (mfn_valid (mfn) &&p2m_is_ram (p2mt) ) +break ; + +put_gfn (parent, gfn_l); + parent = parent->parent; + } + +if ( !parent ) +return -ENOENT ; + +if ( !(page =alloc_domheap_page (d,0 )) ) + { +put_gfn (parent, gfn_l); +return -ENOMEM ; + } + + new_mfn =page_to_mfn (page); +copy_domain_page (new_mfn, mfn); +set_gpfn_from_mfn (mfn_x (new_mfn), gfn_l); + +put_gfn (parent, gfn_l); + +return p2m->set_entry (p2m, gfn, new_mfn,PAGE_ORDER_4K , p2m_ram_rw, + p2m->default_access,-1 ); +} + +static int bring_up_vcpus (struct domain *cd,struct domain *d)
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1548
Quoted 10 lines
xen/arch/x86/mm/mem_sharing.c +10
-0+{ +unsigned int i; +struct p2m_domain *p2m =p2m_get_hostp2m (cd); +int ret = -EINVAL ; + +if ( d->max_vcpus != cd->max_vcpus ) +return ret; + +if ( (ret =cpupool_move_domain (cd, d->cpupool)) ) +return ret;
You can join both ifs into a single one, since both return ret.
Quoted 26 lines
xen/arch/x86/mm/mem_sharing.c +26
-0+ +for ( i =0 ; i < cd->max_vcpus; i++ ) + { +mfn_t vcpu_info_mfn; + +if ( !d->vcpu[i] || cd->vcpu[i] ) +continue ; + +if ( !vcpu_create (cd, i) ) +return -EINVAL ; + +/* +* Map in a page for the vcpu_info if the guest uses one to the exact +* same spot. +*/ + vcpu_info_mfn = d->vcpu[i]->vcpu_info_mfn; +if ( !mfn_eq (vcpu_info_mfn,INVALID_MFN ) ) + { +struct page_info *page; +mfn_t new_mfn; +gfn_t gfn =mfn_to_gfn (d, vcpu_info_mfn); +unsigned long gfn_l =gfn_x (gfn); + +if ( !(page =alloc_domheap_page (cd,0 )) ) +return -ENOMEM ; +
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1584
Quoted 10 lines
xen/arch/x86/mm/mem_sharing.c +10
-0+ new_mfn =page_to_mfn (page); +set_gpfn_from_mfn (mfn_x (new_mfn), gfn_l); + +if ( !(ret = p2m->set_entry (p2m, gfn, new_mfn,PAGE_ORDER_4K , + p2m_ram_rw, p2m->default_access,-1 )) ) +return ret; + +if ( !(ret =map_vcpu_info (cd->vcpu[i], gfn_l, + d->vcpu[i]->vcpu_info_offset)) ) +return ret;
I think you also need to copy the contents from the parent into those vcpu_info areas, or else you might discard pending event channels contained in the evtchn_* fields? (and the masked channels if any).
The runtime area should be handled in a similar way AFAICT (albeit there's no need to copy the parent's data in that case), see VCPUOP_register_runstate_memory_area.
Quoted 38 lines
xen/arch/x86/mm/mem_sharing.c +38
-0+ } + } + +domain_update_node_affinity (cd); +return 0 ; +} + +static int fork_hap_allocation (struct domain *cd,struct domain *d) +{ +int rc; +bool preempted; +unsigned long mb =hap_get_allocation (d); + +if ( mb ==hap_get_allocation (cd) ) +return 0 ; + +paging_lock (cd); + rc =hap_set_allocation (cd, mb << (20 -PAGE_SHIFT ), &preempted); +paging_unlock (cd); + +return preempted ? -ERESTART : rc; +} + +static void fork_tsc (struct domain *cd,struct domain *d) +{ +uint32_t tsc_mode; +uint32_t gtsc_khz; +uint32_t incarnation; +uint64_t elapsed_nsec; + +tsc_get_info (d, &tsc_mode, &elapsed_nsec, >sc_khz, &incarnation); +/* Don't bump incarnation on set */ +tsc_set_info (cd, tsc_mode, elapsed_nsec, gtsc_khz, incarnation -1 ); +} + +static int populate_special_pages (struct domain *cd) +{ +struct p2m_domain *p2m =p2m_get_hostp2m (cd);
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1632
Quoted 10 lines
xen/arch/x86/mm/mem_sharing.c +10
-0+static const unsigned int params[] = + { +HVM_PARAM_STORE_PFN , +HVM_PARAM_IOREQ_PFN , +HVM_PARAM_BUFIOREQ_PFN , +HVM_PARAM_CONSOLE_PFN + }; +unsigned int i; + +for ( i=0 ; i<4 ; i++ )
Nit: can you please add some spaces around the operators?
Quoted 6 lines
xen/arch/x86/mm/mem_sharing.c +6
-0+ { +uint64_t value =0 ; +mfn_t new_mfn; +struct page_info *page; + +if (hvm_get_param (cd, params[i], &value) || !value )
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1648
Quoted 10 lines
xen/arch/x86/mm/mem_sharing.c +10
-0+continue ; + +if ( !(page =alloc_domheap_page (cd,0 )) ) +return -ENOMEM ; + + new_mfn =page_to_mfn (page); +set_gpfn_from_mfn (mfn_x (new_mfn), value); + +return p2m->set_entry (p2m,_gfn (value), new_mfn,PAGE_ORDER_4K , + p2m_ram_rw, p2m->default_access,-1 );
I think you also need to copy the contents from the parent page here.
Quoted 34 lines
xen/arch/x86/mm/mem_sharing.c +34
-0+ } + +return 0 ; +} + +static int fork (struct domain *d,struct domain *cd) +{ +int rc = -EBUSY ; + +if ( !cd->controller_pause_count ) +return rc; + +/* +* We only want to get and pause the parent once, not each time this +* operation is restarted due to preemption. +*/ +if ( !cd->parent_paused ) + { +if ( !get_domain (d) ) + { +ASSERT_UNREACHABLE (); +return -EBUSY ; + } + +domain_pause (d); + cd->parent_paused = true; + cd->max_pages = d->max_pages; + cd->max_vcpus = d->max_vcpus; + } + +/* this is preemptible so it's the first to get done */ +if ( (rc =fork_hap_allocation (cd, d)) ) + goto done; +
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1692
Quoted 10 lines
xen/arch/x86/mm/mem_sharing.c +10
-0+if ( (rc =bring_up_vcpus (cd, d)) ) + goto done; + +if ( (rc =hvm_copy_context_and_params (cd, d)) ) + goto done; + +if ( (rc =populate_special_pages (cd)) ) + goto done; + +fork_tsc (cd, d);
I think you need to copy the contents of the shared info page from the parent into the child, or else you are discarding any pending event channels. You should also map such shared info page into the same gfn as the parent.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v10 1/3] xen/mem_sharing: VM forking
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ if ( (ret = cpupool_move_domain(cd, d->cpupool)) ) + return ret;You can join both ifs into a single one, since both return ret.
Sure.
Quoted 41 lines
Quoted 26 lines
xen/arch/x86/mm/mem_sharing.c +26
-0+ +for ( i =0 ; i < cd->max_vcpus; i++ ) + { +mfn_t vcpu_info_mfn; + +if ( !d->vcpu[i] || cd->vcpu[i] ) +continue ; + +if ( !vcpu_create (cd, i) ) +return -EINVAL ; + +/* +* Map in a page for the vcpu_info if the guest uses one to the exact +* same spot. +*/ + vcpu_info_mfn = d->vcpu[i]->vcpu_info_mfn; +if ( !mfn_eq (vcpu_info_mfn,INVALID_MFN ) ) + { +struct page_info *page; +mfn_t new_mfn; +gfn_t gfn =mfn_to_gfn (d, vcpu_info_mfn); +unsigned long gfn_l =gfn_x (gfn); + +if ( !(page =alloc_domheap_page (cd,0 )) ) +return -ENOMEM ; +xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1584
Quoted 10 lines
xen/arch/x86/mm/mem_sharing.c +10
-0+ new_mfn =page_to_mfn (page); +set_gpfn_from_mfn (mfn_x (new_mfn), gfn_l); + +if ( !(ret = p2m->set_entry (p2m, gfn, new_mfn,PAGE_ORDER_4K , + p2m_ram_rw, p2m->default_access,-1 )) ) +return ret; + +if ( !(ret =map_vcpu_info (cd->vcpu[i], gfn_l, + d->vcpu[i]->vcpu_info_offset)) ) +return ret;I think you also need to copy the contents from the parent into those
vcpu_infoareas, or else you might discard pending event channels contained in the evtchn_* fields? (and the masked channels if any).
Quoted 3 lines
The runtime area should be handled in a similar way AFAICT (albeit there's no need to copy the parent's data in that case), see
VCPUOP_register_runstate_memory_area.
Will do.
Quoted 7 lines
Quoted 7 lines
xen/arch/x86/mm/mem_sharing.c +7
-0+static int populate_special_pages (struct domain *cd) +{ +struct p2m_domain *p2m =p2m_get_hostp2m (cd); +static const unsigned int params[] = + { +HVM_PARAM_STORE_PFN , +HVM_PARAM_IOREQ_PFN ,
Quoted 8 lines
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1632
Quoted 6 lines
xen/arch/x86/mm/mem_sharing.c +6
-0+HVM_PARAM_BUFIOREQ_PFN , + HVM_PARAM_CONSOLE_PFN + }; +unsigned int i; + +for ( i=0 ; i<4 ; i++ )Nit: can you please add some spaces around the operators?
Sure.
Quoted 11 lines
Quoted 11 lines
xen/arch/x86/mm/mem_sharing.c +10
-0+ { +uint64_t value =0 ; +mfn_t new_mfn; +struct page_info *page; + +if (hvm_get_param (cd, params[i], &value) || !value ) +continue ; + +if ( !(page =alloc_domheap_page (cd,0 )) ) +return -ENOMEM ;
Quoted 8 lines
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1648
Quoted 6 lines
xen/arch/x86/mm/mem_sharing.c +6
-0+ + new_mfn =page_to_mfn (page); +set_gpfn_from_mfn (mfn_x (new_mfn), value); + +return p2m->set_entry (p2m,_gfn (value), new_mfn,PAGE_ORDER_4K , + p2m_ram_rw, p2m->default_access,-1 );I think you also need to copy the contents from the parent page here.
The toolstack simply clears these pages during restore so I'm not sure
(see https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/libxc/xc_sr_restore_x86_hvm.c;h=3f78248f32fec239db77b0e483b0195211e6b974;hb=HEAD#l61).
I don't see why you would have to clear the pages first if they get
overwritten by saved versions later. Or these pages are expected to be
torn-down by the save/restore aware guests?
Quoted 36 lines
Quoted 36 lines
xen/arch/x86/mm/mem_sharing.c +36
-0+static int fork (struct domain *d,struct domain *cd) +{ +int rc = -EBUSY ; + +if ( !cd->controller_pause_count ) +return rc; + +/* +* We only want to get and pause the parent once, not each time this +* operation is restarted due to preemption. +*/ +if ( !cd->parent_paused ) + { +if ( !get_domain (d) ) + { +ASSERT_UNREACHABLE (); +return -EBUSY ; + } + +domain_pause (d); + cd->parent_paused = true; + cd->max_pages = d->max_pages; + cd->max_vcpus = d->max_vcpus; + } + +/* this is preemptible so it's the first to get done */ +if ( (rc =fork_hap_allocation (cd, d)) ) + goto done; + +if ( (rc =bring_up_vcpus (cd, d)) ) + goto done; + +if ( (rc =hvm_copy_context_and_params (cd, d)) ) + goto done; + +if ( (rc =populate_special_pages (cd)) )
Quoted 9 lines
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1692
Quoted 3 lines
xen/arch/x86/mm/mem_sharing.c +3
-0+ goto done; + +fork_tsc (cd, d);I think you need to copy the contents of the shared info page from the parent into the child, or else you are discarding any pending event channels. You should also map such shared info page into the same gfn as the parent.
I'll look into it, thanks!
Tamas
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v10 2/3] x86/mem_sharing: reset a fork
In reply to Tamas K LengyelQuoted 103 lines · Tamas K Lengyel
Implement hypercall that allows a fork to shed all memory that got allocated for it during its execution and re-load its vCPU context from the parent VM. This allows the forked VM to reset into the same state the parent VM is in a faster way then creating a new fork would be. Measurements show about a 2x speedup during normal fuzzing operations. Performance may vary depending how much memory got allocated for the forked VM. If it has been completely deduplicated from the parent VM then creating a new fork would likely be more performant.
Signed-off-by Tamas K Lengyel <[email protected]>---
v10: implemented hypercall continuation similar to the existingrange_shareop--- xen/arch/x86/mm/mem_sharing.c | 126 +++++++++++++++++++++++++++++++++- xen/include/public/memory.h | 4 ++ 2 files changed, 129 insertions(+), 1 deletion(-)xen/arch/x86/mm/mem_sharing.c +70
-1@@ -1673,7 +1673,6 @@ static int fork(struct domain *d, struct domain *cd)domain_pause (d); cd->parent_paused = true; cd->max_pages = d->max_pages; - cd->max_vcpus = d->max_vcpus; }/* this is preemptible so it's the first to get done */ @@ -1704,6 +1703,91 @@ static int fork(struct domain *d, struct domain *cd)return rc; } +/* +* The fork reset operation is intended to be used on short-lived forks only. +*/ +static int fork_reset (struct domain *d,struct domain *cd, +struct mem_sharing_op_fork_reset *fr) +{ +int rc =0 ; +struct p2m_domain * p2m =p2m_get_hostp2m (cd); +struct page_info *page, *tmp; +unsigned long list_position =0 , preempt_count =0 , start = fr->opaque; + +domain_pause (cd); + +page_list_for_each_safe (page, tmp, &cd->page_list) + { +p2m_type_t p2mt; +p2m_access_t p2ma; +gfn_t gfn; +mfn_t mfn; +bool shared = false; + + list_position++; + +/* Resume were we left of before preemption */ +if ( start && list_position < start ) +continue ; + + mfn =page_to_mfn (page); +if (mfn_valid (mfn) ) + { + + gfn =mfn_to_gfn (cd, mfn); + mfn =__get_gfn_type_access (p2m,gfn_x (gfn), &p2mt, &p2ma, +0 ,NULL , false); + +if (p2m_is_ram (p2mt) && !p2m_is_shared (p2mt) ) + { +/* take an extra reference, must work for a shared page */ +if ( !get_page (page, cd) ) + { +ASSERT_UNREACHABLE (); +return -EINVAL ; + } + + shared = true; + preempt_count +=0x10 ; + +/* +* Must succeed, it's a shared page that exists and +* thus its size is guaranteed to be 4k so we are not splitting +* large pages. +*/ + rc = p2m->set_entry (p2m, gfn,INVALID_MFN ,PAGE_ORDER_4K , + p2m_invalid, p2m_access_rwx,-1 ); +ASSERT (!rc); + +put_page_alloc_ref (page); +put_page (page); + } + } + +if ( !shared ) + preempt_count++; + +/* Preempt every 2MiB (shared) or 32MiB (unshared) - arbitrary. */ +if ( preempt_count >=0x2000 ) + { +if (hypercall_preempt_check () ) + { + rc = -ERESTART ;
xen/arch/x86/mm/mem_sharing.c static int fork(struct domain *d, struct domain *cd) · line 1785
Quoted 10 lines
xen/arch/x86/mm/mem_sharing.c +10
-0+break ; + } + preempt_count =0 ; + } + } + +if ( rc ) + fr->opaque = list_position; +else if ( !(rc =hvm_copy_context_and_params (cd, d)) ) +fork_tsc (cd, d);
You also need to reset the contents of the special pages, the vcpu_info pages and the shared_info page in order to match the state the VM was in when forking.
PV timers should also be reset to parent's state AFAICT, or else you will get spurious timer interrupts.
In fact you should check against the state of the parent, because the fork might have changed the position of the shared info or any other of those magic areas, and that should be reverted to the state they are in the parent.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v10 2/3] x86/mem_sharing: reset a fork
Quoted 3 lines
You also need to reset the contents of the special pages, the
vcpu_infopages and theshared_infopage in order to match the state the VM was in when forking.
Ack.
Quoted 3 lines
PV timers should also be reset to parent's state AFAICT, or else you will get spurious timer interrupts.
Could you point me to the right direction here for where the timers are located in the codebase?
Quoted 4 lines
In fact you should check against the state of the parent, because the fork might have changed the position of the shared info or any other of those magic areas, and that should be reverted to the state they are in the parent.
Makes sense.
Thanks,
Tamas
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v10 1/3] xen/mem_sharing: VM forking
In reply to Tamas K LengyelQuoted 38 lines · Tamas K Lengyel
Quoted 7 lines
Quoted 7 lines
xen/arch/x86/mm/mem_sharing.c +7
-0+static int populate_special_pages (struct domain *cd) +{ +struct p2m_domain *p2m =p2m_get_hostp2m (cd); +static const unsigned int params[] = + { +HVM_PARAM_STORE_PFN , +HVM_PARAM_IOREQ_PFN ,Quoted 8 lines
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1632
Quoted 6 lines
xen/arch/x86/mm/mem_sharing.c +6
-0+HVM_PARAM_BUFIOREQ_PFN , + HVM_PARAM_CONSOLE_PFN + }; +unsigned int i; + +for ( i=0 ; i<4 ; i++ )Nit: can you please add some spaces around the operators?
Sure.
Quoted 11 lines
Quoted 11 lines
xen/arch/x86/mm/mem_sharing.c +10
-0+ { +uint64_t value =0 ; +mfn_t new_mfn; +struct page_info *page; + +if (hvm_get_param (cd, params[i], &value) || !value ) +continue ; + +if ( !(page =alloc_domheap_page (cd,0 )) ) +return -ENOMEM ;Quoted 8 lines
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1648
Quoted 6 lines
xen/arch/x86/mm/mem_sharing.c +6
-0+ + new_mfn =page_to_mfn (page); +set_gpfn_from_mfn (mfn_x (new_mfn), value); + +return p2m->set_entry (p2m,_gfn (value), new_mfn,PAGE_ORDER_4K , + p2m_ram_rw, p2m->default_access,-1 );I think you also need to copy the contents from the parent page here.
Quoted 5 lines
The toolstack simply clears these pages during restore so I'm not sure
(see https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/libxc/xc_sr_restore_x86_hvm.c;h=3f78248f32fec239db77b0e483b0195211e6b974;hb=HEAD#l61).
I don't see why you would have to clear the pages first if they get
overwritten by saved versions later. Or these pages are expected to be
torn-down by the save/restore aware guests?
Guests using those pages know they are torn down during suspend/resume and expect to find a clean state when resuming. That's not the case with forking however, as the guest is completely unaware of the fork happening.
One thing I'm not sure of is whether the backends (xenstored, xenconsoled) will cope with those pages being already populated on guest creation.
AFAICT another issue is that xenstore watches are not copied over from the parent, so any watches the parent might have set will not fire on the child. That would require some kind of interaction with xenstored in order to request a guest state to be copied over to another guest.
Quoted 46 lines
Quoted 36 lines
Quoted 36 lines
xen/arch/x86/mm/mem_sharing.c +36
-0+static int fork (struct domain *d,struct domain *cd) +{ +int rc = -EBUSY ; + +if ( !cd->controller_pause_count ) +return rc; + +/* +* We only want to get and pause the parent once, not each time this +* operation is restarted due to preemption. +*/ +if ( !cd->parent_paused ) + { +if ( !get_domain (d) ) + { +ASSERT_UNREACHABLE (); +return -EBUSY ; + } + +domain_pause (d); + cd->parent_paused = true; + cd->max_pages = d->max_pages; + cd->max_vcpus = d->max_vcpus; + } + +/* this is preemptible so it's the first to get done */ +if ( (rc =fork_hap_allocation (cd, d)) ) + goto done; + +if ( (rc =bring_up_vcpus (cd, d)) ) + goto done; + +if ( (rc =hvm_copy_context_and_params (cd, d)) ) + goto done; + +if ( (rc =populate_special_pages (cd)) )Quoted 9 lines
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1692
Quoted 3 lines
xen/arch/x86/mm/mem_sharing.c +3
-0+ goto done; + +fork_tsc (cd, d);I think you need to copy the contents of the shared info page from the parent into the child, or else you are discarding any pending event channels. You should also map such shared info page into the same gfn as the parent.
Quoted 1 line
I'll look into it, thanks!
Oh, and the PV timer state should also be copied over, so that PV timer interrupts are not lost.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v10 2/3] x86/mem_sharing: reset a fork
In reply to Tamas K LengyelQuoted 4 lines · Tamas K Lengyel
Quoted 3 lines
You also need to reset the contents of the special pages, the
vcpu_infopages and theshared_infopage in order to match the state the VM was in when forking.
Quoted 8 lines
Ack.
Quoted 3 lines
PV timers should also be reset to parent's state AFAICT, or else you will get spurious timer interrupts.
Could you point me to the right direction here for where the timers are located in the codebase?
The code paths start at VCPUOP_set_periodic_timer, VCPUOP_stop_periodic_timer, VCPUOP_set_singleshot_timer and VCPUOP_stop_singleshot_timer. AFAICT it's mostly a matter of copying the state and staring the timer if it was already active on the parent.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v10 1/3] xen/mem_sharing: VM forking
In reply to Roger Pau MonnéQuoted 51 lines · Roger Pau Monné
Quoted 38 lines · Tamas K Lengyel
Quoted 7 lines
Quoted 7 lines
xen/arch/x86/mm/mem_sharing.c +7
-0+static int populate_special_pages (struct domain *cd) +{ +struct p2m_domain *p2m =p2m_get_hostp2m (cd); +static const unsigned int params[] = + { +HVM_PARAM_STORE_PFN , +HVM_PARAM_IOREQ_PFN ,Quoted 8 lines
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1632
Quoted 6 lines
xen/arch/x86/mm/mem_sharing.c +6
-0+HVM_PARAM_BUFIOREQ_PFN , + HVM_PARAM_CONSOLE_PFN + }; +unsigned int i; + +for ( i=0 ; i<4 ; i++ )Nit: can you please add some spaces around the operators?
Sure.
Quoted 11 lines
Quoted 11 lines
xen/arch/x86/mm/mem_sharing.c +10
-0+ { +uint64_t value =0 ; +mfn_t new_mfn; +struct page_info *page; + +if (hvm_get_param (cd, params[i], &value) || !value ) +continue ; + +if ( !(page =alloc_domheap_page (cd,0 )) ) +return -ENOMEM ;Quoted 8 lines
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1648
Quoted 6 lines
xen/arch/x86/mm/mem_sharing.c +6
-0+ + new_mfn =page_to_mfn (page); +set_gpfn_from_mfn (mfn_x (new_mfn), value); + +return p2m->set_entry (p2m,_gfn (value), new_mfn,PAGE_ORDER_4K , + p2m_ram_rw, p2m->default_access,-1 );I think you also need to copy the contents from the parent page here.
Quoted 5 lines
The toolstack simply clears these pages during restore so I'm not sure
(see https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/libxc/xc_sr_restore_x86_hvm.c;h=3f78248f32fec239db77b0e483b0195211e6b974;hb=HEAD#l61).
I don't see why you would have to clear the pages first if they get
overwritten by saved versions later. Or these pages are expected to be
torn-down by the save/restore aware guests?Guests using those pages know they are torn down during suspend/resume and expect to find a clean state when resuming. That's not the case with forking however, as the guest is completely unaware of the fork happening.
Quoted 8 lines
One thing I'm not sure of is whether the backends (xenstored, xenconsoled) will cope with those pages being already populated on guest creation.
AFAICT another issue is that xenstore watches are not copied over from the parent, so any watches the parent might have set will not fire on the child. That would require some kind of interaction with xenstored in order to request a guest state to be copied over to another guest.
Sounds like it most likely would need to be handled if the guest uses them. I'm not sure if a default Linux HVM guest uses them though. A Windows HVM guest without the PV drivers is certainly not Xen aware so there things already work just fine and that is our primary target for our use-case. PVHVM/PVH Linux guests are not. So that's really outside the scope of what I can contribute at the moment.
Thanks,
Tamas
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v10 1/3] xen/mem_sharing: VM forking
Quoted 56 lines · Tamas K Lengyel
Quoted 55 lines · Roger Pau Monné
Quoted 38 lines · Tamas K Lengyel
Quoted 7 lines
Quoted 7 lines
xen/arch/x86/mm/mem_sharing.c +7
-0+static int populate_special_pages (struct domain *cd) +{ +struct p2m_domain *p2m =p2m_get_hostp2m (cd); +static const unsigned int params[] = + { +HVM_PARAM_STORE_PFN , +HVM_PARAM_IOREQ_PFN ,Quoted 8 lines
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1632
Quoted 6 lines
xen/arch/x86/mm/mem_sharing.c +6
-0+HVM_PARAM_BUFIOREQ_PFN , + HVM_PARAM_CONSOLE_PFN + }; +unsigned int i; + +for ( i=0 ; i<4 ; i++ )Nit: can you please add some spaces around the operators?
Sure.
Quoted 11 lines
Quoted 11 lines
xen/arch/x86/mm/mem_sharing.c +10
-0+ { +uint64_t value =0 ; +mfn_t new_mfn; +struct page_info *page; + +if (hvm_get_param (cd, params[i], &value) || !value ) +continue ; + +if ( !(page =alloc_domheap_page (cd,0 )) ) +return -ENOMEM ;Quoted 8 lines
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1648
Quoted 6 lines
xen/arch/x86/mm/mem_sharing.c +6
-0+ + new_mfn =page_to_mfn (page); +set_gpfn_from_mfn (mfn_x (new_mfn), value); + +return p2m->set_entry (p2m,_gfn (value), new_mfn,PAGE_ORDER_4K , + p2m_ram_rw, p2m->default_access,-1 );I think you also need to copy the contents from the parent page here.
Quoted 5 lines
The toolstack simply clears these pages during restore so I'm not sure
(see https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/libxc/xc_sr_restore_x86_hvm.c;h=3f78248f32fec239db77b0e483b0195211e6b974;hb=HEAD#l61).
I don't see why you would have to clear the pages first if they get
overwritten by saved versions later. Or these pages are expected to be
torn-down by the save/restore aware guests?Guests using those pages know they are torn down during suspend/resume and expect to find a clean state when resuming. That's not the case with forking however, as the guest is completely unaware of the fork happening.
One thing I'm not sure of is whether the backends (xenstored, xenconsoled) will cope with those pages being already populated on guest creation.
Quoted 7 lines
Quoted 4 lines
AFAICT another issue is that xenstore watches are not copied over from the parent, so any watches the parent might have set will not fire on the child. That would require some kind of interaction with xenstored in order to request a guest state to be copied over to another guest.
Sounds like it most likely would need to be handled if the guest uses them. I'm not sure if a default Linux HVM guest uses them though.
Linux PVHVM does use xenstore watches to monitor backend state changes, but it would require a non-trivial amount of work to clone the state of PV devices, so I guess it's something to be left as a TODO item.
Quoted 5 lines
A
Windows HVM guest without the PV drivers is certainly not Xen aware so there things already work just fine and that is our primary target for our use-case. PVHVM/PVH Linux guests are not. So that's really outside the scope of what I can contribute at the moment.
Sure.
Can you please add a TODO item here to note that the contents of those special pages likely need to be copied over, and that the state of PV devices and interfaces that rely on backends running in userspace is not handled at all.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v10 1/3] xen/mem_sharing: VM forking
Quoted 77 lines · Roger Pau Monné
Quoted 56 lines · Tamas K Lengyel
Quoted 55 lines · Roger Pau Monné
Quoted 38 lines · Tamas K Lengyel
Quoted 7 lines
Quoted 7 lines
xen/arch/x86/mm/mem_sharing.c +7
-0+static int populate_special_pages (struct domain *cd) +{ +struct p2m_domain *p2m =p2m_get_hostp2m (cd); +static const unsigned int params[] = + { +HVM_PARAM_STORE_PFN , +HVM_PARAM_IOREQ_PFN ,Quoted 8 lines
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1632
Quoted 6 lines
xen/arch/x86/mm/mem_sharing.c +6
-0+HVM_PARAM_BUFIOREQ_PFN , + HVM_PARAM_CONSOLE_PFN + }; +unsigned int i; + +for ( i=0 ; i<4 ; i++ )Nit: can you please add some spaces around the operators?
Sure.
Quoted 11 lines
Quoted 11 lines
xen/arch/x86/mm/mem_sharing.c +10
-0+ { +uint64_t value =0 ; +mfn_t new_mfn; +struct page_info *page; + +if (hvm_get_param (cd, params[i], &value) || !value ) +continue ; + +if ( !(page =alloc_domheap_page (cd,0 )) ) +return -ENOMEM ;Quoted 8 lines
xen/arch/x86/mm/mem_sharing.c static inline int mem_sharing_control(struct domain *d, bool enable) · line 1648
Quoted 6 lines
xen/arch/x86/mm/mem_sharing.c +6
-0+ + new_mfn =page_to_mfn (page); +set_gpfn_from_mfn (mfn_x (new_mfn), value); + +return p2m->set_entry (p2m,_gfn (value), new_mfn,PAGE_ORDER_4K , + p2m_ram_rw, p2m->default_access,-1 );I think you also need to copy the contents from the parent page here.
Quoted 5 lines
The toolstack simply clears these pages during restore so I'm not sure
(see https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/libxc/xc_sr_restore_x86_hvm.c;h=3f78248f32fec239db77b0e483b0195211e6b974;hb=HEAD#l61).
I don't see why you would have to clear the pages first if they get
overwritten by saved versions later. Or these pages are expected to be
torn-down by the save/restore aware guests?Guests using those pages know they are torn down during suspend/resume and expect to find a clean state when resuming. That's not the case with forking however, as the guest is completely unaware of the fork happening.
One thing I'm not sure of is whether the backends (xenstored, xenconsoled) will cope with those pages being already populated on guest creation.
Quoted 7 lines
Quoted 4 lines
AFAICT another issue is that xenstore watches are not copied over from the parent, so any watches the parent might have set will not fire on the child. That would require some kind of interaction with xenstored in order to request a guest state to be copied over to another guest.
Sounds like it most likely would need to be handled if the guest uses them. I'm not sure if a default Linux HVM guest uses them though.
Linux PVHVM does use xenstore watches to monitor backend state changes, but it would require a non-trivial amount of work to clone the state of PV devices, so I guess it's something to be left as a TODO item.
Quoted 5 lines
A
Windows HVM guest without the PV drivers is certainly not Xen aware so there things already work just fine and that is our primary target for our use-case. PVHVM/PVH Linux guests are not. So that's really outside the scope of what I can contribute at the moment.
Quoted 7 lines
Sure.
Can you please add a TODO item here to note that the contents of those special pages likely need to be copied over, and that the state of PV devices and interfaces that rely on backends running in userspace is not handled at all.
Of course. I will finish up the PV timer parts and copying the shared info page, but will leave the rest as TODO. Hopefully this will get at least a default Linux HVM fork working the same way as Windows does, but if not then I'll unfortunately have to leave it as-is for now.
Tamas
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v10 1/3] xen/mem_sharing: VM forking
Quoted 87 lines · Tamas K Lengyel
Quoted 77 lines · Roger Pau Monné
Quoted 56 lines · Tamas K Lengyel
Quoted 55 lines · Roger Pau Monné
Quoted 38 lines · Tamas K Lengyel
Quoted 7 lines
Quoted 7 lines
(quoted diff) +7
-0+static int populate_special_pages(struct domain *cd) +{ + struct p2m_domain *p2m = p2m_get_hostp2m(cd); + static const unsigned int params[] = + { + HVM_PARAM_STORE_PFN, + HVM_PARAM_IOREQ_PFN,Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ HVM_PARAM_BUFIOREQ_PFN, + HVM_PARAM_CONSOLE_PFN + }; + unsigned int i; + + for ( i=0; i<4; i++ )Nit: can you please add some spaces around the operators?
Sure.
Quoted 11 lines
Quoted 11 lines
(quoted diff) +10
-0+ { + uint64_t value = 0; + mfn_t new_mfn; + struct page_info *page; + + if ( hvm_get_param(cd, params[i], &value) || !value ) + continue; + + if ( !(page = alloc_domheap_page(cd, 0)) ) + return -ENOMEM;Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ + new_mfn = page_to_mfn(page); + set_gpfn_from_mfn(mfn_x(new_mfn), value); + + return p2m->set_entry(p2m, _gfn(value), new_mfn, PAGE_ORDER_4K, + p2m_ram_rw, p2m->default_access, -1);I think you also need to copy the contents from the parent page here.
Quoted 5 lines
The toolstack simply clears these pages during restore so I'm not sure
(see https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/libxc/xc_sr_restore_x86_hvm.c;h=3f78248f32fec239db77b0e483b0195211e6b974;hb=HEAD#l61).
I don't see why you would have to clear the pages first if they get
overwritten by saved versions later. Or these pages are expected to be
torn-down by the save/restore aware guests?Guests using those pages know they are torn down during suspend/resume and expect to find a clean state when resuming. That's not the case with forking however, as the guest is completely unaware of the fork happening.
One thing I'm not sure of is whether the backends (xenstored, xenconsoled) will cope with those pages being already populated on guest creation.
Quoted 7 lines
Quoted 4 lines
AFAICT another issue is that xenstore watches are not copied over from the parent, so any watches the parent might have set will not fire on the child. That would require some kind of interaction with xenstored in order to request a guest state to be copied over to another guest.
Sounds like it most likely would need to be handled if the guest uses them. I'm not sure if a default Linux HVM guest uses them though.
Linux PVHVM does use xenstore watches to monitor backend state changes, but it would require a non-trivial amount of work to clone the state of PV devices, so I guess it's something to be left as a TODO item.
Quoted 5 lines
A
Windows HVM guest without the PV drivers is certainly not Xen aware so there things already work just fine and that is our primary target for our use-case. PVHVM/PVH Linux guests are not. So that's really outside the scope of what I can contribute at the moment.Quoted 7 lines
Sure.
Can you please add a TODO item here to note that the contents of those special pages likely need to be copied over, and that the state of PV devices and interfaces that rely on backends running in userspace is not handled at all.
Quoted 5 lines
Of course. I will finish up the PV timer parts and copying the shared info page, but will leave the rest as TODO. Hopefully this will get at least a default Linux HVM fork working the same way as Windows does, but if not then I'll unfortunately have to leave it as-is for now.
Unfortunately Linux's VNC console is still only responsive if the parent was just restored from a save file. There must be some other pieces missing here but I'm just going to document it as a TODO as it's really outside our scope.
Tamas
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel