Add code to track the address of the VM generation id buffer across a
PATCH 1/1 Add code to track the address of the VM generation id buffer across a
# HG changeset patch
# User Paul Durrant <[email protected]>
# Date 1322686267 0
# Node ID 94a17182f386c8bb414eba55dddf763b8982c76d
# Parent 3c4c29899d8a2a0c0f9109b7236da95bb72b77b6
Add code to track the address of the VM generation id buffer across a save/restore or migrate and inject a new value.
The address of the buffer is written into xenstore by hvmloader at boot time. It must be read from xenstore by the caller of xc_domain_save() and then written back again by the caller of xc_domain_restore().
tools/libxc/ia64/xc_ia64_linux_restore.c +2 -1
@@ -548,7 +548,8 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned int store_evtchn, unsigned long *store_mfn, unsigned int console_evtchn, unsigned long *console_mfn, - unsigned int hvm, unsigned int pae, int superpages) + unsigned int hvm, unsigned int pae, int superpages, + uint64_t gid) {DECLARE_DOMCTL ;int rc =1 ;
tools/libxc/ia64/xc_ia64_linux_save.c +2 -1
@@ -382,7 +382,8 @@ out:int xc_domain_save (xc_interface *xch,int io_fd,uint32_t dom,uint32_t max_iters,uint32_t max_factor,uint32_t flags, -struct save_callbacks * callbacks,int hvm) +struct save_callbacks * callbacks,int hvm, +unsigned long vm_gid_addr) {DECLARE_DOMCTL ;xc_dominfo_t info;
tools/libxc/xc_domain_restore.c +41 -1
66 lines not on this page · raw message
tools/libxc/xc_domain_save.c +12 -1
@@ -754,7 +754,8 @@ static int save_tsc_info(xc_interface *xint xc_domain_save (xc_interface *xch,int io_fd,uint32_t dom,uint32_t max_iters,uint32_t max_factor,uint32_t flags, -struct save_callbacks * callbacks,int hvm) +struct save_callbacks * callbacks,int hvm, +unsigned long vm_gid_addr) {xc_dominfo_t info;DECLARE_DOMCTL ;
@@ -1460,6 +1461,16 @@ int xc_domain_save(xc_interface *xch, inuint64_t data; } chunk = { 0, }; + chunk.id =XC_SAVE_ID_HVM_GENERATION_ID_ADDR ; + chunk.data = vm_gid_addr; + +if ( (chunk.data !=0 ) && +wrexact (io_fd, &chunk,sizeof (chunk)) ) + { +PERROR ("Error when writing the generation id buffer location for guest" ); + goto out; + } + chunk.id =XC_SAVE_ID_HVM_IDENT_PT ; chunk.data =0 ; xc_get_hvm_param(xch, dom, HVM_PARAM_IDENT_PT,
tools/libxc/xenguest.h +6 -2
@@ -57,7 +57,8 @@ struct save_callbacks {*/ int xc_domain_save (xc_interface *xch,int io_fd,uint32_t dom,uint32_t max_iters,uint32_t max_factor,uint32_t flags/* XCFLAGS_xxx */ , -struct save_callbacks * callbacks,int hvm); +struct save_callbacks * callbacks,int hvm, +unsigned long vm_gid_addr);/**
@@ -71,12 +72,15 @@ int xc_domain_save(xc_interface *xch, in* @parm hvm non-zero if this is a HVM restore * @parm pae non-zero if this HVM domain has PAE support enabled * @parm superpages non-zero to allocate guest memory with superpages +* @parm gid the new generation id of the VM +* @parm vm_gid_addr returned with the address of the generation id buffer * @return 0 on success, -1 on failure */ int xc_domain_restore (xc_interface *xch,int io_fd,uint32_t dom,unsigned int store_evtchn,unsigned long *store_mfn,unsigned int console_evtchn,unsigned long *console_mfn, -unsigned int hvm,unsigned int pae,int superpages); +unsigned int hvm,unsigned int pae,int superpages, +uint64_t gid,unsigned long *vm_gid_addr);/** * xc_domain_restore writes a file to disk that contains the device * model saved state.
tools/libxc/xg_save_restore.h +1 -0
@@ -135,6 +135,7 @@#define XC_SAVE_ID_LAST_CHECKPOINT -9/* Commit to restoring after completion of current iteration. */ #define XC_SAVE_ID_HVM_ACPI_IOPORTS_LOCATION -10#define XC_SAVE_ID_HVM_VIRIDIAN -11 +#define XC_SAVE_ID_HVM_GENERATION_ID_ADDR -12/* ** We process save/restore/migrate in batches of pages; the below
tools/libxl/libxl_create.c +4 -1
@@ -101,6 +101,7 @@ int libxl_init_build_info(libxl_ctx *ctx b_info->u.hvm.vpt_align =1 ; b_info->u.hvm.timer_mode =1 ; b_info->u.hvm.nested_hvm =0 ; + b_info->u.hvm.generation_id =0 ;break ;case LIBXL_DOMAIN_TYPE_PV : b_info->u.pv.slack_memkb =8 *1024 ;
@@ -191,13 +192,15 @@ int libxl__domain_build(libxl__gc *gc, vments[4 ] ="start_time" ; vments[5 ] =libxl__sprintf (gc,"%lu.%02d" , start_time.tv_sec,(int )start_time.tv_usec/10000 ); - localents =libxl__calloc (gc,7 ,sizeof (char *)); + localents =libxl__calloc (gc,9 ,sizeof (char *)); localents[0 ] ="platform/acpi" ; localents[1 ] = (info->u.hvm.acpi) ?"1" :"0" ; localents[2 ] ="platform/acpi_s3" ; localents[3 ] = (info->u.hvm.acpi_s3) ?"1" :"0" ; localents[4 ] ="platform/acpi_s4" ; localents[5 ] = (info->u.hvm.acpi_s4) ?"1" :"0" ; + localents[6 ] ="platform/generation_id" ; + localents[7 ] =libxl__sprintf (gc,"0x%llx" , info->u.hvm.generation_id);break ;case LIBXL_DOMAIN_TYPE_PV :
tools/libxl/libxl_dom.c +22 -6
@@ -125,7 +125,7 @@ int libxl__build_post(libxl__gc *gc, uinif (info->cpuid !=NULL )libxl_cpuid_set (ctx, domid, info->cpuid); - ents =libxl__calloc (gc,12 + (info->max_vcpus *2 ) +2 ,sizeof (char *)); + ents =libxl__calloc (gc,14 + (info->max_vcpus *2 ) +2 ,sizeof (char *)); ents[0 ] ="memory/static-max" ; ents[1 ] =libxl__sprintf (gc,"%d" , info->max_memkb); ents[2 ] ="memory/target" ;
@@ -138,9 +138,11 @@ int libxl__build_post(libxl__gc *gc, uin ents[9 ] =libxl__sprintf (gc,"%" PRIu32, state->store_port); ents[10 ] ="store/ring-ref" ; ents[11 ] =libxl__sprintf (gc,"%lu" , state->store_mfn); + ents[12 ] ="data/generation-id" ; + ents[13 ] =libxl__sprintf (gc,"0x%lx" , state->vm_gid_addr);for (i =0 ; i < info->max_vcpus; i++) { - ents[12 +(i*2 )] =libxl__sprintf (gc,"cpu/%d/availability" , i); - ents[12 +(i*2 )+1 ] = (i && info->cur_vcpus && !(info->cur_vcpus & (1 << i))) + ents[14 +(i*2 )] =libxl__sprintf (gc,"cpu/%d/availability" , i); + ents[14 +(i*2 )+1 ] = (i && info->cur_vcpus && !(info->cur_vcpus & (1 << i))) ?"offline" :"online" ; }
@@ -357,16 +359,19 @@ int libxl__domain_restore_common(libxl__/* read signature */ int rc;int hvm, pae, superpages; +uint64_t gid;switch (info->type) {case LIBXL_DOMAIN_TYPE_HVM : hvm =1 ; superpages =1 ; pae = info->u.hvm.pae; + gid = info->u.hvm.generation_id;break ;case LIBXL_DOMAIN_TYPE_PV : hvm =0 ; superpages =0 ; pae =1 ; + gid =0 ;break ;default :return ERROR_INVAL ;
@@ -374,7 +379,7 @@ int libxl__domain_restore_common(libxl__ rc =xc_domain_restore (ctx->xch, fd, domid, state->store_port, &state->store_mfn, state->console_port, &state->console_mfn, - hvm, pae, superpages); + hvm, pae, superpages, gid, &state->vm_gid_addr);if ( rc ) {LIBXL__LOG_ERRNO (ctx,LIBXL__LOG_ERROR ,"restoring domain" );return ERROR_FAIL ;
@@ -540,12 +545,22 @@ int libxl__domain_suspend_common(libxl__struct save_callbacks callbacks;struct suspendinfo si;int hvm, rc =ERROR_FAIL ; +unsigned long vm_gid_addr;switch (type) { -case LIBXL_DOMAIN_TYPE_HVM : +case LIBXL_DOMAIN_TYPE_HVM : { +char *path; +char *addr; + + path =libxl__sprintf (gc,"%s/data/generation-id" ,libxl__xs_get_dompath (gc, domid)); + addr =libxl__xs_read (gc,XBT_NULL , path); + + vm_gid_addr = (addr) ?strtoul (addr,NULL ,0 ) :0 ; hvm =1 ;break ; + }case LIBXL_DOMAIN_TYPE_PV : + vm_gid_addr =0 ; hvm =0 ;break ;default :
@@ -583,7 +598,8 @@ int libxl__domain_suspend_common(libxl__ callbacks.switch_qemu_logdirty = libxl__domain_suspend_common_switch_qemu_logdirty; callbacks.data = &si; - rc =xc_domain_save (ctx->xch, fd, domid,0 ,0 , flags, &callbacks, hvm); + rc =xc_domain_save (ctx->xch, fd, domid,0 ,0 , flags, &callbacks, + hvm, vm_gid_addr);if ( rc ) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "saving domain: %s", si.guest_responded ?
tools/libxl/libxl_internal.h +2 -0
@@ -199,6 +199,8 @@ typedef struct {uint32_t console_port;unsigned long console_mfn; + +unsigned long vm_gid_addr; } libxl__domain_build_state; _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid,
tools/libxl/libxl_types.idl +1 -0
@@ -183,6 +183,7 @@ libxl_domain_build_info = Struct("domain ("vpt_align", bool), ("timer_mode", integer), ("nested_hvm", bool), + ("generation_id", uint64), ])), ("pv", Struct(None, [("kernel", libxl_file_reference), ("slack_memkb", uint32),
tools/libxl/libxlu_cfg.c +31 -0
@@ -235,6 +235,37 @@ int xlu_cfg_get_long(const XLU_Config *creturn 0 ; } +int xlu_cfg_get_long_long (const XLU_Config *cfg,const char *n, +long long *value_r,int dont_warn) { +long long ll; +XLU_ConfigSetting *set; +int e; +char *ep; + + e=find_atom (cfg,n,&set,dont_warn);if (e)return e; + errno=0 ; ll=strtoll (set->values[0 ], &ep,0 ); + e= errno; +if (errno) { + e= errno; +assert (e==EINVAL || e==ERANGE ); +if (!dont_warn) +fprintf (cfg->report, +"%s:%d: warning: parameter `%s' could not be parsed" +" as a number: %s\n" , + cfg->filename, set->lineno, n,strerror (e)); +return e; + } +if (*ep || ep==set->values[0 ]) { +if (!dont_warn) +fprintf (cfg->report, +"%s:%d: warning: parameter `%s' is not a valid number\n" , + cfg->filename, set->lineno, n); +return EINVAL ; + } + *value_r= ll; +return 0 ; +} +int xlu_cfg_get_list (const XLU_Config *cfg,const char *n,XLU_ConfigList **list_r,int *entries_r,int dont_warn) {
tools/libxl/libxlutil.h +2 -0
@@ -52,6 +52,8 @@ int xlu_cfg_replace_string(const XLU_Con char **value_r, int dont_warn);int xlu_cfg_get_long (const XLU_Config *,const char *n,long *value_r,int dont_warn); +int xlu_cfg_get_long_long (const XLU_Config *,const char *n,long long *value_r, +int dont_warn); int xlu_cfg_get_list(const XLU_Config*, const char *n, XLU_ConfigList **list_r /* may be 0 */,
tools/libxl/xl_cmdimpl.c +3 -0
@@ -573,6 +573,7 @@ static void parse_config_data(const char {const char *buf;long l; +long long ll;XLU_Config *config;XLU_ConfigList *vbds, *nics, *pcis, *cvfbs, *cpuids;int pci_power_mgmt =0 ;
@@ -764,6 +765,8 @@ static void parse_config_data(const char b_info->u.hvm.timer_mode = l;if (!xlu_cfg_get_long (config,"nestedhvm" , &l,0 )) b_info->u.hvm.nested_hvm = l; +if (!xlu_cfg_get_long_long (config,"generation_id" , &ll,0 )) + b_info->u.hvm.nested_hvm = ll;break ;case LIBXL_DOMAIN_TYPE_PV : {
tools/python/xen/lowlevel/checkpoint/libcheckpoint.c +13 -1
@@ -174,6 +174,7 @@ int checkpoint_start(checkpoint_state* s {int hvm, rc;int flags =XCFLAGS_LIVE ; +unsigned long vm_gid_addr;if (!s->domid) { s->errstr ="checkpoint state not opened" ;
@@ -184,14 +185,25 @@ int checkpoint_start(checkpoint_state* s hvm = s->domtype > dt_pv;if (hvm) { +char path[128 ]; +char *addr; + +sprintf (path,"/local/domain/%u/data/generation-id" , s->domid); + addr =xs_read (s->xsh,XBT_NULL , path,NULL ); + + vm_gid_addr = (addr) ?strtoul (addr,NULL ,0 ) :0 ; +free (addr); + flags |=XCFLAGS_HVM ;if (switch_qemu_logdirty (s,1 ))return -1 ; + }else { + vm_gid_addr =0 ; } callbacks->switch_qemu_logdirty = noop_switch_logdirty; - rc =xc_domain_save (s->xch, fd, s->domid,0 ,0 , flags, callbacks, hvm); + rc =xc_domain_save (s->xch, fd, s->domid,0 ,0 , flags, callbacks, hvm, vm_gid_addr);if (hvm)switch_qemu_logdirty (s,0 );
tools/xcutils/xc_restore.c +10 -3
@@ -23,7 +23,8 @@ main(int argc, char **argv)xc_interface *xch;int io_fd, ret;int superpages; -unsigned long store_mfn, console_mfn; +unsigned long store_mfn, console_mfn, vm_gid_addr; +uint64_t gid;if ( (argc !=8 ) && (argc !=9 ) ) errx(1, "usage: %s iofd domid store_evtchn "
@@ -40,19 +41,25 @@ main(int argc, char **argv) hvm =atoi (argv[5 ]); pae =atoi (argv[6 ]); apic =atoi (argv[7 ]); -if ( argc ==9 ) +if ( argc >=9 ) superpages =atoi (argv[8 ]);else superpages = !!hvm; +if ( argc >=10 ) + gid =strtoll (argv[9 ],NULL ,0 ); +else + gid =0 ; ret =xc_domain_restore (xch, io_fd, domid, store_evtchn, &store_mfn, - console_evtchn, &console_mfn, hvm, pae, superpages); + console_evtchn, &console_mfn, hvm, pae, superpages, + gid, &vm_gid_addr);if ( ret ==0 ) {printf ("store-mfn %li\n" , store_mfn);if ( !hvm )printf ("console-mfn %li\n" , console_mfn); +printf ("vm-gid-addr %lx\n" , vm_gid_addr);fflush (stdout); }
tools/xcutils/xc_save.c +18 -1
@@ -169,6 +169,10 @@ main(int argc, char **argv)unsigned int maxit, max_f;int io_fd, ret, port;struct save_callbacks callbacks; +char path[128 ]; +struct xs_handle *xs; +char *addr; +unsigned long vm_gid_addr;if (argc !=6 )errx (1 ,"usage: %s iofd domid maxit maxf flags" , argv[0 ]);
@@ -207,8 +211,21 @@ main(int argc, char **argv)memset (&callbacks,0 ,sizeof (callbacks)); callbacks.suspend = suspend; callbacks.switch_qemu_logdirty = switch_qemu_logdirty; + +sprintf (path,"/local/domain/%d/data/generation-id" , si.domid); + +if ((xs =xs_daemon_open ()) ==NULL ) +errx (1 ,"Couldn't contact xenstore" ); + + addr =xs_read (xs,XBT_NULL , path,NULL ); + +xs_daemon_close (xs); + + vm_gid_addr = (addr) ?strtoul (addr,NULL ,0 ) :0 ; +free (addr); + ret =xc_domain_save (si.xch, io_fd, si.domid, maxit, max_f, si.flags, - &callbacks, !!(si.flags &XCFLAGS_HVM )); + &callbacks, !!(si.flags &XCFLAGS_HVM ), vm_gid_addr);if (si.suspend_evtchn >0 )xc_suspend_evtchn_release (si.xch, si.xce, si.domid, si.suspend_evtchn);
Quoted 7 lines · Paul Durrant
# HG changeset patch
# User Paul Durrant <[email protected]>
# Date 1322686267 0
# Node ID94a17182f386c8bb414eba55dddf763b8982c76d
# Parent3c4c29899d8a2a0c0f9109b7236da95bb72b77b6
Add code to track the address of the VM generation id buffer across a save/restore or migrate and inject a new value.
So what is a generation id? What is the use-case for this?
Quoted 511 lines
The address of the buffer is written into xenstore by hvmloader at boot time. It must be read from xenstore by the caller of
xc_domain_save()and then written back again by the caller ofxc_domain_restore().Signed-off-by Paul Durrant <[email protected]>diff -r
3c4c29899d8a-r94a17182f386tools/libxc/ia64/xc_ia64_linux_restore.ctools/libxc/ia64/xc_ia64_linux_restore.c +2
-1@@ -548,7 +548,8 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned int store_evtchn, unsigned long *store_mfn, unsigned int console_evtchn, unsigned long *console_mfn, - unsigned int hvm, unsigned int pae, int superpages) + unsigned int hvm, unsigned int pae, int superpages, + uint64_t gid) {DECLARE_DOMCTL ;int rc =1 ;diff -r
3c4c29899d8a-r94a17182f386tools/libxc/ia64/xc_ia64_linux_save.ctools/libxc/ia64/xc_ia64_linux_save.c +2
-1@@ -382,7 +382,8 @@ out:int xc_domain_save (xc_interface *xch,int io_fd,uint32_t dom,uint32_t max_iters,uint32_t max_factor,uint32_t flags, -struct save_callbacks * callbacks,int hvm) +struct save_callbacks * callbacks,int hvm, +unsigned long vm_gid_addr) {DECLARE_DOMCTL ;xc_dominfo_t info;diff -r
3c4c29899d8a-r94a17182f386tools/libxc/xc_domain_restore.ctools/libxc/xc_domain_restore.c +41
-1@@ -676,6 +676,7 @@ typedef struct {uint64_t console_pfn;uint64_t acpi_ioport_location;uint64_t viridian; +uint64_t vm_gid_addr; } pagebuf_t;static int pagebuf_init (pagebuf_t * buf)@@ -820,6 +821,17 @@ static int pagebuf_get_one(xc_interface }return pagebuf_get_one (xch, ctx, buf, fd, dom); +case XC_SAVE_ID_HVM_GENERATION_ID_ADDR : +/* Skip padding 4 bytes then read the generation id buffer location. */ +if (RDEXACT (fd, &buf->vm_gid_addr,sizeof (uint32_t )) || +RDEXACT (fd, &buf->vm_gid_addr,sizeof (uint64_t )) ) + { +PERROR ("error read the generation id buffer location" ); +return -1 ; + } +DPRINTF ("read generation id buffer address" ); +return pagebuf_get_one (xch, ctx, buf, fd, dom); +default :if ( (count >MAX_BATCH_SIZE ) || (count <0 ) ) {ERROR ("Max batch size exceeded (%d). Giving up." , count);@@ -1186,7 +1198,8 @@ static int apply_batch(xc_interface *xchint xc_domain_restore (xc_interface *xch,int io_fd,uint32_t dom,unsigned int store_evtchn,unsigned long *store_mfn,unsigned int console_evtchn,unsigned long *console_mfn, -unsigned int hvm,unsigned int pae,int superpages) +unsigned int hvm,unsigned int pae,int superpages, +uint64_t gid,unsigned long *vm_gid_addr) {DECLARE_DOMCTL ;int rc =1 , frc, i, j, n, m, pae_extended_cr3 =0 , ext_vcpucontext =0 ;@@ -1386,6 +1399,33 @@ int xc_domain_restore(xc_interface *xch,xc_set_hvm_param (xch, dom,HVM_PARAM_VM86_TSS , pagebuf.vm86_tss);if ( pagebuf.console_pfn ) console_pfn = pagebuf.console_pfn; +if ( pagebuf.vm_gid_addr ) { +unsigned int offset; +unsigned char *buf; + +/* +* Map the VM generation id buffer and inject the new value. +*/ + + pfn = pagebuf.vm_gid_addr >>PAGE_SHIFT ; + offset = pagebuf.vm_gid_addr & (PAGE_SIZE -1 ); + +if ( (pfn >= dinfo->p2m_size) || + (pfn_type[pfn] !=XEN_DOMCTL_PFINFO_NOTAB ) ) + { +ERROR ("generation id buffer frame is bad" ); + goto out; + } + + mfn = ctx->p2m[pfn]; + buf =xc_map_foreign_range (xch, dom,PAGE_SIZE , +PROT_READ |PROT_WRITE , mfn); + *(unsigned long long *)(buf + offset) = gid; +munmap (buf,PAGE_SIZE ); + + *vm_gid_addr = pagebuf.vm_gid_addr; + } +break ;/* our work here is done */ }diff -r
3c4c29899d8a-r94a17182f386tools/libxc/xc_domain_save.ctools/libxc/xc_domain_save.c +12
-1@@ -754,7 +754,8 @@ static int save_tsc_info(xc_interface *xint xc_domain_save (xc_interface *xch,int io_fd,uint32_t dom,uint32_t max_iters,uint32_t max_factor,uint32_t flags, -struct save_callbacks * callbacks,int hvm) +struct save_callbacks * callbacks,int hvm, +unsigned long vm_gid_addr) {xc_dominfo_t info;DECLARE_DOMCTL ;@@ -1460,6 +1461,16 @@ int xc_domain_save(xc_interface *xch, inuint64_t data; } chunk = { 0, }; + chunk.id =XC_SAVE_ID_HVM_GENERATION_ID_ADDR ; + chunk.data = vm_gid_addr; + +if ( (chunk.data !=0 ) && +wrexact (io_fd, &chunk,sizeof (chunk)) ) + { +PERROR ("Error when writing the generation id buffer location for guest" ); + goto out; + } + chunk.id =XC_SAVE_ID_HVM_IDENT_PT ; chunk.data =0 ; xc_get_hvm_param(xch, dom, HVM_PARAM_IDENT_PT,diff -r
3c4c29899d8a-r94a17182f386tools/libxc/xenguest.htools/libxc/xenguest.h +6
-2@@ -57,7 +57,8 @@ struct save_callbacks {*/ int xc_domain_save (xc_interface *xch,int io_fd,uint32_t dom,uint32_t max_iters,uint32_t max_factor,uint32_t flags/* XCFLAGS_xxx */ , -struct save_callbacks * callbacks,int hvm); +struct save_callbacks * callbacks,int hvm, +unsigned long vm_gid_addr);/** @@ -71,12 +72,15 @@ int xc_domain_save(xc_interface *xch, in* @parm hvm non-zero if this is a HVM restore * @parm pae non-zero if this HVM domain has PAE support enabled * @parm superpages non-zero to allocate guest memory with superpages +* @parm gid the new generation id of the VM +* @parm vm_gid_addr returned with the address of the generation id buffer * @return 0 on success, -1 on failure */ int xc_domain_restore (xc_interface *xch,int io_fd,uint32_t dom,unsigned int store_evtchn,unsigned long *store_mfn,unsigned int console_evtchn,unsigned long *console_mfn, -unsigned int hvm,unsigned int pae,int superpages); +unsigned int hvm,unsigned int pae,int superpages, +uint64_t gid,unsigned long *vm_gid_addr);/** * xc_domain_restore writes a file to disk that contains the device * model saved state. diff -r
3c4c29899d8a-r94a17182f386tools/libxc/xg_save_restore.htools/libxc/xg_save_restore.h +1
-0@@ -135,6 +135,7 @@#define XC_SAVE_ID_LAST_CHECKPOINT -9/* Commit to restoring after completion of current iteration. */ #define XC_SAVE_ID_HVM_ACPI_IOPORTS_LOCATION -10#define XC_SAVE_ID_HVM_VIRIDIAN -11 +#define XC_SAVE_ID_HVM_GENERATION_ID_ADDR -12/* ** We process save/restore/migrate in batches of pages; the below diff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxl_create.ctools/libxl/libxl_create.c +4
-1@@ -101,6 +101,7 @@ int libxl_init_build_info(libxl_ctx *ctx b_info->u.hvm.vpt_align =1 ; b_info->u.hvm.timer_mode =1 ; b_info->u.hvm.nested_hvm =0 ; + b_info->u.hvm.generation_id =0 ;break ;case LIBXL_DOMAIN_TYPE_PV : b_info->u.pv.slack_memkb =8 *1024 ;@@ -191,13 +192,15 @@ int libxl__domain_build(libxl__gc *gc, vments[4 ] ="start_time" ; vments[5 ] =libxl__sprintf (gc,"%lu.%02d" , start_time.tv_sec,(int )start_time.tv_usec/10000 ); - localents =libxl__calloc (gc,7 ,sizeof (char *)); + localents =libxl__calloc (gc,9 ,sizeof (char *)); localents[0 ] ="platform/acpi" ; localents[1 ] = (info->u.hvm.acpi) ?"1" :"0" ; localents[2 ] ="platform/acpi_s3" ; localents[3 ] = (info->u.hvm.acpi_s3) ?"1" :"0" ; localents[4 ] ="platform/acpi_s4" ; localents[5 ] = (info->u.hvm.acpi_s4) ?"1" :"0" ; + localents[6 ] ="platform/generation_id" ; + localents[7 ] =libxl__sprintf (gc,"0x%llx" , info->u.hvm.generation_id);break ;case LIBXL_DOMAIN_TYPE_PV :diff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxl_dom.ctools/libxl/libxl_dom.c +22
-6@@ -125,7 +125,7 @@ int libxl__build_post(libxl__gc *gc, uinif (info->cpuid !=NULL )libxl_cpuid_set (ctx, domid, info->cpuid); - ents =libxl__calloc (gc,12 + (info->max_vcpus *2 ) +2 ,sizeof (char *)); + ents =libxl__calloc (gc,14 + (info->max_vcpus *2 ) +2 ,sizeof (char *)); ents[0 ] ="memory/static-max" ; ents[1 ] =libxl__sprintf (gc,"%d" , info->max_memkb); ents[2 ] ="memory/target" ;@@ -138,9 +138,11 @@ int libxl__build_post(libxl__gc *gc, uin ents[9 ] =libxl__sprintf (gc,"%" PRIu32, state->store_port); ents[10 ] ="store/ring-ref" ; ents[11 ] =libxl__sprintf (gc,"%lu" , state->store_mfn); + ents[12 ] ="data/generation-id" ; + ents[13 ] =libxl__sprintf (gc,"0x%lx" , state->vm_gid_addr);for (i =0 ; i < info->max_vcpus; i++) { - ents[12 +(i*2 )] =libxl__sprintf (gc,"cpu/%d/availability" , i); - ents[12 +(i*2 )+1 ] = (i && info->cur_vcpus && !(info->cur_vcpus & (1 << i))) + ents[14 +(i*2 )] =libxl__sprintf (gc,"cpu/%d/availability" , i); + ents[14 +(i*2 )+1 ] = (i && info->cur_vcpus && !(info->cur_vcpus & (1 << i))) ?"offline" :"online" ; }@@ -357,16 +359,19 @@ int libxl__domain_restore_common(libxl__/* read signature */ int rc;int hvm, pae, superpages; +uint64_t gid;switch (info->type) {case LIBXL_DOMAIN_TYPE_HVM : hvm =1 ; superpages =1 ; pae = info->u.hvm.pae; + gid = info->u.hvm.generation_id;break ;case LIBXL_DOMAIN_TYPE_PV : hvm =0 ; superpages =0 ; pae =1 ; + gid =0 ;break ;default :return ERROR_INVAL ;@@ -374,7 +379,7 @@ int libxl__domain_restore_common(libxl__ rc =xc_domain_restore (ctx->xch, fd, domid, state->store_port, &state->store_mfn, state->console_port, &state->console_mfn, - hvm, pae, superpages); + hvm, pae, superpages, gid, &state->vm_gid_addr);if ( rc ) {LIBXL__LOG_ERRNO (ctx,LIBXL__LOG_ERROR ,"restoring domain" );return ERROR_FAIL ;@@ -540,12 +545,22 @@ int libxl__domain_suspend_common(libxl__struct save_callbacks callbacks;struct suspendinfo si;int hvm, rc =ERROR_FAIL ; +unsigned long vm_gid_addr;switch (type) { -case LIBXL_DOMAIN_TYPE_HVM : +case LIBXL_DOMAIN_TYPE_HVM : { +char *path; +char *addr; + + path =libxl__sprintf (gc,"%s/data/generation-id" ,libxl__xs_get_dompath (gc, domid)); + addr =libxl__xs_read (gc,XBT_NULL , path); + + vm_gid_addr = (addr) ?strtoul (addr,NULL ,0 ) :0 ; hvm =1 ;break ; + }case LIBXL_DOMAIN_TYPE_PV : + vm_gid_addr =0 ; hvm =0 ;break ;default :@@ -583,7 +598,8 @@ int libxl__domain_suspend_common(libxl__ callbacks.switch_qemu_logdirty = libxl__domain_suspend_common_switch_qemu_logdirty; callbacks.data = &si; - rc =xc_domain_save (ctx->xch, fd, domid,0 ,0 , flags, &callbacks, hvm); + rc =xc_domain_save (ctx->xch, fd, domid,0 ,0 , flags, &callbacks, + hvm, vm_gid_addr);if ( rc ) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "saving domain: %s", si.guest_responded ?diff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxl_internal.htools/libxl/libxl_internal.h +2
-0@@ -199,6 +199,8 @@ typedef struct {uint32_t console_port;unsigned long console_mfn; + +unsigned long vm_gid_addr; } libxl__domain_build_state; _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid,diff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxl_types.idltools/libxl/libxl_types.idl +1
-0@@ -183,6 +183,7 @@ libxl_domain_build_info = Struct("domain ("vpt_align", bool), ("timer_mode", integer), ("nested_hvm", bool), + ("generation_id", uint64), ])), ("pv", Struct(None, [("kernel", libxl_file_reference), ("slack_memkb", uint32),diff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxlu_cfg.ctools/libxl/libxlu_cfg.c +31
-0@@ -235,6 +235,37 @@ int xlu_cfg_get_long(const XLU_Config *creturn 0 ; } +int xlu_cfg_get_long_long (const XLU_Config *cfg,const char *n, +long long *value_r,int dont_warn) { +long long ll; +XLU_ConfigSetting *set; +int e; +char *ep; + + e=find_atom (cfg,n,&set,dont_warn);if (e)return e; + errno=0 ; ll=strtoll (set->values[0 ], &ep,0 ); + e= errno; +if (errno) { + e= errno; +assert (e==EINVAL || e==ERANGE ); +if (!dont_warn) +fprintf (cfg->report, +"%s:%d: warning: parameter `%s' could not be parsed" +" as a number: %s\n" , + cfg->filename, set->lineno, n,strerror (e)); +return e; + } +if (*ep || ep==set->values[0 ]) { +if (!dont_warn) +fprintf (cfg->report, +"%s:%d: warning: parameter `%s' is not a valid number\n" , + cfg->filename, set->lineno, n); +return EINVAL ; + } + *value_r= ll; +return 0 ; +} +int xlu_cfg_get_list (const XLU_Config *cfg,const char *n,XLU_ConfigList **list_r,int *entries_r,int dont_warn) {diff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxlutil.htools/libxl/libxlutil.h +2
-0@@ -52,6 +52,8 @@ int xlu_cfg_replace_string(const XLU_Con char **value_r, int dont_warn);int xlu_cfg_get_long (const XLU_Config *,const char *n,long *value_r,int dont_warn); +int xlu_cfg_get_long_long (const XLU_Config *,const char *n,long long *value_r, +int dont_warn); int xlu_cfg_get_list(const XLU_Config*, const char *n, XLU_ConfigList **list_r /* may be 0 */,diff -r
3c4c29899d8a-r94a17182f386tools/libxl/xl_cmdimpl.ctools/libxl/xl_cmdimpl.c +3
-0@@ -573,6 +573,7 @@ static void parse_config_data(const char {const char *buf;long l; +long long ll;XLU_Config *config;XLU_ConfigList *vbds, *nics, *pcis, *cvfbs, *cpuids;int pci_power_mgmt =0 ;@@ -764,6 +765,8 @@ static void parse_config_data(const char b_info->u.hvm.timer_mode = l;if (!xlu_cfg_get_long (config,"nestedhvm" , &l,0 )) b_info->u.hvm.nested_hvm = l; +if (!xlu_cfg_get_long_long (config,"generation_id" , &ll,0 )) + b_info->u.hvm.nested_hvm = ll;break ;case LIBXL_DOMAIN_TYPE_PV : {diff -r
3c4c29899d8a-r94a17182f386tools/python/xen/lowlevel/checkpoint/libcheckpoint.ctools/python/xen/lowlevel/checkpoint/libcheckpoint.c +13
-1@@ -174,6 +174,7 @@ int checkpoint_start(checkpoint_state* s {int hvm, rc;int flags =XCFLAGS_LIVE ; +unsigned long vm_gid_addr;if (!s->domid) { s->errstr ="checkpoint state not opened" ;@@ -184,14 +185,25 @@ int checkpoint_start(checkpoint_state* s hvm = s->domtype > dt_pv;if (hvm) { +char path[128 ]; +char *addr; + +sprintf (path,"/local/domain/%u/data/generation-id" , s->domid); + addr =xs_read (s->xsh,XBT_NULL , path,NULL ); + + vm_gid_addr = (addr) ?strtoul (addr,NULL ,0 ) :0 ; +free (addr); + flags |=XCFLAGS_HVM ;if (switch_qemu_logdirty (s,1 ))return -1 ; + }else { + vm_gid_addr =0 ; } callbacks->switch_qemu_logdirty = noop_switch_logdirty; - rc =xc_domain_save (s->xch, fd, s->domid,0 ,0 , flags, callbacks, hvm); + rc =xc_domain_save (s->xch, fd, s->domid,0 ,0 , flags, callbacks, hvm, vm_gid_addr);if (hvm)switch_qemu_logdirty (s,0 );diff -r
3c4c29899d8a-r94a17182f386tools/xcutils/xc_restore.ctools/xcutils/xc_restore.c +10
-3@@ -23,7 +23,8 @@ main(int argc, char **argv)xc_interface *xch;int io_fd, ret;int superpages; -unsigned long store_mfn, console_mfn; +unsigned long store_mfn, console_mfn, vm_gid_addr; +uint64_t gid;if ( (argc !=8 ) && (argc !=9 ) ) errx(1, "usage: %s iofd domid store_evtchn "@@ -40,19 +41,25 @@ main(int argc, char **argv) hvm =atoi (argv[5 ]); pae =atoi (argv[6 ]); apic =atoi (argv[7 ]); -if ( argc ==9 ) +if ( argc >=9 ) superpages =atoi (argv[8 ]);else superpages = !!hvm; +if ( argc >=10 ) + gid =strtoll (argv[9 ],NULL ,0 ); +else + gid =0 ; ret =xc_domain_restore (xch, io_fd, domid, store_evtchn, &store_mfn, - console_evtchn, &console_mfn, hvm, pae, superpages); + console_evtchn, &console_mfn, hvm, pae, superpages, + gid, &vm_gid_addr);if ( ret ==0 ) {printf ("store-mfn %li\n" , store_mfn);if ( !hvm )printf ("console-mfn %li\n" , console_mfn); +printf ("vm-gid-addr %lx\n" , vm_gid_addr);fflush (stdout); }diff -r
3c4c29899d8a-r94a17182f386tools/xcutils/xc_save.ctools/xcutils/xc_save.c +18
-1@@ -169,6 +169,10 @@ main(int argc, char **argv)unsigned int maxit, max_f;int io_fd, ret, port;struct save_callbacks callbacks; +char path[128 ]; +struct xs_handle *xs; +char *addr; +unsigned long vm_gid_addr;if (argc !=6 )errx (1 ,"usage: %s iofd domid maxit maxf flags" , argv[0 ]);@@ -207,8 +211,21 @@ main(int argc, char **argv)memset (&callbacks,0 ,sizeof (callbacks)); callbacks.suspend = suspend; callbacks.switch_qemu_logdirty = switch_qemu_logdirty; + +sprintf (path,"/local/domain/%d/data/generation-id" , si.domid); + +if ((xs =xs_daemon_open ()) ==NULL ) +errx (1 ,"Couldn't contact xenstore" ); + + addr =xs_read (xs,XBT_NULL , path,NULL ); + +xs_daemon_close (xs); + + vm_gid_addr = (addr) ?strtoul (addr,NULL ,0 ) :0 ; +free (addr); + ret =xc_domain_save (si.xch, io_fd, si.domid, maxit, max_f, si.flags, - &callbacks, !!(si.flags &XCFLAGS_HVM )); + &callbacks, !!(si.flags &XCFLAGS_HVM ), vm_gid_addr);if (si.suspend_evtchn >0 )xc_suspend_evtchn_release (si.xch, si.xce, si.domid, si.suspend_evtchn);_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Konrad,
Did you see my previous patch set? The introductory comment was:
-----
The following is a revised patch series to add support for a VM generation ID virtual device for HVM guests. The basic requirements of this device are as follows:
- It must be exposed somewhere in ACPI namespace with a _CID of "VM_Gen_Counter".
- It must also include a _DDN of "VM_Gen_Counter".
- It must contain a _HID object but no particular value is required.
- It must expose a package called ADDR which evaluates to two integers; the first being the low order 32-bits of a guest physical address (GPA), the second by the high order 32-bits of the GPA. This GPA is the address of an 8-byte aligned 8-byte buffer containing the VM generation ID.
This buffer must not be in ranges supported as AddressRangeMemory or AddressRangeACPI and must not be mapped by any PTE with caching disabled.
The semantics of the VM generation ID itself are left up to the tools but it must be possible to change it each time the VM is booted, migrated, or restored from a saved image.
-----
Does that help?
Paul
Quoted 620 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 30 November 2011 22:14
To: Paul Durrant
Cc: [email protected]
Subject: Re: [Xen-devel] [PATCH] Add code to track the address of the VM generation id buffer across aQuoted 2 lines · Paul Durrant
# HG changeset patch
# User Paul Durrant <[email protected]> # Date 1322686267 0#
Quoted 3 lines
Node ID
94a17182f386c8bb414eba55dddf763b8982c76d
# Parent3c4c29899d8a2a0c0f9109b7236da95bb72b77b6Add code to track the address of the VM generation id bufferacross a
Quoted 1 line
save/restore or migrate and inject a new value.
So what is a generation id? What is the use-case for this?
Quoted 8 lines
The address of the buffer is written into xenstore by hvmloader at boot time. It must be read from xenstore by the caller of
xc_domain_save()and then written back again by the caller ofxc_domain_restore().Signed-off-by Paul Durrant <[email protected]>diff -r
3c4c29899d8a-r94a17182f386
tools/libxc/ia64/xc_ia64_linux_restore.cQuoted 1 line
---
a/tools/libxc/ia64/xc_ia64_linux_restore.cWed Nov 3007:18:11 2011 -0800
Quoted 1 line
+++
b/tools/libxc/ia64/xc_ia64_linux_restore.cWed Nov 3020:51:07 2011 +0000
Review int · line 549
Quoted 3 lines
(quoted diff) +0
-0@@ -548,7 +548,8 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned int store_evtchn, unsigned long
*store_mfn,Review int · line 550
Quoted 1 line
(quoted diff) +0
-0unsigned int console_evtchn, unsigned long
*console_mfn,Review int · line 551
Quoted 1 line
(quoted diff) +0
-1- unsigned int hvm, unsigned int pae, intsuperpages)
Review int · line 551
Quoted 1 line
(quoted diff) +1
-0+ unsigned int hvm, unsigned int pae, intsuperpages,
Quoted 5 lines
tools/libxc/ia64/xc_ia64_linux_restore.c +1
-0+ uint64_t gid) {DECLARE_DOMCTL ;int rc =1 ;diff -r
3c4c29899d8a-r94a17182f386
tools/libxc/ia64/xc_ia64_linux_save.cQuoted 1 line
---
a/tools/libxc/ia64/xc_ia64_linux_save.cWed Nov 30 07:18:112011 -0800
Quoted 1 line
+++
b/tools/libxc/ia64/xc_ia64_linux_save.cWed Nov 30 20:51:072011 +0000
Review out: · line 383
Quoted 3 lines
(quoted diff) +0
-0@@ -382,7 +382,8 @@ out: int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom,
uint32_tmax_iters,Quoted 8 lines
tools/libxc/ia64/xc_ia64_linux_save.c +2
-1uint32_t max_factor, uint32_t flags, - struct save_callbacks* callbacks, int hvm) + struct save_callbacks* callbacks, int hvm, + unsigned long vm_gid_addr) {DECLARE_DOMCTL ;xc_dominfo_t info;diff -r
3c4c29899d8a-r94a17182f386
tools/libxc/xc_domain_restore.cQuoted 1 line
---
a/tools/libxc/xc_domain_restore.cWed Nov 30 07:18:11 2011 -0800
Quoted 1 line
+++
b/tools/libxc/xc_domain_restore.cWed Nov 30 20:51:07 2011+0000
tools/libxc/xc_domain_restore.c typedef struct { · line 682
Quoted 8 lines
tools/libxc/xc_domain_restore.c +1
-0@@ -676,6 +676,7 @@ typedef struct {uint64_t console_pfn;uint64_t acpi_ioport_location;uint64_t viridian; +uint64_t vm_gid_addr; } pagebuf_t; static int pagebuf_init(pagebuf_t* buf) @@ -820,6 +821,17 @@static
Review
Quoted 6 lines
int pagebuf_get_one(xc_interface
} return pagebuf_get_one(xch, ctx, buf, fd, dom);(quoted diff) +2
-0+ case XC_SAVE_ID_HVM_GENERATION_ID_ADDR: + /* Skip padding 4 bytes then read the generation idbuffer location. */
tools/libxc/xc_domain_restore.c static int pagebuf_get_one(xc_interface
Quoted 4 lines
tools/libxc/xc_domain_restore.c +4
-0+if (RDEXACT (fd, &buf->vm_gid_addr,sizeof (uint32_t )) || +RDEXACT (fd, &buf->vm_gid_addr,sizeof (uint64_t )) ) + { + PERROR("error read the generation id bufferlocation");
tools/libxc/xc_domain_restore.c static int pagebuf_get_one(xc_interface
Quoted 8 lines
tools/libxc/xc_domain_restore.c +5
-0+return -1 ; + } +DPRINTF ("read generation id buffer address" ); +return pagebuf_get_one (xch, ctx, buf, fd, dom); +default :if ( (count >MAX_BATCH_SIZE ) || (count <0 ) ) { ERROR("Max batch size exceeded (%d). Giving up.",count);
Review static int apply_batch(xc_interface *xch
Quoted 1 line
(quoted diff) +0
-0@@ -1186,7 +1198,8 @@ static int apply_batch(xc_interface *xchint
Review static int apply_batch(xc_interface *xch · line 1199
Quoted 2 lines
(quoted diff) +0
-0xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned int store_evtchn, unsigned long
*store_mfn,Review static int apply_batch(xc_interface *xch · line 1200
Quoted 1 line
(quoted diff) +0
-0unsigned int console_evtchn, unsigned long
*console_mfn,Review static int apply_batch(xc_interface *xch · line 1189
Quoted 1 line
(quoted diff) +0
-1- unsigned int hvm, unsigned int pae, intsuperpages)
Review static int apply_batch(xc_interface *xch · line 1201
Quoted 1 line
(quoted diff) +1
-0+ unsigned int hvm, unsigned int pae, intsuperpages,
Quoted 5 lines
tools/libxc/xc_domain_restore.c +1
-0+ uint64_t gid, unsigned long *vm_gid_addr) {DECLARE_DOMCTL ; int rc = 1, frc, i, j, n, m, pae_extended_cr3 = 0,
ext_vcpucontext= 0; @@ -1386,6 +1399,33 @@ intxc_domain_restore(xc_interface *xch,
Quoted 1 line
xc_set_hvm_param(xch, dom, HVM_PARAM_VM86_TSS,pagebuf.vm86_tss);
tools/libxc/xc_domain_restore.c int xc_domain_restore(xc_interface *xch,
Quoted 8 lines
if ( pagebuf.console_pfn )
console_pfn= pagebuf.console_pfn;tools/libxc/xc_domain_restore.c +6
-0+if ( pagebuf.vm_gid_addr ) { +unsigned int offset; +unsigned char *buf; + +/* +* Map the VM generation id buffer and inject the new value.
Quoted 5 lines
tools/libxc/xc_domain_restore.c +5
-0+*/ + + pfn = pagebuf.vm_gid_addr >>PAGE_SHIFT ; + offset = pagebuf.vm_gid_addr & (PAGE_SIZE -1 ); +tools/libxc/xc_domain_restore.c int xc_domain_restore(xc_interface *xch,
Quoted 10 lines
tools/libxc/xc_domain_restore.c +10
-0+if ( (pfn >= dinfo->p2m_size) || + (pfn_type[pfn] !=XEN_DOMCTL_PFINFO_NOTAB ) ) + { +ERROR ("generation id buffer frame is bad" ); + goto out; + } + + mfn = ctx->p2m[pfn]; + buf = xc_map_foreign_range(xch, dom, PAGE_SIZE, + PROT_READ |
PROT_WRITE, mfn);Quoted 11 lines
tools/libxc/xc_domain_restore.c +6
-0+ *(unsigned long long *)(buf + offset) = gid; +munmap (buf,PAGE_SIZE ); + + *vm_gid_addr = pagebuf.vm_gid_addr; + } +break ;/* our work here is done */ }diff -r
3c4c29899d8a-r94a17182f386tools/libxc/xc_domain_save.c---a/tools/libxc/xc_domain_save.cWed Nov 30 07:18:11 2011 -0800
Quoted 1 line
+++
b/tools/libxc/xc_domain_save.cWed Nov 30 20:51:07 2011+0000
Review static int save_tsc_info(xc_interface *x · line 755
Quoted 3 lines
(quoted diff) +0
-0@@ -754,7 +754,8 @@ static int save_tsc_info(xc_interface *x int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom,
uint32_tmax_iters,Quoted 8 lines
tools/libxc/xc_domain_save.c +2
-1uint32_t max_factor, uint32_t flags, - struct save_callbacks* callbacks, int hvm) + struct save_callbacks* callbacks, int hvm, + unsigned long vm_gid_addr) { xc_dominfo_t info;DECLARE_DOMCTL ;tools/libxc/xc_domain_save.c int xc_domain_save(xc_interface *xch, in · line 1470
Quoted 10 lines
tools/libxc/xc_domain_save.c +7
-0@@ -1460,6 +1461,16 @@ int xc_domain_save(xc_interface *xch, inuint64_t data; } chunk = { 0, }; + chunk.id =XC_SAVE_ID_HVM_GENERATION_ID_ADDR ; + chunk.data = vm_gid_addr; + +if ( (chunk.data !=0 ) && +wrexact (io_fd, &chunk,sizeof (chunk)) ) + { + PERROR("Error when writing the generation id bufferlocation for guest");
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 struct save_callbacks { · line 58
Quoted 12 lines
tools/libxc/xc_domain_save.c +3
-0+ goto out; + } + chunk.id =XC_SAVE_ID_HVM_IDENT_PT ; chunk.data =0 ; xc_get_hvm_param(xch, dom, HVM_PARAM_IDENT_PT, diff -r
3c4c29899d8a-r94a17182f386tools/libxc/xenguest.htools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +0
-0@@ -57,7 +57,8 @@ struct save_callbacks { */ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom,
uint32_tmax_iters,tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 struct save_callbacks { · line 59
Quoted 1 line
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +0
-0uint32_t max_factor, uint32_t flags /*
XCFLAGS_xxx*/,tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 74
Quoted 10 lines
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +2
-1- struct save_callbacks* callbacks, int hvm); + struct save_callbacks* callbacks, int hvm, + unsigned long vm_gid_addr); /**@@ -71,12 +72,15 @@ int xc_domain_save(xc_interface *xch, in * @parm hvm non-zero if this is a HVM restore * @parm pae non-zero if this HVM domain has PAE support enabled * @parm superpages non-zero to allocate guest memory withsuperpages
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 76
Quoted 2 lines
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +2
-0+ * @parm gid the new generation id of the VM + * @parm vm_gid_addr returned with the address of the generationid
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 81
Quoted 5 lines
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +1
-0+ buffer * @return 0 on success, -1 on failure */ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned int store_evtchn, unsigned long
*store_mfn,tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 82
Quoted 1 line
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +0
-0unsigned int console_evtchn, unsigned long
*console_mfn,tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 79
Quoted 1 line
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +0
-1- unsigned int hvm, unsigned int pae, intsuperpages);
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 83
Quoted 1 line
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +1
-0+ unsigned int hvm, unsigned int pae, intsuperpages,
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 86
Quoted 3 lines
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +1
-0+ uint64_t gid, unsigned long *vm_gid_addr); /** * xc_domain_restore writes a file to disk that contains thedevice
Quoted 3 lines
* model saved state.
diff -r3c4c29899d8a-r94a17182f386tools/libxc/xg_save_restore.h---a/tools/libxc/xg_save_restore.hWed Nov 30 07:18:11 2011 -0800
Quoted 1 line
+++
b/tools/libxc/xg_save_restore.hWed Nov 30 20:51:07 2011+0000
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 line 135
Quoted 2 lines
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +0
-0@@ -135,6 +135,7 @@ #define XC_SAVE_ID_LAST_CHECKPOINT -9 /* Commit to restoringafter completion of current iteration. */
Quoted 10 lines
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +1
-0#define XC_SAVE_ID_HVM_ACPI_IOPORTS_LOCATION -10 #define XC_SAVE_ID_HVM_VIRIDIAN -11 +#define XC_SAVE_ID_HVM_GENERATION_ID_ADDR -12 /* ** We process save/restore/migrate in batches of pages; the belowdiff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxl_create.ctools/libxl/libxl_create.c Wed Nov 30 20:51:07 2011 +0000 int libxl_init_build_info(libxl_ctx *ctx · line 107
Quoted 7 lines
tools/libxl/libxl_create.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_create.c Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -101,6 +101,7 @@ int libxl_init_build_info(libxl_ctx *ctx b_info->u.hvm.vpt_align = 1; b_info->u.hvm.timer_mode = 1; b_info->u.hvm.nested_hvm = 0; + b_info->u.hvm.generation_id = 0; break; case LIBXL_DOMAIN_TYPE_PV: b_info->u.pv.slack_memkb = 8 * 1024; @@ -191,13 +192,15@@
Quoted 23 lines
int libxl__domain_build(libxl__gc *gc,
vments[4] = "start_time"; vments[5] = libxl__sprintf(gc, "%lu.%02d",start_time.tv_sec,(int)start_time.tv_usec/10000);
tools/libxl/libxl_create.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_create.c Wed Nov 30 07:18:11 2011 -0800 +4
-1- localents = libxl__calloc(gc, 7, sizeof(char *)); + localents = libxl__calloc(gc, 9, sizeof(char *)); localents[0] = "platform/acpi"; localents[1] = (info->u.hvm.acpi) ? "1" : "0"; localents[2] = "platform/acpi_s3"; localents[3] = (info->u.hvm.acpi_s3) ? "1" : "0"; localents[4] = "platform/acpi_s4"; localents[5] = (info->u.hvm.acpi_s4) ? "1" : "0"; + localents[6] = "platform/generation_id"; + localents[7] = libxl__sprintf(gc, "0x%llx", + info->u.hvm.generation_id); break; case LIBXL_DOMAIN_TYPE_PV:diff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxl_dom.ctools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__build_post(libxl__gc *gc, uin · line 128
Quoted 4 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +0
-1@@ -125,7 +125,7 @@ int libxl__build_post(libxl__gc *gc, uin if (info->cpuid != NULL) libxl_cpuid_set(ctx, domid, info->cpuid); - ents = libxl__calloc(gc, 12 + (info->max_vcpus * 2) + 2,
sizeof(char *));tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__build_post(libxl__gc *gc, uin · line 142
Quoted 13 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +4
-1+ ents = libxl__calloc(gc, 14 + (info->max_vcpus * 2) + 2, + sizeof(char *)); ents[0] = "memory/static-max"; ents[1] = libxl__sprintf(gc, "%d", info->max_memkb); ents[2] = "memory/target";@@ -138,9 +138,11 @@ int libxl__build_post(libxl__gc *gc, uin ents[9] = libxl__sprintf(gc, "%"PRIu32, state->store_port); ents[10] = "store/ring-ref"; ents[11] = libxl__sprintf(gc, "%lu", state->store_mfn); + ents[12] = "data/generation-id"; + ents[13] = libxl__sprintf(gc, "0x%lx", state->vm_gid_addr); for (i = 0; i < info->max_vcpus; i++) { - ents[12+(i*2)] = libxl__sprintf(gc,"cpu/%d/availability", i);
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__build_post(libxl__gc *gc, uin · line 145
Quoted 3 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +1
-1- ents[12+(i*2)+1] = (i && info->cur_vcpus && !(info- cur_vcpus & (1 << i))) + ents[14+(i*2)] = libxl__sprintf(gc,"cpu/%d/availability", i);
Quoted 27 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +1
-0+ ents[14+(i*2)+1] = (i && info->cur_vcpus && !(info-
cur_vcpus
+ & (1 << i)))? "offline" : "online"; }tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +3
-0@@ -357,16 +359,19 @@ int libxl__domain_restore_common(libxl__ /* read signature */ int rc; int hvm, pae, superpages; + uint64_t gid; switch (info->type) { case LIBXL_DOMAIN_TYPE_HVM: hvm = 1; superpages = 1; pae = info->u.hvm.pae; + gid = info->u.hvm.generation_id; break; case LIBXL_DOMAIN_TYPE_PV: hvm = 0; superpages = 0; pae = 1; + gid = 0; break; default: return ERROR_INVAL;tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__domain_restore_common(libxl__
Quoted 9 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +2
-1@@ -374,7 +379,7 @@ int libxl__domain_restore_common(libxl__ rc = xc_domain_restore(ctx->xch, fd, domid, state->store_port, &state->store_mfn, state->console_port, &state- console_mfn, - hvm, pae, superpages); + hvm, pae, superpages, gid, + &state->vm_gid_addr); if ( rc ) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "restoringdomain");
Quoted 4 lines
return ERROR_FAIL;tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +0
-0@@ -540,12 +545,22 @@ int libxl__domain_suspend_common(libxl__ struct save_callbacks callbacks; struct suspendinfo si;tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__domain_suspend_common(libxl__ · line 555
Quoted 10 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +6
-1int hvm, rc = ERROR_FAIL; + unsigned long vm_gid_addr; switch (type) { - case LIBXL_DOMAIN_TYPE_HVM: + case LIBXL_DOMAIN_TYPE_HVM: { + char *path; + char *addr; + + path = libxl__sprintf(gc, "%s/data/generation-id",
libxl__xs_get_dompath(gc, domid));tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__domain_suspend_common(libxl__ · line 598
Quoted 13 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +5
-0+ addr = libxl__xs_read(gc, XBT_NULL, path); + + vm_gid_addr = (addr) ? strtoul(addr, NULL, 0) : 0; hvm = 1; break; + } case LIBXL_DOMAIN_TYPE_PV: + vm_gid_addr = 0; hvm = 0; break; default:@@ -583,7 +598,8 @@ int libxl__domain_suspend_common(libxl__ callbacks.switch_qemu_logdirty =
libxl__domain_suspend_common_switch_qemu_logdirty;tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__domain_suspend_common(libxl__ · line 586
Quoted 3 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +0
-1callbacks.data = &si; - rc = xc_domain_save(ctx->xch, fd, domid, 0, 0, flags,&callbacks, hvm);
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__domain_suspend_common(libxl__ · line 601
Quoted 1 line
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +1
-0+ rc = xc_domain_save(ctx->xch, fd, domid, 0, 0, flags,&callbacks,
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__domain_suspend_common(libxl__ · line 604
Quoted 3 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +1
-0+ hvm, vm_gid_addr); if ( rc ) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "saving domain:%s",
Quoted 3 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +0
-0si.guest_responded ?diff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxl_internal.h---a/tools/libxl/libxl_internal.hWed Nov 30 07:18:11 2011 -0800
Quoted 1 line
+++
b/tools/libxl/libxl_internal.hWed Nov 30 20:51:07 2011+0000
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 typedef struct { · line 206
Quoted 9 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +2
-0@@ -199,6 +199,8 @@ typedef struct { uint32_t console_port; unsigned long console_mfn; + + unsigned long vm_gid_addr; } libxl__domain_build_state; _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid, diff-r
Quoted 2 lines
3c4c29899d8a-r94a17182f386tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl Wed Nov 30 07:18:11 2011 -0800
Quoted 1 line
+++ b/tools/libxl/libxl_types.idl Wed Nov 30 20:51:07 2011
+0000
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 libxl_domain_build_info = Struct("domain · line 188
Quoted 7 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -183,6 +183,7 @@ libxl_domain_build_info = Struct("domain ("vpt_align", bool), ("timer_mode", integer), ("nested_hvm", bool), + ("generation_id", uint64), ])), ("pv", Struct(None, [("kernel",
libxl_file_reference),tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 libxl_domain_build_info = Struct("domain · line 189
Quoted 1 line
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +0
-0("slack_memkb", uint32),diff
Quoted 13 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +0
-1-r 3c4c29899d8a -r 94a17182f386 tools/libxl/libxlu_cfg.ctools/libxl/libxlu_cfg.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxlu_cfg.c Wed Nov 30 07:18:11 2011 -0800 +6
-0@@ -235,6 +235,37 @@ int xlu_cfg_get_long(const XLU_Config *c return 0; } +int xlu_cfg_get_long_long(const XLU_Config *cfg, const char *n, + long long *value_r, int dont_warn) { + long long ll; + XLU_ConfigSetting *set; + int e; + char *ep;tools/libxl/libxlu_cfg.c Wed Nov 30 20:51:07 2011 +0000 int xlu_cfg_get_long(const XLU_Config *c · line 253
Quoted 10 lines
tools/libxl/libxlu_cfg.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxlu_cfg.c Wed Nov 30 07:18:11 2011 -0800 +10
-0+ + e= find_atom(cfg,n,&set,dont_warn); if (e) return e; + errno= 0; ll= strtoll(set->values[0], &ep, 0); + e= errno; + if (errno) { + e= errno; + assert(e==EINVAL || e==ERANGE); + if (!dont_warn) + fprintf(cfg->report, + "%s:%d: warning: parameter `%s' could not beparsed"
tools/libxl/libxlu_cfg.c Wed Nov 30 20:51:07 2011 +0000 int xlu_cfg_get_long(const XLU_Config *c · line 261
Quoted 8 lines
tools/libxl/libxlu_cfg.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxlu_cfg.c Wed Nov 30 07:18:11 2011 -0800 +8
-0+ " as a number: %s\n", + cfg->filename, set->lineno, n, strerror(e)); + return e; + } + if (*ep || ep==set->values[0]) { + if (!dont_warn) + fprintf(cfg->report, + "%s:%d: warning: parameter `%s' is not avalid number\n",
Quoted 11 lines
tools/libxl/libxlu_cfg.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxlu_cfg.c Wed Nov 30 07:18:11 2011 -0800 +7
-0+ cfg->filename, set->lineno, n); + return EINVAL; + } + *value_r= ll; + return 0; +} + int xlu_cfg_get_list(const XLU_Config *cfg, const char *n, XLU_ConfigList **list_r, int *entries_r, int
dont_warn) { diff -r3c4c29899d8a-r94a17182f386
tools/libxl/libxlutil.htools/libxl/libxlutil.h Wed Nov 30 20:51:07 2011 +0000 int xlu_cfg_replace_string(const XLU_Con · line 55
Quoted 7 lines
tools/libxl/libxlutil.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxlutil.h Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -52,6 +52,8 @@ int xlu_cfg_replace_string(const XLU_Con char **value_r, int dont_warn); int xlu_cfg_get_long(const XLU_Config*, const char *n, long *value_r, int dont_warn); +int xlu_cfg_get_long_long(const XLU_Config*, const char *n, longlong
*value_r,tools/libxl/libxlutil.h Wed Nov 30 20:51:07 2011 +0000 int xlu_cfg_replace_string(const XLU_Con · line 59
Quoted 4 lines
tools/libxl/libxlutil.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxlutil.h Wed Nov 30 07:18:11 2011 -0800 +1
-0+ int dont_warn); int xlu_cfg_get_list(const XLU_Config*, const char *n, XLU_ConfigList **list_r /* may be 0 */, diff-r
Quoted 11 lines
3c4c29899d8a-r94a17182f386tools/libxl/xl_cmdimpl.ctools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -573,6 +573,7 @@ static void parse_config_data(const char { const char *buf; long l; + long long ll; XLU_Config *config; XLU_ConfigList *vbds, *nics, *pcis, *cvfbs, *cpuids; int pci_power_mgmt = 0;tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 static void parse_config_data(const char · line 768
Quoted 4 lines
tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -764,6 +765,8 @@ static void parse_config_data(const char b_info->u.hvm.timer_mode = l; if (!xlu_cfg_get_long (config, "nestedhvm", &l, 0)) b_info->u.hvm.nested_hvm = l; + if (!xlu_cfg_get_long_long (config, "generation_id", &ll,0))
Quoted 5 lines
tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +1
-0+ b_info->u.hvm.nested_hvm = ll; break; case LIBXL_DOMAIN_TYPE_PV: {diff -r
3c4c29899d8a-r94a17182f386
tools/python/xen/lowlevel/checkpoint/libcheckpoint.cQuoted 1 line
---
a/tools/python/xen/lowlevel/checkpoint/libcheckpoint.cWedNov 30 07:18:11 2011 -0800Quoted 1 line
+++
b/tools/python/xen/lowlevel/checkpoint/libcheckpoint.cWedNov 30 20:51:07 2011 +0000tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 int checkpoint_start(checkpoint_state* s { · line 179
Quoted 7 lines
tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -174,6 +174,7 @@ int checkpoint_start(checkpoint_state* s { int hvm, rc; int flags = XCFLAGS_LIVE; + unsigned long vm_gid_addr; if (!s->domid) { s->errstr = "checkpoint state not opened"; @@ -184,14+185,25
Quoted 14 lines
@@ int checkpoint_start(checkpoint_state* s
hvm = s->domtype > dt_pv; if (hvm) {tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +4
-0+ char path[128]; + char *addr; + + sprintf(path, "/local/domain/%u/data/generation-id", s-domid);
tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +5
-0+ addr = xs_read(s->xsh, XBT_NULL, path, NULL); + + vm_gid_addr = (addr) ? strtoul(addr, NULL, 0) : 0; + free(addr); +tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000
Quoted 10 lines
tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +2
-1flags |= XCFLAGS_HVM; if (switch_qemu_logdirty(s, 1)) return -1; + } else { + vm_gid_addr = 0; } callbacks->switch_qemu_logdirty = noop_switch_logdirty; - rc = xc_domain_save(s->xch, fd, s->domid, 0, 0, flags,callbacks, hvm);
Quoted 1 line
+ rc = xc_domain_save(s->xch, fd,
s->domid, 0, 0, flags,callbacks,
Quoted 22 lines
+ hvm,
vm_gid_addr);if (hvm) switch_qemu_logdirty(s, 0);diff -r
3c4c29899d8a-r94a17182f386tools/xcutils/xc_restore.ctools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_restore.c Wed Nov 30 07:18:11 2011 -0800 +2
-2@@ -23,7 +23,8 @@ main(int argc, char **argv) xc_interface *xch; int io_fd, ret; int superpages; - unsigned long store_mfn, console_mfn; + unsigned long store_mfn, console_mfn, vm_gid_addr; + uint64_t gid; if ( (argc != 8) && (argc != 9) ) errx(1, "usage: %s iofd domid store_evtchn "@@ -40,19 +41,25 @@ main(int argc, char **argv) hvm = atoi(argv[5]); pae = atoi(argv[6]); apic = atoi(argv[7]); - if ( argc == 9 )tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 main(int argc, char **argv) · line 53
Quoted 10 lines
tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_restore.c Wed Nov 30 07:18:11 2011 -0800 +5
-0+ if ( argc >= 9 ) superpages = atoi(argv[8]); else superpages = !!hvm; + if ( argc >= 10 ) + gid = strtoll(argv[9], NULL, 0); + else + gid = 0; ret = xc_domain_restore(xch, io_fd, domid, store_evtchn,
&store_mfn,tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 main(int argc, char **argv) · line 49
Quoted 1 line
tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_restore.c Wed Nov 30 07:18:11 2011 -0800 +0
-1- console_evtchn, &console_mfn, hvm,pae, superpages);
tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 main(int argc, char **argv) · line 54
Quoted 1 line
tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_restore.c Wed Nov 30 07:18:11 2011 -0800 +1
-0+ console_evtchn, &console_mfn, hvm,pae, superpages,
Quoted 15 lines
tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_restore.c Wed Nov 30 07:18:11 2011 -0800 +2
-0+ gid, &vm_gid_addr); if ( ret == 0 ) { printf("store-mfn %li\n", store_mfn); if ( !hvm ) printf("console-mfn %li\n", console_mfn); + printf("vm-gid-addr %lx\n", vm_gid_addr); fflush(stdout); }diff -r
3c4c29899d8a-r94a17182f386tools/xcutils/xc_save.ctools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000 main(int argc, char **argv) · line 178
Quoted 10 lines
tools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_save.c Wed Nov 30 07:18:11 2011 -0800 +4
-0@@ -169,6 +169,10 @@ main(int argc, char **argv) unsigned int maxit, max_f; int io_fd, ret, port; struct save_callbacks callbacks; + char path[128]; + struct xs_handle *xs; + char *addr; + unsigned long vm_gid_addr; if (argc != 6) errx(1, "usage: %s iofd domid maxit maxf flags",argv[0]); @@
tools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000
Quoted 6 lines
-207,8 +211,21 @@
main(int argc, char **argv)memset(&callbacks, 0, sizeof(callbacks)); callbacks.suspend = suspend; callbacks.switch_qemu_logdirty = switch_qemu_logdirty;tools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_save.c Wed Nov 30 07:18:11 2011 -0800 +2
-0+ + sprintf(path, "/local/domain/%d/data/generation-id",si.domid);
tools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000
Quoted 12 lines
tools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_save.c Wed Nov 30 07:18:11 2011 -0800 +11
-0+ + if ((xs = xs_daemon_open()) == NULL) + errx(1, "Couldn't contact xenstore"); + + addr = xs_read(xs, XBT_NULL, path, NULL); + + xs_daemon_close(xs); + + vm_gid_addr = (addr) ? strtoul(addr, NULL, 0) : 0; + free(addr); + ret = xc_domain_save(si.xch, io_fd, si.domid, maxit, max_f,si.flags,
Quoted 12 lines
tools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_save.c Wed Nov 30 07:18:11 2011 -0800 +2
-1- &callbacks, !!(si.flags & XCFLAGS_HVM)); + &callbacks, !!(si.flags & XCFLAGS_HVM), + vm_gid_addr); if (si.suspend_evtchn > 0) xc_suspend_evtchn_release(si.xch, si.xce, si.domid,si.suspend_evtchn);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 3 lines · Paul Durrant
Konrad,
Did you see my previous patch set? The introductory comment was:
I think that description belongs somewhere permanent, either in docs/misc or as a comment in an appropriate header.
Ian.
Quoted 651 lines
-----
The following is a revised patch series to add support for a VM generation ID virtual device for HVM guests. The basic requirements of this device are as follows:- It must be exposed somewhere in ACPI namespace with a
_CIDof "VM_Gen_Counter".
- It must also include a_DDNof "VM_Gen_Counter".
- It must contain a_HIDobject but no particular value is required.
- It must expose a package called ADDR which evaluates to two integers; the first being the low order 32-bits of a guest physical address (GPA), the second by the high order 32-bits of the GPA. This GPA is the address of an 8-byte aligned 8-byte buffer containing the VM generation ID.
This buffer must not be in ranges supported as AddressRangeMemory or AddressRangeACPI and must not be mapped by any PTE with caching disabled.The semantics of the VM generation ID itself are left up to the tools but it must be possible to change it each time the VM is booted, migrated, or restored from a saved image.
-----Does that help?
Paul
Quoted 595 lines
-----Original Message-----
From: Konrad Rzeszutek Wilk [mailto:[email protected]]
Sent: 30 November 2011 22:14
To: Paul Durrant
Cc: [email protected]
Subject: Re: [Xen-devel] [PATCH] Add code to track the address of the VM generation id buffer across aQuoted 2 lines · Paul Durrant
# HG changeset patch
# User Paul Durrant <[email protected]> # Date 1322686267 0#
Quoted 3 lines
Node ID
94a17182f386c8bb414eba55dddf763b8982c76d
# Parent3c4c29899d8a2a0c0f9109b7236da95bb72b77b6Add code to track the address of the VM generation id bufferacross a
Quoted 1 line
save/restore or migrate and inject a new value.
So what is a generation id? What is the use-case for this?
Quoted 8 lines
The address of the buffer is written into xenstore by hvmloader at boot time. It must be read from xenstore by the caller of
xc_domain_save()and then written back again by the caller ofxc_domain_restore().Signed-off-by Paul Durrant <[email protected]>diff -r
3c4c29899d8a-r94a17182f386
tools/libxc/ia64/xc_ia64_linux_restore.cQuoted 1 line
---
a/tools/libxc/ia64/xc_ia64_linux_restore.cWed Nov 3007:18:11 2011 -0800
Quoted 1 line
+++
b/tools/libxc/ia64/xc_ia64_linux_restore.cWed Nov 3020:51:07 2011 +0000
Review int · line 549
Quoted 3 lines
(quoted diff) +0
-0@@ -548,7 +548,8 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned int store_evtchn, unsigned long
*store_mfn,Review int · line 550
Quoted 1 line
(quoted diff) +0
-0unsigned int console_evtchn, unsigned long
*console_mfn,Review int · line 551
Quoted 1 line
(quoted diff) +0
-1- unsigned int hvm, unsigned int pae, intsuperpages)
Review int · line 551
Quoted 1 line
(quoted diff) +1
-0+ unsigned int hvm, unsigned int pae, intsuperpages,
Quoted 5 lines
tools/libxc/ia64/xc_ia64_linux_restore.c +1
-0+ uint64_t gid) {DECLARE_DOMCTL ;int rc =1 ;diff -r
3c4c29899d8a-r94a17182f386
tools/libxc/ia64/xc_ia64_linux_save.cQuoted 1 line
---
a/tools/libxc/ia64/xc_ia64_linux_save.cWed Nov 30 07:18:112011 -0800
Quoted 1 line
+++
b/tools/libxc/ia64/xc_ia64_linux_save.cWed Nov 30 20:51:072011 +0000
Review out: · line 383
Quoted 3 lines
(quoted diff) +0
-0@@ -382,7 +382,8 @@ out: int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom,
uint32_tmax_iters,Quoted 8 lines
tools/libxc/ia64/xc_ia64_linux_save.c +2
-1uint32_t max_factor, uint32_t flags, - struct save_callbacks* callbacks, int hvm) + struct save_callbacks* callbacks, int hvm, + unsigned long vm_gid_addr) {DECLARE_DOMCTL ;xc_dominfo_t info;diff -r
3c4c29899d8a-r94a17182f386
tools/libxc/xc_domain_restore.cQuoted 1 line
---
a/tools/libxc/xc_domain_restore.cWed Nov 30 07:18:11 2011 -0800
Quoted 1 line
+++
b/tools/libxc/xc_domain_restore.cWed Nov 30 20:51:07 2011+0000
tools/libxc/xc_domain_restore.c typedef struct { · line 682
Quoted 8 lines
tools/libxc/xc_domain_restore.c +1
-0@@ -676,6 +676,7 @@ typedef struct {uint64_t console_pfn;uint64_t acpi_ioport_location;uint64_t viridian; +uint64_t vm_gid_addr; } pagebuf_t; static int pagebuf_init(pagebuf_t* buf) @@ -820,6 +821,17 @@static
Review
Quoted 6 lines
int pagebuf_get_one(xc_interface
} return pagebuf_get_one(xch, ctx, buf, fd, dom);(quoted diff) +2
-0+ case XC_SAVE_ID_HVM_GENERATION_ID_ADDR: + /* Skip padding 4 bytes then read the generation idbuffer location. */
tools/libxc/xc_domain_restore.c static int pagebuf_get_one(xc_interface
Quoted 4 lines
tools/libxc/xc_domain_restore.c +4
-0+if (RDEXACT (fd, &buf->vm_gid_addr,sizeof (uint32_t )) || +RDEXACT (fd, &buf->vm_gid_addr,sizeof (uint64_t )) ) + { + PERROR("error read the generation id bufferlocation");
tools/libxc/xc_domain_restore.c static int pagebuf_get_one(xc_interface
Quoted 8 lines
tools/libxc/xc_domain_restore.c +5
-0+return -1 ; + } +DPRINTF ("read generation id buffer address" ); +return pagebuf_get_one (xch, ctx, buf, fd, dom); +default :if ( (count >MAX_BATCH_SIZE ) || (count <0 ) ) { ERROR("Max batch size exceeded (%d). Giving up.",count);
Review static int apply_batch(xc_interface *xch
Quoted 1 line
(quoted diff) +0
-0@@ -1186,7 +1198,8 @@ static int apply_batch(xc_interface *xchint
Review static int apply_batch(xc_interface *xch · line 1199
Quoted 2 lines
(quoted diff) +0
-0xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned int store_evtchn, unsigned long
*store_mfn,Review static int apply_batch(xc_interface *xch · line 1200
Quoted 1 line
(quoted diff) +0
-0unsigned int console_evtchn, unsigned long
*console_mfn,Review static int apply_batch(xc_interface *xch · line 1189
Quoted 1 line
(quoted diff) +0
-1- unsigned int hvm, unsigned int pae, intsuperpages)
Review static int apply_batch(xc_interface *xch · line 1201
Quoted 1 line
(quoted diff) +1
-0+ unsigned int hvm, unsigned int pae, intsuperpages,
Quoted 5 lines
tools/libxc/xc_domain_restore.c +1
-0+ uint64_t gid, unsigned long *vm_gid_addr) {DECLARE_DOMCTL ; int rc = 1, frc, i, j, n, m, pae_extended_cr3 = 0,
ext_vcpucontext= 0; @@ -1386,6 +1399,33 @@ intxc_domain_restore(xc_interface *xch,
Quoted 1 line
xc_set_hvm_param(xch, dom, HVM_PARAM_VM86_TSS,pagebuf.vm86_tss);
tools/libxc/xc_domain_restore.c int xc_domain_restore(xc_interface *xch,
Quoted 8 lines
if ( pagebuf.console_pfn )
console_pfn= pagebuf.console_pfn;tools/libxc/xc_domain_restore.c +6
-0+if ( pagebuf.vm_gid_addr ) { +unsigned int offset; +unsigned char *buf; + +/* +* Map the VM generation id buffer and inject the new value.
Quoted 5 lines
tools/libxc/xc_domain_restore.c +5
-0+*/ + + pfn = pagebuf.vm_gid_addr >>PAGE_SHIFT ; + offset = pagebuf.vm_gid_addr & (PAGE_SIZE -1 ); +tools/libxc/xc_domain_restore.c int xc_domain_restore(xc_interface *xch,
Quoted 10 lines
tools/libxc/xc_domain_restore.c +10
-0+if ( (pfn >= dinfo->p2m_size) || + (pfn_type[pfn] !=XEN_DOMCTL_PFINFO_NOTAB ) ) + { +ERROR ("generation id buffer frame is bad" ); + goto out; + } + + mfn = ctx->p2m[pfn]; + buf = xc_map_foreign_range(xch, dom, PAGE_SIZE, + PROT_READ |
PROT_WRITE, mfn);Quoted 11 lines
tools/libxc/xc_domain_restore.c +6
-0+ *(unsigned long long *)(buf + offset) = gid; +munmap (buf,PAGE_SIZE ); + + *vm_gid_addr = pagebuf.vm_gid_addr; + } +break ;/* our work here is done */ }diff -r
3c4c29899d8a-r94a17182f386tools/libxc/xc_domain_save.c---a/tools/libxc/xc_domain_save.cWed Nov 30 07:18:11 2011 -0800
Quoted 1 line
+++
b/tools/libxc/xc_domain_save.cWed Nov 30 20:51:07 2011+0000
Review static int save_tsc_info(xc_interface *x · line 755
Quoted 3 lines
(quoted diff) +0
-0@@ -754,7 +754,8 @@ static int save_tsc_info(xc_interface *x int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom,
uint32_tmax_iters,Quoted 8 lines
tools/libxc/xc_domain_save.c +2
-1uint32_t max_factor, uint32_t flags, - struct save_callbacks* callbacks, int hvm) + struct save_callbacks* callbacks, int hvm, + unsigned long vm_gid_addr) { xc_dominfo_t info;DECLARE_DOMCTL ;tools/libxc/xc_domain_save.c int xc_domain_save(xc_interface *xch, in · line 1470
Quoted 10 lines
tools/libxc/xc_domain_save.c +7
-0@@ -1460,6 +1461,16 @@ int xc_domain_save(xc_interface *xch, inuint64_t data; } chunk = { 0, }; + chunk.id =XC_SAVE_ID_HVM_GENERATION_ID_ADDR ; + chunk.data = vm_gid_addr; + +if ( (chunk.data !=0 ) && +wrexact (io_fd, &chunk,sizeof (chunk)) ) + { + PERROR("Error when writing the generation id bufferlocation for guest");
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 struct save_callbacks { · line 58
Quoted 12 lines
tools/libxc/xc_domain_save.c +3
-0+ goto out; + } + chunk.id =XC_SAVE_ID_HVM_IDENT_PT ; chunk.data =0 ; xc_get_hvm_param(xch, dom, HVM_PARAM_IDENT_PT, diff -r
3c4c29899d8a-r94a17182f386tools/libxc/xenguest.htools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +0
-0@@ -57,7 +57,8 @@ struct save_callbacks { */ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom,
uint32_tmax_iters,tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 struct save_callbacks { · line 59
Quoted 1 line
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +0
-0uint32_t max_factor, uint32_t flags /*
XCFLAGS_xxx*/,tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 74
Quoted 10 lines
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +2
-1- struct save_callbacks* callbacks, int hvm); + struct save_callbacks* callbacks, int hvm, + unsigned long vm_gid_addr); /**@@ -71,12 +72,15 @@ int xc_domain_save(xc_interface *xch, in * @parm hvm non-zero if this is a HVM restore * @parm pae non-zero if this HVM domain has PAE support enabled * @parm superpages non-zero to allocate guest memory withsuperpages
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 76
Quoted 2 lines
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +2
-0+ * @parm gid the new generation id of the VM + * @parm vm_gid_addr returned with the address of the generationid
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 81
Quoted 5 lines
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +1
-0+ buffer * @return 0 on success, -1 on failure */ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned int store_evtchn, unsigned long
*store_mfn,tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 82
Quoted 1 line
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +0
-0unsigned int console_evtchn, unsigned long
*console_mfn,tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 79
Quoted 1 line
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +0
-1- unsigned int hvm, unsigned int pae, intsuperpages);
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 83
Quoted 1 line
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +1
-0+ unsigned int hvm, unsigned int pae, intsuperpages,
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 int xc_domain_save(xc_interface *xch, in · line 86
Quoted 3 lines
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +1
-0+ uint64_t gid, unsigned long *vm_gid_addr); /** * xc_domain_restore writes a file to disk that contains thedevice
Quoted 3 lines
* model saved state.
diff -r3c4c29899d8a-r94a17182f386tools/libxc/xg_save_restore.h---a/tools/libxc/xg_save_restore.hWed Nov 30 07:18:11 2011 -0800
Quoted 1 line
+++
b/tools/libxc/xg_save_restore.hWed Nov 30 20:51:07 2011+0000
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 line 135
Quoted 2 lines
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +0
-0@@ -135,6 +135,7 @@ #define XC_SAVE_ID_LAST_CHECKPOINT -9 /* Commit to restoringafter completion of current iteration. */
Quoted 10 lines
tools/libxc/xenguest.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxc/xenguest.h Wed Nov 30 07:18:11 2011 -0800 +1
-0#define XC_SAVE_ID_HVM_ACPI_IOPORTS_LOCATION -10 #define XC_SAVE_ID_HVM_VIRIDIAN -11 +#define XC_SAVE_ID_HVM_GENERATION_ID_ADDR -12 /* ** We process save/restore/migrate in batches of pages; the belowdiff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxl_create.ctools/libxl/libxl_create.c Wed Nov 30 20:51:07 2011 +0000 int libxl_init_build_info(libxl_ctx *ctx · line 107
Quoted 7 lines
tools/libxl/libxl_create.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_create.c Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -101,6 +101,7 @@ int libxl_init_build_info(libxl_ctx *ctx b_info->u.hvm.vpt_align = 1; b_info->u.hvm.timer_mode = 1; b_info->u.hvm.nested_hvm = 0; + b_info->u.hvm.generation_id = 0; break; case LIBXL_DOMAIN_TYPE_PV: b_info->u.pv.slack_memkb = 8 * 1024; @@ -191,13 +192,15@@
Quoted 23 lines
int libxl__domain_build(libxl__gc *gc,
vments[4] = "start_time"; vments[5] = libxl__sprintf(gc, "%lu.%02d",start_time.tv_sec,(int)start_time.tv_usec/10000);
tools/libxl/libxl_create.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_create.c Wed Nov 30 07:18:11 2011 -0800 +4
-1- localents = libxl__calloc(gc, 7, sizeof(char *)); + localents = libxl__calloc(gc, 9, sizeof(char *)); localents[0] = "platform/acpi"; localents[1] = (info->u.hvm.acpi) ? "1" : "0"; localents[2] = "platform/acpi_s3"; localents[3] = (info->u.hvm.acpi_s3) ? "1" : "0"; localents[4] = "platform/acpi_s4"; localents[5] = (info->u.hvm.acpi_s4) ? "1" : "0"; + localents[6] = "platform/generation_id"; + localents[7] = libxl__sprintf(gc, "0x%llx", + info->u.hvm.generation_id); break; case LIBXL_DOMAIN_TYPE_PV:diff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxl_dom.ctools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__build_post(libxl__gc *gc, uin · line 128
Quoted 4 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +0
-1@@ -125,7 +125,7 @@ int libxl__build_post(libxl__gc *gc, uin if (info->cpuid != NULL) libxl_cpuid_set(ctx, domid, info->cpuid); - ents = libxl__calloc(gc, 12 + (info->max_vcpus * 2) + 2,
sizeof(char *));tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__build_post(libxl__gc *gc, uin · line 142
Quoted 13 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +4
-1+ ents = libxl__calloc(gc, 14 + (info->max_vcpus * 2) + 2, + sizeof(char *)); ents[0] = "memory/static-max"; ents[1] = libxl__sprintf(gc, "%d", info->max_memkb); ents[2] = "memory/target";@@ -138,9 +138,11 @@ int libxl__build_post(libxl__gc *gc, uin ents[9] = libxl__sprintf(gc, "%"PRIu32, state->store_port); ents[10] = "store/ring-ref"; ents[11] = libxl__sprintf(gc, "%lu", state->store_mfn); + ents[12] = "data/generation-id"; + ents[13] = libxl__sprintf(gc, "0x%lx", state->vm_gid_addr); for (i = 0; i < info->max_vcpus; i++) { - ents[12+(i*2)] = libxl__sprintf(gc,"cpu/%d/availability", i);
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__build_post(libxl__gc *gc, uin · line 145
Quoted 3 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +1
-1- ents[12+(i*2)+1] = (i && info->cur_vcpus && !(info- cur_vcpus & (1 << i))) + ents[14+(i*2)] = libxl__sprintf(gc,"cpu/%d/availability", i);
Quoted 27 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +1
-0+ ents[14+(i*2)+1] = (i && info->cur_vcpus && !(info-
cur_vcpus
+ & (1 << i)))? "offline" : "online"; }tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +3
-0@@ -357,16 +359,19 @@ int libxl__domain_restore_common(libxl__ /* read signature */ int rc; int hvm, pae, superpages; + uint64_t gid; switch (info->type) { case LIBXL_DOMAIN_TYPE_HVM: hvm = 1; superpages = 1; pae = info->u.hvm.pae; + gid = info->u.hvm.generation_id; break; case LIBXL_DOMAIN_TYPE_PV: hvm = 0; superpages = 0; pae = 1; + gid = 0; break; default: return ERROR_INVAL;tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__domain_restore_common(libxl__
Quoted 9 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +2
-1@@ -374,7 +379,7 @@ int libxl__domain_restore_common(libxl__ rc = xc_domain_restore(ctx->xch, fd, domid, state->store_port, &state->store_mfn, state->console_port, &state- console_mfn, - hvm, pae, superpages); + hvm, pae, superpages, gid, + &state->vm_gid_addr); if ( rc ) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "restoringdomain");
Quoted 4 lines
return ERROR_FAIL;tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +0
-0@@ -540,12 +545,22 @@ int libxl__domain_suspend_common(libxl__ struct save_callbacks callbacks; struct suspendinfo si;tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__domain_suspend_common(libxl__ · line 555
Quoted 10 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +6
-1int hvm, rc = ERROR_FAIL; + unsigned long vm_gid_addr; switch (type) { - case LIBXL_DOMAIN_TYPE_HVM: + case LIBXL_DOMAIN_TYPE_HVM: { + char *path; + char *addr; + + path = libxl__sprintf(gc, "%s/data/generation-id",
libxl__xs_get_dompath(gc, domid));tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__domain_suspend_common(libxl__ · line 598
Quoted 13 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +5
-0+ addr = libxl__xs_read(gc, XBT_NULL, path); + + vm_gid_addr = (addr) ? strtoul(addr, NULL, 0) : 0; hvm = 1; break; + } case LIBXL_DOMAIN_TYPE_PV: + vm_gid_addr = 0; hvm = 0; break; default:@@ -583,7 +598,8 @@ int libxl__domain_suspend_common(libxl__ callbacks.switch_qemu_logdirty =
libxl__domain_suspend_common_switch_qemu_logdirty;tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__domain_suspend_common(libxl__ · line 586
Quoted 3 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +0
-1callbacks.data = &si; - rc = xc_domain_save(ctx->xch, fd, domid, 0, 0, flags,&callbacks, hvm);
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__domain_suspend_common(libxl__ · line 601
Quoted 1 line
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +1
-0+ rc = xc_domain_save(ctx->xch, fd, domid, 0, 0, flags,&callbacks,
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 int libxl__domain_suspend_common(libxl__ · line 604
Quoted 3 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +1
-0+ hvm, vm_gid_addr); if ( rc ) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "saving domain:%s",
Quoted 3 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +0
-0si.guest_responded ?diff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxl_internal.h---a/tools/libxl/libxl_internal.hWed Nov 30 07:18:11 2011 -0800
Quoted 1 line
+++
b/tools/libxl/libxl_internal.hWed Nov 30 20:51:07 2011+0000
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 typedef struct { · line 206
Quoted 9 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +2
-0@@ -199,6 +199,8 @@ typedef struct { uint32_t console_port; unsigned long console_mfn; + + unsigned long vm_gid_addr; } libxl__domain_build_state; _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid, diff-r
Quoted 2 lines
3c4c29899d8a-r94a17182f386tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl Wed Nov 30 07:18:11 2011 -0800
Quoted 1 line
+++ b/tools/libxl/libxl_types.idl Wed Nov 30 20:51:07 2011
+0000
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 libxl_domain_build_info = Struct("domain · line 188
Quoted 7 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -183,6 +183,7 @@ libxl_domain_build_info = Struct("domain ("vpt_align", bool), ("timer_mode", integer), ("nested_hvm", bool), + ("generation_id", uint64), ])), ("pv", Struct(None, [("kernel",
libxl_file_reference),tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 libxl_domain_build_info = Struct("domain · line 189
Quoted 1 line
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +0
-0("slack_memkb", uint32),diff
Quoted 13 lines
tools/libxl/libxl_dom.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_dom.c Wed Nov 30 07:18:11 2011 -0800 +0
-1-r 3c4c29899d8a -r 94a17182f386 tools/libxl/libxlu_cfg.ctools/libxl/libxlu_cfg.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxlu_cfg.c Wed Nov 30 07:18:11 2011 -0800 +6
-0@@ -235,6 +235,37 @@ int xlu_cfg_get_long(const XLU_Config *c return 0; } +int xlu_cfg_get_long_long(const XLU_Config *cfg, const char *n, + long long *value_r, int dont_warn) { + long long ll; + XLU_ConfigSetting *set; + int e; + char *ep;tools/libxl/libxlu_cfg.c Wed Nov 30 20:51:07 2011 +0000 int xlu_cfg_get_long(const XLU_Config *c · line 253
Quoted 10 lines
tools/libxl/libxlu_cfg.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxlu_cfg.c Wed Nov 30 07:18:11 2011 -0800 +10
-0+ + e= find_atom(cfg,n,&set,dont_warn); if (e) return e; + errno= 0; ll= strtoll(set->values[0], &ep, 0); + e= errno; + if (errno) { + e= errno; + assert(e==EINVAL || e==ERANGE); + if (!dont_warn) + fprintf(cfg->report, + "%s:%d: warning: parameter `%s' could not beparsed"
tools/libxl/libxlu_cfg.c Wed Nov 30 20:51:07 2011 +0000 int xlu_cfg_get_long(const XLU_Config *c · line 261
Quoted 8 lines
tools/libxl/libxlu_cfg.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxlu_cfg.c Wed Nov 30 07:18:11 2011 -0800 +8
-0+ " as a number: %s\n", + cfg->filename, set->lineno, n, strerror(e)); + return e; + } + if (*ep || ep==set->values[0]) { + if (!dont_warn) + fprintf(cfg->report, + "%s:%d: warning: parameter `%s' is not avalid number\n",
Quoted 11 lines
tools/libxl/libxlu_cfg.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxlu_cfg.c Wed Nov 30 07:18:11 2011 -0800 +7
-0+ cfg->filename, set->lineno, n); + return EINVAL; + } + *value_r= ll; + return 0; +} + int xlu_cfg_get_list(const XLU_Config *cfg, const char *n, XLU_ConfigList **list_r, int *entries_r, int
dont_warn) { diff -r3c4c29899d8a-r94a17182f386
tools/libxl/libxlutil.htools/libxl/libxlutil.h Wed Nov 30 20:51:07 2011 +0000 int xlu_cfg_replace_string(const XLU_Con · line 55
Quoted 7 lines
tools/libxl/libxlutil.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxlutil.h Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -52,6 +52,8 @@ int xlu_cfg_replace_string(const XLU_Con char **value_r, int dont_warn); int xlu_cfg_get_long(const XLU_Config*, const char *n, long *value_r, int dont_warn); +int xlu_cfg_get_long_long(const XLU_Config*, const char *n, longlong
*value_r,tools/libxl/libxlutil.h Wed Nov 30 20:51:07 2011 +0000 int xlu_cfg_replace_string(const XLU_Con · line 59
Quoted 4 lines
tools/libxl/libxlutil.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxlutil.h Wed Nov 30 07:18:11 2011 -0800 +1
-0+ int dont_warn); int xlu_cfg_get_list(const XLU_Config*, const char *n, XLU_ConfigList **list_r /* may be 0 */, diff-r
Quoted 11 lines
3c4c29899d8a-r94a17182f386tools/libxl/xl_cmdimpl.ctools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -573,6 +573,7 @@ static void parse_config_data(const char { const char *buf; long l; + long long ll; XLU_Config *config; XLU_ConfigList *vbds, *nics, *pcis, *cvfbs, *cpuids; int pci_power_mgmt = 0;tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 static void parse_config_data(const char · line 768
Quoted 4 lines
tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -764,6 +765,8 @@ static void parse_config_data(const char b_info->u.hvm.timer_mode = l; if (!xlu_cfg_get_long (config, "nestedhvm", &l, 0)) b_info->u.hvm.nested_hvm = l; + if (!xlu_cfg_get_long_long (config, "generation_id", &ll,0))
Quoted 5 lines
tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +1
-0+ b_info->u.hvm.nested_hvm = ll; break; case LIBXL_DOMAIN_TYPE_PV: {diff -r
3c4c29899d8a-r94a17182f386
tools/python/xen/lowlevel/checkpoint/libcheckpoint.cQuoted 1 line
---
a/tools/python/xen/lowlevel/checkpoint/libcheckpoint.cWedNov 30 07:18:11 2011 -0800Quoted 1 line
+++
b/tools/python/xen/lowlevel/checkpoint/libcheckpoint.cWedNov 30 20:51:07 2011 +0000tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 int checkpoint_start(checkpoint_state* s { · line 179
Quoted 7 lines
tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -174,6 +174,7 @@ int checkpoint_start(checkpoint_state* s { int hvm, rc; int flags = XCFLAGS_LIVE; + unsigned long vm_gid_addr; if (!s->domid) { s->errstr = "checkpoint state not opened"; @@ -184,14+185,25
Quoted 14 lines
@@ int checkpoint_start(checkpoint_state* s
hvm = s->domtype > dt_pv; if (hvm) {tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +4
-0+ char path[128]; + char *addr; + + sprintf(path, "/local/domain/%u/data/generation-id", s-domid);
tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +5
-0+ addr = xs_read(s->xsh, XBT_NULL, path, NULL); + + vm_gid_addr = (addr) ? strtoul(addr, NULL, 0) : 0; + free(addr); +tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000
Quoted 10 lines
tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +2
-1flags |= XCFLAGS_HVM; if (switch_qemu_logdirty(s, 1)) return -1; + } else { + vm_gid_addr = 0; } callbacks->switch_qemu_logdirty = noop_switch_logdirty; - rc = xc_domain_save(s->xch, fd, s->domid, 0, 0, flags,callbacks, hvm);
Quoted 1 line
+ rc = xc_domain_save(s->xch, fd,
s->domid, 0, 0, flags,callbacks,
Quoted 22 lines
+ hvm,
vm_gid_addr);if (hvm) switch_qemu_logdirty(s, 0);diff -r
3c4c29899d8a-r94a17182f386tools/xcutils/xc_restore.ctools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_restore.c Wed Nov 30 07:18:11 2011 -0800 +2
-2@@ -23,7 +23,8 @@ main(int argc, char **argv) xc_interface *xch; int io_fd, ret; int superpages; - unsigned long store_mfn, console_mfn; + unsigned long store_mfn, console_mfn, vm_gid_addr; + uint64_t gid; if ( (argc != 8) && (argc != 9) ) errx(1, "usage: %s iofd domid store_evtchn "@@ -40,19 +41,25 @@ main(int argc, char **argv) hvm = atoi(argv[5]); pae = atoi(argv[6]); apic = atoi(argv[7]); - if ( argc == 9 )tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 main(int argc, char **argv) · line 53
Quoted 10 lines
tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_restore.c Wed Nov 30 07:18:11 2011 -0800 +5
-0+ if ( argc >= 9 ) superpages = atoi(argv[8]); else superpages = !!hvm; + if ( argc >= 10 ) + gid = strtoll(argv[9], NULL, 0); + else + gid = 0; ret = xc_domain_restore(xch, io_fd, domid, store_evtchn,
&store_mfn,tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 main(int argc, char **argv) · line 49
Quoted 1 line
tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_restore.c Wed Nov 30 07:18:11 2011 -0800 +0
-1- console_evtchn, &console_mfn, hvm,pae, superpages);
tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 main(int argc, char **argv) · line 54
Quoted 1 line
tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_restore.c Wed Nov 30 07:18:11 2011 -0800 +1
-0+ console_evtchn, &console_mfn, hvm,pae, superpages,
Quoted 15 lines
tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_restore.c Wed Nov 30 07:18:11 2011 -0800 +2
-0+ gid, &vm_gid_addr); if ( ret == 0 ) { printf("store-mfn %li\n", store_mfn); if ( !hvm ) printf("console-mfn %li\n", console_mfn); + printf("vm-gid-addr %lx\n", vm_gid_addr); fflush(stdout); }diff -r
3c4c29899d8a-r94a17182f386tools/xcutils/xc_save.ctools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000 main(int argc, char **argv) · line 178
Quoted 10 lines
tools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_save.c Wed Nov 30 07:18:11 2011 -0800 +4
-0@@ -169,6 +169,10 @@ main(int argc, char **argv) unsigned int maxit, max_f; int io_fd, ret, port; struct save_callbacks callbacks; + char path[128]; + struct xs_handle *xs; + char *addr; + unsigned long vm_gid_addr; if (argc != 6) errx(1, "usage: %s iofd domid maxit maxf flags",argv[0]); @@
tools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000
Quoted 6 lines
-207,8 +211,21 @@
main(int argc, char **argv)memset(&callbacks, 0, sizeof(callbacks)); callbacks.suspend = suspend; callbacks.switch_qemu_logdirty = switch_qemu_logdirty;tools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_save.c Wed Nov 30 07:18:11 2011 -0800 +2
-0+ + sprintf(path, "/local/domain/%d/data/generation-id",si.domid);
Quoted 25 lines
tools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000
Quoted 12 lines
tools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_save.c Wed Nov 30 07:18:11 2011 -0800 +11
-0+ + if ((xs = xs_daemon_open()) == NULL) + errx(1, "Couldn't contact xenstore"); + + addr = xs_read(xs, XBT_NULL, path, NULL); + + xs_daemon_close(xs); + + vm_gid_addr = (addr) ? strtoul(addr, NULL, 0) : 0; + free(addr); + ret = xc_domain_save(si.xch, io_fd, si.domid, maxit, max_f,si.flags,
Quoted 12 lines
tools/xcutils/xc_save.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_save.c Wed Nov 30 07:18:11 2011 -0800 +2
-1- &callbacks, !!(si.flags & XCFLAGS_HVM)); + &callbacks, !!(si.flags & XCFLAGS_HVM), + vm_gid_addr); if (si.suspend_evtchn > 0) xc_suspend_evtchn_release(si.xch, si.xce, si.domid,si.suspend_evtchn);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 8 lines
-----Original Message-----
From: Ian Campbell
Sent: 01 December 2011 08:59
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]
Subject: Re: [Xen-devel] [PATCH] Add code to track the address of the VM generation id buffer across a
Quoted 9 lines
Quoted 3 lines · Paul Durrant
Konrad,
Did you see my previous patch set? The introductory comment was:
I think that description belongs somewhere permanent, either in docs/misc or as a comment in an appropriate header.
Good point. Perhaps I should stick the comment just above the device description in the dsdt?
Paul
Quoted 11 lines · Paul Durrant
Quoted 11 lines
-----Original Message-----
From: Ian Campbell
Sent: 01 December 2011 08:59
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]
Subject: Re: [Xen-devel] [PATCH] Add code to track the address of the VM generation id buffer across aQuoted 2 lines · Paul Durrant
Konrad,
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Did you see my previous patch set? The introductory comment was:
I think that description belongs somewhere permanent, either in docs/misc or as a comment in an appropriate header.
Good point. Perhaps I should stick the comment just above the device description in the dsdt?
That would do I guess.
I guess more important would be the user facing toolstack specific semantics/documentation i.e. the manpage.
Ian.
Would the following be sufficient?
Paul
docs/man/xl.cfg.pod.5 Thu Dec 01 11:52:58 2011 +0000 renamed from docs/man/xl.cfg.pod.5 Wed Nov 30 16:59:58 2011 -0800 +6 -0
@@ -484,6 +484,12 @@ of Xen) within a Xen guest or to support which uses hardware virtualisation extensions (e.g. Windows XP compatibility mode on more modern Windows OS). +=item B<generation_id=NUMBER> + +This value will be exposed inside the guest at an address which +can be determined by evaluating the ADDR package of an ACPI device +with _CID "VM_Gen_Counter". + =back =head3 Guest Virtual Time Controls
tools/firmware/hvmloader/acpi/dsdt.asl Thu Dec 01 11:52:58 2011 +0000 renamed from tools/firmware/hvmloader/acpi/dsdt.asl Wed Nov 30 16:59:58 2011 -0800 +19 -0
@@ -398,6 +398,25 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, }) } + /* VM Generation ID Device + * + * The basic requirements of this device are as follows: + * + * - It must be exposed somewhere in ACPI namespace with a _CID of + * "VM_Gen_Counter". + * - It must also include a _DDN of "VM_Gen_Counter". + * - It must contain a _HID object but no particular value is + * required. + * - It must expose a package called ADDR which evaluates to two + * integers; the first being the low order 32-bits of a guest + * physical address (GPA), the second by the high order 32-bits of + * the GPA. This GPA is the address of an 8-byte aligned 8-byte + * buffer containing the VM generation ID. + * This buffer must not be in ranges supported as AddressRangeMemory + * or AddressRangeACPI and must not be mapped by any PTE with caching + * disabled. (See the code in tools/firmware/hvmloader/acpi/build.c + * which determines the address and contents of the buffer). + */ Device(VGID) { Name(_HID, EisaID ("PNP0A06")) Name(_UID, 0x00)
Quoted 39 lines
-----Original Message-----
From: Ian Campbell
Sent: 01 December 2011 10:00
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]
Subject: RE: [Xen-devel] [PATCH] Add code to track the address of the VM generation id buffer across aQuoted 6 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
From: Ian Campbell
Sent: 01 December 2011 08:59
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]
Subject: Re: [Xen-devel] [PATCH] Add code to track the addressof
Quoted 6 lines
Quoted 6 lines
the VM generation id buffer across a
Quoted 3 lines · Paul Durrant
Konrad,
Did you see my previous patch set? The introductory comment
was:
Quoted 7 lines
Quoted 5 lines
I think that description belongs somewhere permanent, either in docs/misc or as a comment in an appropriate header.
Good point. Perhaps I should stick the comment just above the
device description in the dsdt?
That would do I guess.
I guess more important would be the user facing toolstack specific semantics/documentation i.e. the manpage.
Ian.
Quoted 8 lines · Paul Durrant
Would the following be sufficient?
Paul
diff -r
62ff6a318c5ddocs/man/xl.cfg.pod.5
docs/man/xl.cfg.pod.5 Thu Dec 01 11:52:58 2011 +0000 of Xen) within a Xen guest or to support · line 491
Quoted 8 lines
docs/man/xl.cfg.pod.5 Thu Dec 01 11:52:58 2011 +0000 renamed from docs/man/xl.cfg.pod.5 Wed Nov 30 16:59:58 2011 -0800 +5
-0@@ -484,6 +484,12 @@ of Xen) within a Xen guest or to support which uses hardware virtualisation extensions (e.g. Windows XP compatibility mode on more modern Windows OS). +=item B<generation_id=NUMBER> + +This value will be exposed inside the guest at an address which +can be determined by evaluating the ADDR package of an ACPI device +with _CID "VM_Gen_Counter".
Belongs more in the "Support for Paravirtualisation of HVM Guests" section, which is just below? The "Processor and Platform Features" is more about things which are optional (at least in theory) on real systems.
Since the semantics of the number itself are up to the toolstack and this toolstack defers this requirement up to the user it should probably also say something along the lines of:
The semantics of this value are guest dependent and it is up to the user to ensure those semantics are met.
(even better would be to implement something meaningful in xl, obviously)
Ian.
Quoted 74 lines
docs/man/xl.cfg.pod.5 Thu Dec 01 11:52:58 2011 +0000 renamed from docs/man/xl.cfg.pod.5 Wed Nov 30 16:59:58 2011 -0800 +1
-0+ =back =head3 Guest Virtual Time Controlsdiff -r
62ff6a318c5dtools/firmware/hvmloader/acpi/dsdt.asltools/firmware/hvmloader/acpi/dsdt.asl Thu Dec 01 11:52:58 2011 +0000 renamed from tools/firmware/hvmloader/acpi/dsdt.asl Wed Nov 30 16:59:58 2011 -0800 +19
-0@@ -398,6 +398,25 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, }) } + /* VM Generation ID Device + * + * The basic requirements of this device are as follows: + * + * - It must be exposed somewhere in ACPI namespace with a _CID of + * "VM_Gen_Counter". + * - It must also include a _DDN of "VM_Gen_Counter". + * - It must contain a _HID object but no particular value is + * required. + * - It must expose a package called ADDR which evaluates to two + * integers; the first being the low order 32-bits of a guest + * physical address (GPA), the second by the high order 32-bits of + * the GPA. This GPA is the address of an 8-byte aligned 8-byte + * buffer containing the VM generation ID. + * This buffer must not be in ranges supported as AddressRangeMemory + * or AddressRangeACPI and must not be mapped by any PTE with caching + * disabled. (See the code in tools/firmware/hvmloader/acpi/build.c + * which determines the address and contents of the buffer). + */ Device(VGID) { Name(_HID, EisaID ("PNP0A06")) Name(_UID, 0x00)Quoted 40 lines
-----Original Message-----
From: Ian Campbell
Sent: 01 December 2011 10:00
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]
Subject: RE: [Xen-devel] [PATCH] Add code to track the address of the VM generation id buffer across aQuoted 6 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
From: Ian Campbell
Sent: 01 December 2011 08:59
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]
Subject: Re: [Xen-devel] [PATCH] Add code to track the addressof
Quoted 6 lines
Quoted 6 lines
the VM generation id buffer across a
Quoted 3 lines · Paul Durrant
Konrad,
Did you see my previous patch set? The introductory comment
was:
Quoted 7 lines
Quoted 5 lines
I think that description belongs somewhere permanent, either in docs/misc or as a comment in an appropriate header.
Good point. Perhaps I should stick the comment just above the
device description in the dsdt?
That would do I guess.
I guess more important would be the user facing toolstack specific semantics/documentation i.e. the manpage.
Ian.
Quoted 25 lines
-----Original Message-----
From: Ian Campbell
Sent: 01 December 2011 14:25
To: Paul Durrant
Cc: Konrad Rzeszutek Wilk; [email protected]
Subject: RE: [Xen-devel] [PATCH] Add code to track the address of the VM generation id buffer across adocs/man/xl.cfg.pod.5 Thu Dec 01 11:52:58 2011 +0000 of Xen) within a Xen guest or to support
Quoted 8 lines · Paul Durrant
Would the following be sufficient?
Paul
diff -r
62ff6a318c5ddocs/man/xl.cfg.pod.5docs/man/xl.cfg.pod.5 Thu Dec 01 11:52:58 2011 +0000 renamed from docs/man/xl.cfg.pod.5 Wed Nov 30 16:59:58 2011 -0800 +0
-0@@ -484,6 +484,12 @@ of Xen) within a Xen guest or to supportwhich
docs/man/xl.cfg.pod.5 Thu Dec 01 11:52:58 2011 +0000 of Xen) within a Xen guest or to support · line 489
Quoted 6 lines
uses hardware virtualisation extensions (e.g. Windows XP compatibility mode on more modern Windows OS).
+=item B<generation_id=NUMBER>
docs/man/xl.cfg.pod.5 Thu Dec 01 11:52:58 2011 +0000 renamed from docs/man/xl.cfg.pod.5 Wed Nov 30 16:59:58 2011 -0800 +2
-0+ +This value will be exposed inside the guest at an address whichcan
Quoted 9 lines
Quoted 1 line
+be determined by evaluating the ADDR package of an ACPI device
with
Quoted 1 line
+_CID "
VM_Gen_Counter".Belongs more in the "Support for Paravirtualisation of HVM Guests" section, which is just below? The "Processor and Platform Features" is more about things which are optional (at least in theory) on real systems.
Ok.
Quoted 8 lines
Since the semantics of the number itself are up to the toolstack and this toolstack defers this requirement up to the user it should probably also say something along the lines of:
The semantics of this value are guest dependent and it is up
to
the user to ensure those semantics are met.
Ok, I'll add something to that effect.
Paul
Quoted 3 lines
(even better would be to implement something meaningful in xl, obviously)
Re: [PATCH] Add code to track the address of the VM generation id buffer across a [and 1 more messages]
In reply to Konrad Rzeszutek WilkKonrad Rzeszutek Wilk writes ("Re: [Xen-devel] [PATCH] Add code to track the address of the VM generation id buffer across a"):
Quoted 1 line
So what is a generation id? What is the use-case for this?
Paul Durrant writes ("Re: [Xen-devel] [PATCH] Add code to track the address of the VM generation id buffer across a"):
Quoted 5 lines
Did you see my previous patch set? The introductory comment was:
-----
The following is a revised patch series to add support for a VM generation ID virtual device for HVM guests. The basic requirements of this device are as follows:
This explains "what" but not "why".
Also, please don't top post.
Ian.
Re: [PATCH] Add code to track the address of the VM generation id buffer across a [and 1 more messages]
Quoted 14 lines
-----Original Message-----
From: Ian Jackson [mailto:[email protected]]
Sent: 01 December 2011 16:42
To: Paul Durrant; Konrad Rzeszutek Wilk
Cc: [email protected]
Subject: Re: [Xen-devel] [PATCH] Add code to track the address of the VM generation id buffer across a [and 1 more messages]Konrad Rzeszutek Wilk writes ("Re: [Xen-devel] [PATCH] Add code to track the address of the VM generation id buffer across a"):
Quoted 1 line
So what is a generation id? What is the use-case for this?
Paul Durrant writes ("Re: [Xen-devel] [PATCH] Add code to track the address of the VM generation id buffer across a"):
Quoted 9 lines
Quoted 4 lines
Did you see my previous patch set? The introductory comment was:
-----
The following is a revised patch series to add support for a VMgeneration ID virtual device for HVM guests.
Quoted 1 line
The basic requirements of this device are as follows:
This explains "what" but not "why".
OK. I already know there is one OS that consumes this interface and another hypervisor that produces it but unfortunately I'm not at liberty to say much more because I'm under NDA. Hopefully a spec. will be forthcoming at some point.
Quoted 2 lines
Also, please don't top post.
Sorry, I wasn't aware that I was.
Paul
Quoted 7 lines · Paul Durrant
diff -r
3c4c29899d8a-r94a17182f386tools/libxc/ia64/xc_ia64_linux_restore.c
---a/tools/libxc/ia64/xc_ia64_linux_restore.cWed Nov 30 07:18:11 2011 -0800
+++b/tools/libxc/ia64/xc_ia64_linux_restore.cWed Nov 30 20:51:07 2011 +0000
tools/libxc/ia64/xc_ia64_linux_restore.c int · line 554
Quoted 8 lines
tools/libxc/ia64/xc_ia64_linux_restore.c +2
-1@@ -548,7 +548,8 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned int store_evtchn, unsigned long *store_mfn, unsigned int console_evtchn, unsigned long *console_mfn, - unsigned int hvm, unsigned int pae, int superpages) + unsigned int hvm, unsigned int pae, int superpages, + uint64_t gid)
This is a uint64_t * in the non-ia64 case. is that right?
tools/libxl/libxl_internal.h Wed Nov 30 20:51:07 2011 +0000 typedef struct { · line 203
Quoted 9 lines
diff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxl_internal.htools/libxl/libxl_internal.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_internal.h Wed Nov 30 07:18:11 2011 -0800 +2
-0@@ -199,6 +199,8 @@ typedef struct { uint32_t console_port; unsigned long console_mfn; + + unsigned long vm_gid_addr;
Is this large enough for a 64 bit guest even with 32 bit tools?
Quoted 26 lines
tools/libxl/libxl_internal.h Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_internal.h Wed Nov 30 07:18:11 2011 -0800 +0
-0} libxl__domain_build_state; _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid,diff -r
3c4c29899d8a-r94a17182f386tools/libxl/libxl_types.idltools/libxl/libxl_types.idl Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/libxl_types.idl Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -183,6 +183,7 @@ libxl_domain_build_info = Struct("domain ("vpt_align", bool), ("timer_mode", integer), ("nested_hvm", bool), + ("generation_id", uint64), ])), ("pv", Struct(None, [("kernel", libxl_file_reference), ("slack_memkb", uint32),diff -r
3c4c29899d8a-r94a17182f386tools/libxl/xl_cmdimpl.ctools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +1
-0@@ -573,6 +573,7 @@ static void parse_config_data(const char { const char *buf; long l; + long long ll; XLU_Config *config; XLU_ConfigList *vbds, *nics, *pcis, *cvfbs, *cpuids; int pci_power_mgmt = 0;
tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 static void parse_config_data(const char · line 769
Quoted 5 lines
tools/libxl/xl_cmdimpl.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/libxl/xl_cmdimpl.c Wed Nov 30 07:18:11 2011 -0800 +2
-0@@ -764,6 +765,8 @@ static void parse_config_data(const char b_info->u.hvm.timer_mode = l; if (!xlu_cfg_get_long (config, "nestedhvm", &l, 0)) b_info->u.hvm.nested_hvm = l; + if (!xlu_cfg_get_long_long (config, "generation_id", &ll, 0)) + b_info->u.hvm.nested_hvm = ll;
Are you you tested this?
Also please patch docs/man/xl.cfg.pod.5 with a description of this new key.
Quoted 16 lines
diff -r
3c4c29899d8a-r94a17182f386tools/xcutils/xc_restore.ctools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_restore.c Wed Nov 30 07:18:11 2011 -0800 +2
-1@@ -23,7 +23,8 @@ main(int argc, char **argv) xc_interface *xch; int io_fd, ret; int superpages; - unsigned long store_mfn, console_mfn; + unsigned long store_mfn, console_mfn, vm_gid_addr; + uint64_t gid; if ( (argc != 8) && (argc != 9) ) errx(1, "usage: %s iofd domid store_evtchn "@@ -40,19 +41,25 @@ main(int argc, char **argv) hvm = atoi(argv[5]); pae = atoi(argv[6]);
tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 main(int argc, char **argv) · line 51
Quoted 10 lines
tools/xcutils/xc_restore.c Wed Nov 30 20:51:07 2011 +0000 renamed from tools/xcutils/xc_restore.c Wed Nov 30 07:18:11 2011 -0800 +5
-1apic = atoi(argv[7]); - if ( argc == 9 ) + if ( argc >= 9 ) superpages = atoi(argv[8]); else superpages = !!hvm; + if ( argc >= 10 ) + gid = strtoll(argv[9], NULL, 0); + else + gid = 0;
I don't think you need to do anything more complex than pass vm_gid_addr as NULL here unless you are also going to patch xend.
I didn't see anywhere which cranked the value on restore, it seems to just propagate the value from the cfg file. Is that actually useful?
Does the user really need to be able to specify the initial value? Would it not be easier to just generate a new value somehow when creating the domain? No ones going to edit their cfg each time they start the vm.
Ian.