claim and its friends for allocating multiple self-ballooning guests.
PATCH v16 1/1 claim and its friends for allocating multiple self-ballooning guests.
Changes since v15:
- Added 'Acked-by: Ian' on many patches.
- Fixed 'xl claims' call to be smarter about reporting information (reworked a patch).
- Fixed 'xl info', free_memory: to also take into account outstanding claims (new patch)
Changes since v14:
- Added 'xl claims' call. Reintroduced the 'outstanding_pages' patches for libxc and libxl.
- Broke up one of the patches line-lengths.
Changes since v13:
- Addressed Ian Jacksons' comments - added extra docs, redid the parsing
of claim_mode.
- s/global_claim_mode/claim_mode/
- Dropped xend patch
- Dropped 'outstanding_pages' patches for libxc and libxl.
Changes since v12:
- Addressed Ian Campbells' comments.
Note that some of the patches could probably be squashed. In the interest of sanity and patience of Ian I choose to not do that - so that he can be assured that the ones he Acked have not changed since the last posting.
That means the only new patches since v14 are:
[PATCH 6/7] xl: 'xl claims' print outstanding per domain claims [PATCH 7/7] xl: Fix 'free_memory' to include outstanding_claims
The patch (mmu: Introduce XENMEM_claim_pages (subop of memory ops) is already in the hypervisor and described in details the problem/solution/alternative solutions. This builds upon that new hypercall to expand the toolstack to utilize it.
The patches follow the normal code-flow - the patch to implement the two
hypercalls: XENMEM_claim_pages and XENMEM_get_outstanding_pages.
Then the patches to utilize them in the libxc. The hypercall's are only utilized if the toolstack (libxl) sets the claim_mode to 1 (true).
Then the toolstack (libxl + xl) patches. They revolve around three different changes:
1). Add 'claim_mode=0|1' global configuration value that determines
whether the claim hypercall should be used as part of guest creation.
2). As part of 'xl info' output how many pages are claimed by different guests.
This is more of a diagnostic patch.
3). New 'xl claims' provides per domain outstanding claim value along with
the guest currently populated count.
These patches are also visible at:
git://xenbits.xen.org/people/konradwilk/xen.git claim.v16
docs/man/xl.conf.pod.5 | 43 ++++++++++++++++++++++++++++ docs/man/xl.pod.1 | 39 +++++++++++++++++++++++++- tools/examples/xl.conf | 6 ++++ tools/libxc/xc_dom.h | 1 + tools/libxc/xc_dom_x86.c | 12 ++++++++ tools/libxc/xc_domain.c | 31 +++++++++++++++++++++ tools/libxc/xc_hvm_build_x86.c | 23 ++++++++++++--- tools/libxc/xenctrl.h | 7 +++++ tools/libxc/xenguest.h | 2 ++ tools/libxl/libxl.c | 19 +++++++++++-- tools/libxl/libxl.h | 2 +- tools/libxl/libxl_create.c | 2 ++ tools/libxl/libxl_dom.c | 3 +- tools/libxl/libxl_types.idl | 3 +- tools/libxl/xl.c | 5 ++++ tools/libxl/xl.h | 2 ++ tools/libxl/xl_cmdimpl.c | 63 ++++++++++++++++++++++++++++++++++++------ tools/libxl/xl_cmdtable.c | 6 ++++ 18 files changed, 251 insertions(+), 18 deletions(-)
Dan Magenheimer (2):
xc: use XENMEM_claim_pages hypercall during guest creation.
xc: export outstanding_pages value in xc_dominfo structure.
Konrad Rzeszutek Wilk (5):
xl: Implement XENMEM_claim_pages support via 'claim_mode' global config
xl: 'xl info' print outstanding claims if enabled (claim_mode=1 in xl.conf)
xl: export 'outstanding_pages' value from xcinfo
xl: 'xl claims' print outstanding per domain claims
xl: Fix 'free_memory' to include outstanding_claims value.
PATCH 1/7 xc: use XENMEM_claim_pages hypercall during guest creation.
From: Dan Magenheimer <[email protected]>
We add an extra parameter to the structures passed to the PV routine (arch_setup_meminit) and HVM routine (setup_guest) that determines whether the claim hypercall is to be done.
The contents of the 'claim_enabled' is defined as an 'int' in case the hypercall expands in the future with extra flags (for example for per-NUMA allocation). For right now the proper values are: 0 to disable it or 1 to enable it.
If the hypervisor does not support this function, the xc_domain_claim_pages and xc_domain_get_outstanding_pages will silently return 0 (and set errno to zero).
--- tools/libxc/xc_dom.h | 1 + tools/libxc/xc_dom_x86.c | 12 ++++++++++++ tools/libxc/xc_domain.c | 30 ++++++++++++++++++++++++++++++ tools/libxc/xc_hvm_build_x86.c | 23 +++++++++++++++++++---- tools/libxc/xenctrl.h | 6 ++++++ tools/libxc/xenguest.h | 2 ++ 6 files changed, 70 insertions(+), 4 deletions(-)
tools/libxc/xc_dom.h +1 -0
@@ -135,6 +135,7 @@ struct xc_dom_image {domid_t guest_domid;int8_t vhpt_size_log2;/* for IA64 */ int8_t superpages; +int claim_enabled;/* 0 by default, 1 enables it */ int shadow_enabled;int xen_version;
tools/libxc/xc_dom_x86.c +12 -0
@@ -706,6 +706,13 @@ int arch_setup_meminit(struct xc_dom_image *dom) }else { +/* try to claim pages for early warning of insufficient memory avail */ +if ( dom->claim_enabled ) { + rc =xc_domain_claim_pages (dom->xch, dom->guest_domid, + dom->total_pages); +if ( rc ) +return rc; + }/* setup initial p2m */ for ( pfn =0 ; pfn < dom->total_pages; pfn++ ) dom->p2m_host[pfn] = pfn;
@@ -722,6 +729,11 @@ int arch_setup_meminit(struct xc_dom_image *dom) dom->xch, dom->guest_domid, allocsz, 0, 0, &dom->p2m_host[i]); } + +/* Ensure no unclaimed pages are left unused. +* OK to call if hadn't done the earlier claim call. */ + (void )xc_domain_claim_pages (dom->xch, dom->guest_domid, +0 /* cancels the claim */ ); }return rc;
tools/libxc/xc_domain.c +30 -0
@@ -775,6 +775,36 @@ int xc_domain_add_to_physmap(xc_interface *xch,return do_memory_op (xch, XENMEM_add_to_physmap, &xatp,sizeof (xatp)); } +int xc_domain_claim_pages (xc_interface *xch, +uint32_t domid, +unsigned long nr_pages) +{ +int err; +struct xen_memory_reservation reservation = { + .nr_extents = nr_pages, + .extent_order =0 , + .mem_flags =0 ,/* no flags */ + .domid = domid + }; + +set_xen_guest_handle (reservation.extent_start,HYPERCALL_BUFFER_NULL ); + + err =do_memory_op (xch, XENMEM_claim_pages, &reservation,sizeof (reservation)); +/* Ignore it if the hypervisor does not support the call. */ +if (err ==-1 && errno ==ENOSYS ) + err = errno =0 ; +return err; +} +unsigned long xc_domain_get_outstanding_pages (xc_interface *xch) +{ +long ret =do_memory_op (xch, XENMEM_get_outstanding_pages,NULL ,0 ); + +/* Ignore it if the hypervisor does not support the call. */ +if (ret ==-1 && errno ==ENOSYS ) + ret = errno =0 ; +return ret; +} + int xc_domain_populate_physmap(xc_interface *xch, uint32_t domid, unsigned long nr_extents,
tools/libxc/xc_hvm_build_x86.c +19 -4
@@ -252,6 +252,7 @@ static int setup_guest(xc_interface *xch,unsigned long stat_normal_pages =0 , stat_2mb_pages =0 , stat_1gb_pages =0 ;int pod_mode =0 ; +int claim_enabled = args->claim_enabled;if ( nr_pages > target_pages ) pod_mode = XENMEMF_populate_on_demand;
@@ -329,6 +330,16 @@ static int setup_guest(xc_interface *xch, xch, dom, 0xa0, 0, pod_mode, &page_array[0x00]); cur_pages =0xc0 ; stat_normal_pages =0xc0 ; + +/* try to claim pages for early warning of insufficient memory available */ +if ( claim_enabled ) { + rc =xc_domain_claim_pages (xch, dom, nr_pages - cur_pages); +if ( rc !=0 ) + { +PERROR ("Could not allocate memory for HVM guest as we cannot claim memory!" ); + goto error_out; + } + }while ( (rc ==0 ) && (nr_pages > cur_pages) ) {/* Clip count to maximum 1GB extent. */
@@ -506,12 +517,16 @@ static int setup_guest(xc_interface *xch,munmap (page0,PAGE_SIZE ); } -free (page_array); -return 0 ; - + rc =0 ; + goto out; error_out: + rc =-1 ; + out: +/* ensure no unclaimed pages are left unused */ +xc_domain_claim_pages (xch, dom,0 /* cancels the claim */ ); +free (page_array); -return -1 ; +return rc; }/* xc_hvm_build:
tools/libxc/xenctrl.h +6 -0
@@ -1129,6 +1129,12 @@ int xc_domain_populate_physmap_exact(xc_interface *xch,unsigned int mem_flags, xen_pfn_t *extent_start); +int xc_domain_claim_pages (xc_interface *xch, +uint32_t domid, +unsigned long nr_pages); + +unsigned long xc_domain_get_outstanding_pages (xc_interface *xch); + int xc_domain_memory_exchange_pages(xc_interface *xch, int domid, unsigned long nr_in_extents,
tools/libxc/xenguest.h +2 -0
@@ -231,6 +231,8 @@ struct xc_hvm_build_args {/* Extra SMBIOS structures passed to HVMLOADER */ struct xc_hvm_firmware_module smbios_module; +/* Whether to use claim hypercall (1 - enable, 0 - disable). */ +int claim_enabled; };/**
Signature · 1 line
1.8.1.4
PATCH 2/7 xl: Implement XENMEM_claim_pages support via 'claim_mode' global config
In reply to Konrad Rzeszutek WilkThe XENMEM_claim_pages hypercall operates per domain and it should be used system wide. As such this patch introduces a global configuration option 'claim_mode' that by default is disabled.
If this option is enabled then when a guest is created there will be an guarantee that there is memory available for the guest. This is an particularly acute problem on hosts with memory over-provisioned guests that use tmem and have self-balloon enabled (which is the default option for them). The self-balloon mechanism can deflate/inflate the balloon quickly and the amount of free memory (which 'xl info' can show) is stale the moment it is printed. When claim is enabled a reservation for the amount of memory ('memory' in guest config) is set, which is then reduced as the domain's memory is populated and eventually reaches zero.
If the reservation cannot be meet the guest creation fails immediately instead of taking seconds/minutes (depending on the size of the guest) while the guest is populated.
Note that to enable tmem type guests, one needs to provide 'tmem' on the Xen hypervisor argument and as well on the Linux kernel command line.
There are two boolean options:
(0) No claim is made. Memory population during guest creation will be attempted as normal and may fail due to memory exhaustion.
(1) Normal memory and freeable pool of ephemeral pages (tmem) is used when calculating whether there is enough memory free to launch a guest. This guarantees immediate feedback whether the guest can be launched due to memory exhaustion (which can take a long time to find out if launching massively huge guests) and in parallel.
[v1: Removed own claim_mode type, using just bool, improved docs, all per Ian's suggestion]
--- docs/man/xl.conf.pod.5 | 41 +++++++++++++++++++++++++++++++++++++++++ tools/examples/xl.conf | 6 ++++++ tools/libxl/libxl.h | 1 - tools/libxl/libxl_create.c | 2 ++ tools/libxl/libxl_dom.c | 3 ++- tools/libxl/libxl_types.idl | 2 +- tools/libxl/xl.c | 5 +++++ tools/libxl/xl.h | 1 + tools/libxl/xl_cmdimpl.c | 2 ++ 9 files changed, 60 insertions(+), 3 deletions(-)
docs/man/xl.conf.pod.5 +41 -0
@@ -115,6 +115,47 @@ Configures the name of the first block device to be used for temporary block device allocations by the toolstack. The default choice is "xvda". +=item B<claim_mode=BOOLEAN> + +If this option is enabled then when a guest is created there will be an +guarantee that there is memory available for the guest. This is an +particularly acute problem on hosts with memory over-provisioned guests +that use tmem and have self-balloon enabled (which is the default +option). The self-balloon mechanism can deflate/inflate the balloon +quickly and the amount of free memory (which C<xl info> can show) is +stale the moment it is printed. When claim is enabled a reservation for +the amount of memory (see 'memory' in xl.conf(5)) is set, which is then +reduced as the domain's memory is populated and eventually reaches zero. + +If the reservation cannot be meet the guest creation fails immediately +instead of taking seconds/minutes (depending on the size of the guest) +while the guest is populated. + +Note that to enable tmem type guests, one needs to provide C<tmem> on the +Xen hypervisor argument and as well on the Linux kernel command line. + +Note that the claim call is not attempted if C<superpages> option is +used in the guest config (see xl.cfg(5)). + +Default: C<0> + +=over 4 + +=item C<0> + +No claim is made. Memory population during guest creation will be +attempted as normal and may fail due to memory exhaustion. + +=item C<1> + +Normal memory and freeable pool of ephemeral pages (tmem) is used when +calculating whether there is enough memory free to launch a guest. +This guarantees immediate feedback whether the guest can be launched due +to memory exhaustion (which can take a long time to find out if launching +massively huge guests). + +=back + =back =head1 SEE ALSO
tools/examples/xl.conf +6 -0
@@ -27,3 +27,9 @@ # default bridge device to use with vif-bridge hotplug scripts #vif.default.bridge="xenbr0" + +# Reserve a claim of memory when launching a guest. This guarantees immediate +# feedback whether the guest can be launched due to memory exhaustion +# (which can take a long time to find out if launching huge guests). +# see xl.conf(5) for details. +#claim_mode=0
tools/libxl/libxl.h +0 -1
@@ -595,7 +595,6 @@ int libxl_wait_for_free_memory(libxl_ctx *ctx, uint32_t domid, uint32_t memory_k/* wait for the memory target of a domain to be reached */ int libxl_wait_for_memory_target (libxl_ctx *ctx,uint32_t domid,int wait_secs); -int libxl_vncviewer_exec (libxl_ctx *ctx,uint32_t domid,int autopass);int libxl_console_exec (libxl_ctx *ctx,uint32_t domid,int cons_num,libxl_console_type type);/* libxl_primary_console_exec finds the domid and console number
tools/libxl/libxl_create.c +2 -0
@@ -196,6 +196,8 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,if (b_info->target_memkb ==LIBXL_MEMKB_DEFAULT ) b_info->target_memkb = b_info->max_memkb; +libxl_defbool_setdefault (&b_info->claim_mode, false); +libxl_defbool_setdefault (&b_info->localtime, false);libxl_defbool_setdefault (&b_info->disable_migrate, false);
tools/libxl/libxl_dom.c +2 -1
@@ -371,6 +371,7 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid, dom->console_domid = state->console_domid; dom->xenstore_evtchn = state->store_port; dom->xenstore_domid = state->store_domid; + dom->claim_enabled =libxl_defbool_val (info->claim_mode);if ( (ret =xc_dom_boot_xen_init (dom, ctx->xch, domid)) !=0 ) {LOGE (ERROR ,"xc_dom_boot_xen_init failed" );
@@ -605,7 +606,7 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,*/ args.mem_size = (uint64_t )(info->max_memkb - info->video_memkb) <<10 ; args.mem_target = (uint64_t )(info->target_memkb - info->video_memkb) <<10 ; - + args.claim_enabled =libxl_defbool_val (info->claim_mode);if (libxl__domain_firmware (gc, info, &args)) {LOG (ERROR ,"initializing domain firmware failed" ); goto out;
tools/libxl/libxl_types.idl +1 -1
@@ -293,7 +293,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("ioports", Array(libxl_ioport_range, "num_ioports")), ("irqs", Array(uint32, "num_irqs")), ("iomem", Array(libxl_iomem_range, "num_iomem")), - + ("claim_mode", libxl_defbool), ("u", KeyedUnion(None, libxl_domain_type, "type", [("hvm", Struct(None, [("firmware", string), ("bios", libxl_bios_type),
tools/libxl/xl.c +5 -0
@@ -46,6 +46,7 @@ char *default_vifscript = NULL;char *default_bridge =NULL ;char *default_gatewaydev =NULL ;enum output_format default_output_format =OUTPUT_FORMAT_JSON ; +libxl_defbool claim_mode;static xentoollog_level minmsglevel =XTL_PROGRESS ;
@@ -168,6 +169,10 @@ static void parse_global_config(const char *configfile, }if (!xlu_cfg_get_string (config,"blkdev_start" , &buf,0 )) blkdev_start =strdup (buf); + +libxl_defbool_setdefault (&claim_mode, false); + (void )xlu_cfg_get_defbool (config,"claim_mode" , &claim_mode,0 ); +xlu_cfg_destroy (config); }
tools/libxl/xl.h +1 -0
@@ -145,6 +145,7 @@ int xl_child_pid(xlchildnum); /* returns 0 if child struct is not in use */extern int autoballoon;extern int run_hotplug_scripts;extern int dryrun_only; +extern libxl_defbool claim_mode;extern char *lockfile;extern char *default_vifscript;extern char *default_bridge;
tools/libxl/xl_cmdimpl.c +2 -0
@@ -757,6 +757,8 @@ static void parse_config_data(const char *config_source,if (!xlu_cfg_get_long (config,"maxmem" , &l,0 )) b_info->max_memkb = l *1024 ; + b_info->claim_mode = claim_mode; +if (xlu_cfg_get_string (config,"on_poweroff" , &buf,0 )) buf ="destroy" ;if (!parse_action_on_shutdown (buf, &d_config->on_poweroff)) {
Signature · 1 line
1.8.1.4
PATCH 3/7 xl: 'xl info' print outstanding claims if enabled (claim_mode=1 in xl.conf)
In reply to Konrad Rzeszutek WilkThis patch provides the value of the currently outstanding pages claimed for all domains. This is a total global value that influences the hypervisors' MM system.
When a claim call is done, a reservation for a specific amount of pages is set and also a global value is incremented. This global value is then reduced as the domain's memory is populated and eventually reaches zero. The toolstack (libxc) also sets the domain's claim to zero when the population of memory has completed as an extra step. Any call to destroy the domain will also set the domain's claim to zero.
If the reservation cannot be meet the guest creation fails immediately instead of taking seconds or minutes (depending on the size of the guest) while the toolstack populates memory.
See patch: "xl: Implement XENMEM_claim_pages support via 'claim_mode' global config" for details on how it is implemented.
The value fluctuates quite often so the value is stale once it is provided to the user-space. However it is useful for diagnostic purposes.
It is only printed when the global "claim_mode" option in xl.conf(5) is set to enabled (1). The 'man xl' shows the details of this item.
--- docs/man/xl.pod.1 | 10 ++++++++++ tools/libxl/libxl.c | 14 ++++++++++++++ tools/libxl/libxl.h | 1 + tools/libxl/xl_cmdimpl.c | 24 ++++++++++++++++++++++++ 4 files changed, 49 insertions(+)
docs/man/xl.pod.1 +10 -0
@@ -704,6 +704,7 @@ Sample output looks as follows: total_memory : 6141 free_memory : 4274 free_cpus : 0 + outstanding_claims : 0 xen_major : 4 xen_minor : 2 xen_extra : -unstable
@@ -738,6 +739,15 @@ the feature bits returned by the cpuid command on x86 platforms. Available memory (in MB) not allocated to Xen, or any other domains. +=item B<outstanding_claims> + +When a claim call is done (see L<xl.conf>) a reservation for a specific +amount of pages is set and also a global value is incremented. This +global value (outstanding_claims) is then reduced as the domain's memory +is populated and eventually reaches zero. Most of the time the value will +be zero, but if you are launching multiple guests, and B<claim_mode> is +enabled, this value can increase/decrease. + =item B<xen_caps> The Xen version and architecture. Architecture values can be one of:
tools/libxl/libxl.c +14 -0
@@ -4057,6 +4057,20 @@ libxl_numainfo *libxl_get_numainfo(libxl_ctx *ctx, int *nr)return ret; } +uint64_t libxl_get_claiminfo (libxl_ctx *ctx) +{ +long l; + + l =xc_domain_get_outstanding_pages (ctx->xch); +if (l <0 ) { +LIBXL__LOG_ERRNOVAL (ctx,LIBXL__LOG_WARNING , l, +"xc_domain_get_outstanding_pages failed." ); +return ERROR_FAIL ; + } +/* In MB */ +return (l >>8 ); +} +const libxl_version_info *libxl_get_version_info (libxl_ctx *ctx) {union {
tools/libxl/libxl.h +1 -0
@@ -595,6 +595,7 @@ int libxl_wait_for_free_memory(libxl_ctx *ctx, uint32_t domid, uint32_t memory_k/* wait for the memory target of a domain to be reached */ int libxl_wait_for_memory_target (libxl_ctx *ctx,uint32_t domid,int wait_secs); +uint64_t libxl_get_claiminfo (libxl_ctx *ctx);int libxl_vncviewer_exec (libxl_ctx *ctx,uint32_t domid,int autopass);int libxl_console_exec (libxl_ctx *ctx,uint32_t domid,int cons_num,libxl_console_type type);/* libxl_primary_console_exec finds the domid and console number
tools/libxl/xl_cmdimpl.c +24 -0
@@ -4666,6 +4666,29 @@ static void output_topologyinfo(void)return ; } +static void output_claim (void ) +{ +long l; + +/* +* Note that the xl.c (which calls us) has already read from the +* global configuration the 'claim_mode' value. +*/ +if (!libxl_defbool_val (claim_mode)) +return ; + + l =libxl_get_claiminfo (ctx); +if (l <0 ) { +fprintf (stderr,"libxl_get_claiminfo failed. errno: %d (%s)\n" , + errno,strerror (errno)); +return ; + } + +printf ("outstanding_claims : %ld\n" , l); + +return ; +} +static void print_info (int numa) {output_nodeinfo ();
@@ -4676,6 +4699,7 @@ static void print_info(int numa)output_topologyinfo ();output_numainfo (); } +output_claim ();output_xeninfo ();
Signature · 1 line
1.8.1.4
PATCH 4/7 xc: export outstanding_pages value in xc_dominfo structure.
In reply to Konrad Rzeszutek WilkFrom: Dan Magenheimer <[email protected]>
This patch provides the value of the currently outstanding pages claimed for a specific domain. This is a value that influences the global outstanding claims value (See patch: "xl: 'xl info' print outstanding claims if enabled") returned via xc_domain_get_outstanding_pages hypercall. This domain value decrements as the memory is populated for the guest and eventually reaches zero.
This patch is neccessary for "xl: export 'outstanding_pages' value from xcinfo" patch.
--- tools/libxc/xc_domain.c | 1 + tools/libxc/xenctrl.h | 1 + 2 files changed, 2 insertions(+)
tools/libxc/xc_domain.c +1 -0
@@ -234,6 +234,7 @@ int xc_domain_getinfo(xc_interface *xch, info->ssidref = domctl.u.getdomaininfo.ssidref; info->nr_pages = domctl.u.getdomaininfo.tot_pages; + info->nr_outstanding_pages = domctl.u.getdomaininfo.outstanding_pages; info->nr_shared_pages = domctl.u.getdomaininfo.shr_pages; info->nr_paged_pages = domctl.u.getdomaininfo.paged_pages; info->max_memkb = domctl.u.getdomaininfo.max_pages << (PAGE_SHIFT -10 );
tools/libxc/xenctrl.h +1 -0
@@ -364,6 +364,7 @@ typedef struct xc_dominfo { hvm:1, debugged:1;unsigned int shutdown_reason;/* only meaningful if shutdown==1 */ unsigned long nr_pages;/* current number, not maximum */ +unsigned long nr_outstanding_pages;unsigned long nr_shared_pages;unsigned long nr_paged_pages;unsigned long shared_info_frame;
Signature · 1 line
1.8.1.4
PATCH 5/7 xl: export 'outstanding_pages' value from xcinfo
In reply to Konrad Rzeszutek WilkThis patch provides the value of the currently outstanding pages claimed for a specific domain. This is a value that influences the global outstanding claims value (See patch: "xl: 'xl info' print outstanding claims if enabled") returned via xc_domain_get_outstanding_pages hypercall. This domain value decrements as the memory is populated for the guest and eventually reaches zero.
With this patch it is possible to utilize this field.
--- tools/libxl/libxl.c | 1 + tools/libxl/libxl_types.idl | 1 + 2 files changed, 2 insertions(+)
tools/libxl/libxl.c +1 -0
@@ -528,6 +528,7 @@ static void xcinfo2xlinfo(const xc_domaininfo_t *xcinfo,else xlinfo->shutdown_reason = ~0 ; + xlinfo->outstanding_memkb =PAGE_TO_MEMKB (xcinfo->outstanding_pages); xlinfo->current_memkb =PAGE_TO_MEMKB (xcinfo->tot_pages); xlinfo->shared_memkb =PAGE_TO_MEMKB (xcinfo->shr_pages); xlinfo->paged_memkb =PAGE_TO_MEMKB (xcinfo->paged_pages);
tools/libxl/libxl_types.idl +1 -0
@@ -196,6 +196,7 @@ libxl_dominfo = Struct("dominfo",[ # Otherwise set to a value guaranteed not to clash with any valid # LIBXL_SHUTDOWN_REASON_* constant. ("shutdown_reason", libxl_shutdown_reason), + ("outstanding_memkb", MemKB), ("current_memkb", MemKB), ("shared_memkb", MemKB), ("paged_memkb", MemKB),
Signature · 1 line
1.8.1.4
PATCH 6/7 xl: 'xl claims' print outstanding per domain claims
In reply to Konrad Rzeszutek WilkThis is similar to "xl: 'xl info' print outstanding claims if enabled (claim_mode=1 in xl.conf)" which exposes the global claim value.
This patch provides the value of the currently outstanding pages claimed for each domains. This is per domain value which is added to the global claim value which influences the hypervisors' MM system.
When a claim call is done, a reservation for a specific amount of pages is set (and this patch lists said number) and also a global value is incremented. This global value is then reduced as the domain's memory is populated and eventually reaches zero.
The toolstack (libxc) also sets the domain's claim to zero when the population of memory has completed as an extra step. Any call to destroy the domain will also set the domain's claim to zero.
If the reservation cannot be meet the guest creation fails immediately instead of taking seconds or minutes (depending on the size of the guest) while the toolstack populates memory.
See patch: "xl: Implement XENMEM_claim_pages support via 'claim_mode' global config" for details on how it is implemented.
The value fluctuates quite often so the value is stale once it is provided to the user-space. However it is useful for diagnostic purposes.
It is printed irregardless of global "claim_mode" option in xl.conf(5). That is b/c the user might have enabled, launched a guest, and then disabled the option - and we should still report the correct outstanding claim value. The 'man xl' shows the details of this argument. The output is close to what 'xl list' looks like:
Name ID Mem VCPUs State Time(s) Claimed
Domain-0 0 2047 4 r----- 19.7 0 OL5 2 2048 1 --p--- 0.0 847 OL6 3 1024 4 r----- 5.9 0 Windows_XP 4 2047 1 --p--- 0.0 1989
[In which it can be seen that the OL5 guest still has 847MB of claimed memory (out of the total 2048MB where 1191MB has been allocated to the guest).]
Please note that the 'Mem' column has the cumulative value of outstanding claims and the total amount of memory that has been allocated to the guest.
--- docs/man/xl.pod.1 | 23 +++++++++++++++++++++++ tools/libxl/libxl.c | 4 ++-- tools/libxl/xl.h | 1 + tools/libxl/xl_cmdimpl.c | 40 ++++++++++++++++++++++++++++++++++++---- tools/libxl/xl_cmdtable.c | 6 ++++++ 5 files changed, 68 insertions(+), 6 deletions(-)
docs/man/xl.pod.1 +23 -0
@@ -780,6 +780,29 @@ explanatory. Prints the current uptime of the domains running. +=item B<claims> + +Prints information about outstanding claims by the guests. This provides +the outstanding claims and currently populated memory count for the guests. +These values added up reflect the global outstanding claim value, which +is provided via the I<info> argument, B<outstanding_claims> value. +The B<Mem> column has the cumulative value of outstanding claims and +the total amount of memory that has been right now allocated to the guest. + +B<EXAMPLE> + +An example format for the list is as follows: + + Name ID Mem VCPUs State Time(s) Claimed + Domain-0 0 2047 4 r----- 19.7 0 + OL5 2 2048 1 --p--- 0.0 847 + OL6 3 1024 4 r----- 5.9 0 + Windows_XP 4 2047 1 --p--- 0.0 1989 + +In which it can be seen that the OL5 guest still has 847MB of claimed +memory (out of the total 2048MB where 1191MB has been allocated to +the guest). + =back =head1 SCHEDULER SUBCOMMANDS
tools/libxl/libxl.c +2 -2
@@ -3865,9 +3865,9 @@ int libxl_wait_for_memory_target(libxl_ctx *ctx, uint32_t domid, int wait_secs) rc =libxl_domain_info (ctx, &info, domid);if (rc <0 )return rc; - }while (wait_secs >0 && info.current_memkb > target_memkb); + }while (wait_secs >0 && (info.current_memkb + info.outstanding_memkb) > target_memkb); -if (info.current_memkb <= target_memkb) +if ((info.current_memkb + info.outstanding_memkb) <= target_memkb) rc =0 ;else rc =ERROR_FAIL ;
tools/libxl/xl.h +1 -0
@@ -83,6 +83,7 @@ int main_vtpmattach(int argc, char **argv);int main_vtpmlist (int argc,char **argv);int main_vtpmdetach (int argc,char **argv);int main_uptime (int argc,char **argv); +int main_claims (int argc,char **argv);int main_tmem_list (int argc,char **argv);int main_tmem_freeze (int argc,char **argv);int main_tmem_thaw (int argc,char **argv);
tools/libxl/xl_cmdimpl.c +36 -4
@@ -3061,7 +3061,8 @@ out: } } -static void list_domains (int verbose,int context,const libxl_dominfo *info,int nb_domain) +static void list_domains (int verbose,int context,int claim, +const libxl_dominfo *info,int nb_domain) {int i;static const char shutdown_reason_letters[]="-rscw" ;
@@ -3069,6 +3070,7 @@ static void list_domains(int verbose, int context, const libxl_dominfo *info, inprintf ("Name ID Mem VCPUs\tState\tTime(s)" );if (verbose)printf (" UUID Reason-Code\tSecurity Label" );if (context && !verbose)printf (" Security Label" ); +if (claim)printf (" Claimed" );printf ("\n" );for (i =0 ; i < nb_domain; i++) {char *domname;
@@ -3078,7 +3080,8 @@ static void list_domains(int verbose, int context, const libxl_dominfo *info, in printf("%-40s %5d %5lu %5d %c%c%c%c%c%c %8.1f", domname, info[i].domid, - (unsigned long) (info[i].current_memkb / 1024), + (unsigned long) ((info[i].current_memkb + + info[i].outstanding_memkb)/ 1024), info[i].vcpu_online, info[i].running ? 'r' : '-', info[i].blocked ? 'b' : '-',
@@ -3095,6 +3098,8 @@ static void list_domains(int verbose, int context, const libxl_dominfo *info, inif (info[i].shutdown)printf (" %8x" , shutdown_reason);else printf (" %8s" ,"-" ); } +if (claim) +printf (" %5lu" , (unsigned long )info[i].outstanding_memkb /1024 );if (verbose || context) {int rc;size_t size;
@@ -4029,7 +4034,7 @@ int main_list(int argc, char **argv)if (details)list_domains_details (info, nb_domain);else -list_domains (verbose, context, info, nb_domain); +list_domains (verbose, context,0 /* claim */ , info, nb_domain);if (info_free)libxl_dominfo_list_free (info, nb_domain);
@@ -4742,7 +4747,8 @@ static void sharing(const libxl_dominfo *info, int nb_domain)printf ("%-40s %5d %5lu %5lu\n" , domname, info[i].domid, - (unsigned long ) (info[i].current_memkb /1024 ), + (unsigned long ) ((info[i].current_memkb + + info[i].outstanding_memkb) /1024 ), (unsigned long ) (info[i].shared_memkb /1024 ));free (domname); }
@@ -5927,6 +5933,32 @@ static char *uptime_to_string(unsigned long uptime, int short_mode)return time_string; } +int main_claims (int argc,char **argv) +{ +libxl_dominfo *info; +int opt; +int nb_domain; + + SWITCH_FOREACH_OPT(opt, "", NULL, "claims", 0) { +/* No options */ + } + +if (!libxl_defbool_val (claim_mode)) +fprintf (stderr,"claim_mode not enabled (see man xl.conf).\n" ); + + info =libxl_list_domain (ctx, &nb_domain); +if (!info) { +fprintf (stderr,"libxl_domain_infolist failed.\n" ); +return 1 ; + } + +list_domains (0 /* verbose */ ,0 /* context */ ,1 /* claim */ , + info, nb_domain); + +libxl_dominfo_list_free (info, nb_domain); +return 0 ; +} +static char *current_time_to_string (time_t now) {char now_str[100 ];
tools/libxl/xl_cmdtable.c +6 -0
@@ -362,6 +362,12 @@ struct cmd_spec cmd_table[] = {"Print uptime for all/some domains" ,"[-s] [Domain]" , }, + { "claims", + &main_claims,0 ,0 , +"List outstanding claim information about all domains" , +"" , +"" , + }, { "tmem-list", &main_tmem_list,0 ,0 , "List tmem pools",
Signature · 1 line
1.8.1.4
Re: [PATCH 6/7] xl: 'xl claims' print outstanding per domain claims
Konrad Rzeszutek Wilk writes ("[PATCH 6/7] xl: 'xl claims' print outstanding per domain claims"):
Quoted 2 lines
This is similar to "xl: 'xl info' print outstanding claims if enabled (claim_mode=1 in xl.conf)" which exposes the global claim value.
PATCH 7/7 xl: Fix 'free_memory' to include outstanding_claims value.
In reply to Konrad Rzeszutek WilkUpdating to make it clear that free_memory reported by 'xl info' is influenced by the outstanding claim value. That is the free memory that will be available to the host once all outstanding claims have been completed. This modifies the behavior that the patch titled "xl: 'xl info' print outstanding claims if enabled (claim_mode=1 in xl.conf)" had - which reported the outstanding claims and nothing else.
The free_pages as reported by the hypervisor is the currently available count of pages on the heap. The outstanding pages is the total amount of pages reserved for guests (so not taken from the heap yet). As guests are being populated the memory from the heap shrinks and the outstanding count of pages decreases. The total memory used for guests increases.
As the available count of pages on the heap and outstanding claims are intertwined, report the amount of free memory available to be a combination of that. That is free heap memory minus the outstanding pages.
We also make some odd choices in reporting. By default we will only display 'outstanding_claims' if the claim_mode is enabled in the global configuration file. However, if there are outstanding claims, we will ignore the claim_mode and report these values.
--- docs/man/xl.conf.pod.5 | 2 ++ docs/man/xl.pod.1 | 8 ++++++-- tools/libxl/libxl.c | 4 ++-- tools/libxl/xl_cmdimpl.c | 45 +++++++++++++++++---------------------------- 4 files changed, 27 insertions(+), 32 deletions(-)
docs/man/xl.conf.pod.5 +2 -0
@@ -126,6 +126,8 @@ quickly and the amount of free memory (which C<xl info> can show) is stale the moment it is printed. When claim is enabled a reservation for the amount of memory (see 'memory' in xl.conf(5)) is set, which is then reduced as the domain's memory is populated and eventually reaches zero. +The free memory in C<xl info> is the combination of the hypervisor's +free heap memory minus the outstanding claims value. If the reservation cannot be meet the guest creation fails immediately instead of taking seconds/minutes (depending on the size of the guest)
docs/man/xl.pod.1 +6 -2
@@ -737,7 +737,8 @@ the feature bits returned by the cpuid command on x86 platforms. =item B<free_memory> -Available memory (in MB) not allocated to Xen, or any other domains. +Available memory (in MB) not allocated to Xen, or any other domains, or +claimed for domains. =item B<outstanding_claims>
@@ -746,7 +747,10 @@ amount of pages is set and also a global value is incremented. This global value (outstanding_claims) is then reduced as the domain's memory is populated and eventually reaches zero. Most of the time the value will be zero, but if you are launching multiple guests, and B<claim_mode> is -enabled, this value can increase/decrease. +enabled, this value can increase/decrease. Note that the value also +affects the B<free_memory> - as it will reflect the free memory +in the hypervisor minus the outstanding pages claimed for guests. +See xl I<info> B<claims> parameter for detailed listing. =item B<xen_caps>
tools/libxl/libxl.c +2 -2
@@ -4068,8 +4068,8 @@ uint64_t libxl_get_claiminfo(libxl_ctx *ctx) "xc_domain_get_outstanding_pages failed.");return ERROR_FAIL ; } -/* In MB */ -return (l >>8 ); +/* In pages */ +return l; }const libxl_version_info *libxl_get_version_info (libxl_ctx *ctx)
tools/libxl/xl_cmdimpl.c +17 -28
83 lines not on this page · raw message
Signature · 1 line
1.8.1.4
Re: [PATCH 7/7] xl: Fix 'free_memory' to include outstanding_claims value.
Konrad Rzeszutek Wilk writes ("[PATCH 7/7] xl: Fix 'free_memory' to include outstanding_claims value."):
Quoted 17 lines
Updating to make it clear that
free_memoryreported by 'xl info' is influenced by the outstanding claim value. [...]if (libxl_get_physinfo(ctx, &info) != 0) { fprintf(stderr, "libxl_physinfo failed.\n"); return; }tools/libxl/xl_cmdimpl.c +9
-1- +/* +* Don't bother checking "claim_mode" as user might have turned it off +* and we have outstanding claims. +*/ +if ((claims =libxl_get_claiminfo (ctx)) <0 ){ +fprintf (stderr,"libxl_get_claiminfo failed. errno: %d (%s)\n" , + errno,strerror (errno)); +return ; + }
...
Quoted 1 line
+
printf("free_memory : %"PRIu64"\n", (info.free_pages - claims) / i);
This has a race, I think.
Ian.
Ian Jackson
Acked-byRe: [PATCH 7/7] xl: Fix 'free_memory' to include outstanding_claims value.
Ian Jackson writes ("Re: [PATCH 7/7] xl: Fix 'free_memory' to include outstanding_claims value."):
Quoted 18 lines
Konrad Rzeszutek Wilk writes ("[PATCH 7/7] xl: Fix '
free_memory' to includeoutstanding_claimsvalue."):Quoted 7 lines
Updating to make it clear that
free_memoryreported by 'xl info' is influenced by the outstanding claim value. [...]if (libxl_get_physinfo(ctx, &info) != 0) { fprintf(stderr, "libxl_physinfo failed.\n"); return; }tools/libxl/xl_cmdimpl.c static void output_physinfo(void) · line 4592
Quoted 10 lines
tools/libxl/xl_cmdimpl.c +9
-1- +/* +* Don't bother checking "claim_mode" as user might have turned it off +* and we have outstanding claims. +*/ +if ((claims =libxl_get_claiminfo (ctx)) <0 ){ +fprintf (stderr,"libxl_get_claiminfo failed. errno: %d (%s)\n" , + errno,strerror (errno)); +return ; + }
Quoted 4 lines
...
Quoted 1 line
+
printf("free_memory : %"PRIu64"\n", (info.free_pages - claims) / i);This has a race, I think.
I have checked this and the race is in the hypercall API. The hypercall API has already been checked in. So, under the circumstances, for this patch:
However, there is a release-critical bug here. The following things need to be changed:
* We need a race-free version of the hypercall API.
* We need a race-free version of the xc API.
* We need a race-free version of the libxl API.
I think this is a release-critical bug because fixing it involves an API change at all these 3 levels. We don't want to release 4.3 with a broken API as that will complicate fixing this bug.
George, can you please add this to your tracking list ?
Having said all that, George, am I OK from a freeze POV to pull Konrad's series into staging ?
Ian.
Re: [PATCH 7/7] xl: Fix 'free_memory' to include outstanding_claims value.
Quoted 18 lines · Ian Jackson
Ian Jackson writes ("Re: [PATCH 7/7] xl: Fix '
free_memory' to includeoutstanding_claimsvalue."):Quoted 17 lines
Konrad Rzeszutek Wilk writes ("[PATCH 7/7] xl: Fix '
free_memory' to includeoutstanding_claimsvalue."):Quoted 16 lines
Updating to make it clear that
free_memoryreported by 'xl info' is influenced by the outstanding claim value. [...]if (libxl_get_physinfo(ctx, &info) != 0) { fprintf(stderr, "libxl_physinfo failed.\n"); return; }tools/libxl/xl_cmdimpl.c +9
-1- +/* +* Don't bother checking "claim_mode" as user might have turned it off +* and we have outstanding claims. +*/ +if ((claims =libxl_get_claiminfo (ctx)) <0 ){ +fprintf (stderr,"libxl_get_claiminfo failed. errno: %d (%s)\n" , + errno,strerror (errno)); +return ; + }
Quoted 9 lines
Quoted 3 lines
...
Quoted 1 line
+
printf("free_memory : %"PRIu64"\n", (info.free_pages - claims) / i);This has a race, I think.
I have checked this and the race is in the hypercall API. The hypercall API has already been checked in. So, under the circumstances, for this patch:
Acked-by Ian Jackson <[email protected]>
Great! Thanks.
Quoted 10 lines
However, there is a release-critical bug here. The following things need to be changed:
* We need a race-free version of the hypercall API.
* We need a race-free version of the xc API.
* We need a race-free version of the libxl API.I think this is a release-critical bug because fixing it involves an API change at all these 3 levels. We don't want to release 4.3 with a broken API as that will complicate fixing this bug.
Right. Let me enumerate some ideas for fixing this on a different thread (if we have the same race in mind that you spotted).
Quoted 5 lines
George, can you please add this to your tracking list ?
Having said all that, George, am I OK from a freeze POV to pull Konrad's series into staging ?
Would you like me to rebase it once more with the s/def_bool/int/ and the resurrection of a line change? I can repost just against the offending patch?
I might be a bit late with doing it (Tuesday night) since I am traveling today.
Quoted 2 lines
Ian.
Re: [PATCH 7/7] xl: Fix 'free_memory' to include outstanding_claims value.
konrad wilk writes ("Re: [PATCH 7/7] xl: Fix 'free_memory' to include outstanding_claims value."):
Quoted 4 lines · Ian Jackson
Quoted 3 lines
I have checked this and the race is in the hypercall API. The hypercall API has already been checked in. So, under the circumstances, for this patch:
...
Quoted 2 lines
Right. Let me enumerate some ideas for fixing this on a different thread (if we have the same race in mind that you spotted).
The race I'm thinking of is this:
When we display the effective amount of free memory (in "xl info" etc.), we calculate it as
physinfo->free_pages - xc_domain_get_outstanding_pages()
But these two values have been retrieved at different times. So while a domain is being built and memory moves from "free but claimed" to "in use", the free memory visible via the libxl API will sometimes be "wrong".
This may seem like a minor point, but it will show up as occasional glitches in automatic monitoring and graphing systems; it might even trigger spurious nagios alerts in higher layers etc. If that was all there was to it I wouldn't regard it as a release-critical bug - a race like that would be annoying but could be fixed later.
However, the race is baked into the hypercall API/ABI which we want to keep relatively stable at least in stable releases.
I think the right answer is probably simply to move the total claim value into the physinfo struct, and do away with the separate XENMEM_get_outstanding_pages memory op hypercall. Do you agree ?
Thanks,
Ian.
Re: [PATCH 7/7] xl: Fix 'free_memory' to include outstanding_claims value.
Quoted 26 lines · Ian Jackson
konrad wilk writes ("Re: [PATCH 7/7] xl: Fix '
free_memory' to includeoutstanding_claimsvalue."):Quoted 4 lines · Ian Jackson
Quoted 3 lines
I have checked this and the race is in the hypercall API. The hypercall API has already been checked in. So, under the circumstances, for this patch:
...
Quoted 2 lines
Right. Let me enumerate some ideas for fixing this on a different thread (if we have the same race in mind that you spotted).
The race I'm thinking of is this:
When we display the effective amount of free memory (in "xl info" etc.), we calculate it as
physinfo->free_pages-xc_domain_get_outstanding_pages()But these two values have been retrieved at different times. So while a domain is being built and memory moves from "free but claimed" to "in use", the free memory visible via the libxl API will sometimes be "wrong".
This may seem like a minor point, but it will show up as occasional glitches in automatic monitoring and graphing systems; it might even trigger spurious nagios alerts in higher layers etc. If that was all there was to it I wouldn't regard it as a release-critical bug - a race like that would be annoying but could be fixed later.
Quoted 6 lines
However, the race is baked into the hypercall API/ABI which we want to keep relatively stable at least in stable releases.
I think the right answer is probably simply to move the total claim value into the physinfo struct, and do away with the separate
XENMEM_get_outstanding_pagesmemory op hypercall. Do you agree ?
FWIW, I think this is a good idea. You might have to be a little careful on the hypervisor side to make sure the two values are actually a matched pair (say by taking the page allocator lock).
Tim.
Re: [PATCH 7/7] xl: Fix 'free_memory' to include outstanding_claims value.
Quoted 30 lines · Tim Deegan
Quoted 29 lines · Ian Jackson
konrad wilk writes ("Re: [PATCH 7/7] xl: Fix '
free_memory' to includeoutstanding_claimsvalue."):Quoted 4 lines · Ian Jackson
Quoted 3 lines
I have checked this and the race is in the hypercall API. The hypercall API has already been checked in. So, under the circumstances, for this patch:
...
Quoted 2 lines
Right. Let me enumerate some ideas for fixing this on a different thread (if we have the same race in mind that you spotted).
The race I'm thinking of is this:
When we display the effective amount of free memory (in "xl info" etc.), we calculate it as
physinfo->free_pages-xc_domain_get_outstanding_pages()But these two values have been retrieved at different times. So while a domain is being built and memory moves from "free but claimed" to "in use", the free memory visible via the libxl API will sometimes be "wrong".
This may seem like a minor point, but it will show up as occasional glitches in automatic monitoring and graphing systems; it might even trigger spurious nagios alerts in higher layers etc. If that was all there was to it I wouldn't regard it as a release-critical bug - a race like that would be annoying but could be fixed later.
However, the race is baked into the hypercall API/ABI which we want to keep relatively stable at least in stable releases.
Quoted 7 lines
Quoted 3 lines
I think the right answer is probably simply to move the total claim value into the physinfo struct, and do away with the separate
XENMEM_get_outstanding_pagesmemory op hypercall. Do you agree ?FWIW, I think this is a good idea. You might have to be a little careful on the hypervisor side to make sure the two values are actually a matched pair (say by taking the page allocator lock).
<nods> Going to prep a patch for that. I might not have it ready this week as Linus merge window is immienient and I need to queue up patches (And test).
And then right after that I am out for a week.
But after that - I will have the patch ready.
Quoted 2 lines
Tim.
Re: [PATCH 7/7] xl: Fix 'free_memory' to include outstanding_claims value.
In reply to Konrad Rzeszutek WilkQuoted 7 lines · Konrad Rzeszutek Wilk
tools/libxl/xl_cmdimpl.c +0
-0
tools/libxl/xl_cmdimpl.c static void output_physinfo(void) · line 4631
Quoted 7 lines
tools/libxl/xl_cmdimpl.c +0
-1@@ -4611,7 +4626,6 @@ static void output_physinfo(void)printf ("free_cpus : %d\n" , n);free (cpumap.map); } -libxl_physinfo_dispose (&info);return ; }
What did this poor, empty, line do wrong, for deserving being "killed"? :-P
Dario
Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
Re: [PATCH 7/7] xl: Fix 'free_memory' to include outstanding_claims value.
Quoted 7 lines · Dario Faggioli
Quoted 5 lines · Konrad Rzeszutek Wilk
tools/libxl/xl_cmdimpl.c +0
-0
Quoted 11 lines
tools/libxl/xl_cmdimpl.c static void output_physinfo(void) · line 4631
Quoted 9 lines
tools/libxl/xl_cmdimpl.c +0
-1@@ -4611,7 +4626,6 @@ static void output_physinfo(void)printf ("free_cpus : %d\n" , n);free (cpumap.map); } -libxl_physinfo_dispose (&info);return ; }What did this poor, empty, line do wrong, for deserving being "killed"? :-P
It initially offended me by being so nicely placed. But your effective plea for its resurrection convinced me that it should be brought back. The upcoming patch shall have it restored
Konrad Rzeszutek Wilk writes ("[PATCH v16] claim and its friends for allocating multiple self-ballooning guests."):
Quoted 3 lines
Note that some of the patches could probably be squashed. In the interest of sanity and patience of Ian I choose to not do that - so that he can be assured that the ones he Acked have not changed since the last posting.
As discussed, I have rebased this to staging and pushed it.
George, did you put the interface race on your 4.3 tracking list ?
Ian.
Quoted 7 lines · Ian Jackson
Konrad Rzeszutek Wilk writes ("[PATCH v16] claim and its friends for allocating multiple self-ballooning guests."):
Quoted 3 lines
Note that some of the patches could probably be squashed. In the interest of sanity and patience of Ian I choose to not do that - so that he can be assured that the ones he Acked have not changed since the last posting.
As discussed, I have rebased this to staging and pushed it.
George, did you put the interface race on your 4.3 tracking list ?
Yes:
* Race condition in claim hypercall
owner: Ian Jackson, Konrad Wilk
-George
Is: [GIT PULL) (claim.v17) against Xen 4.3-rc0. Was:Re: [PATCH v16] claim and its friends for allocating multiple self-ballooning guests.
In reply to Konrad Rzeszutek WilkOn Fri, Apr 12, 2013 at 04:56:14PM -0400, Konrad Rzeszutek Wilk wrote:
I've updated a new version (v17), to be:
- Added 'Acked-by' on the last two patches
- Restored the inadvertent drive-by-line-killing.
Quoted 6 lines
Changes since v15:
- Added 'Acked-by: Ian' on many patches.
- Fixed 'xl claims' call to be smarter about reporting information (reworked a patch).
- Fixed 'xl info',free_memory: to also take into account outstanding claims (new patch)
.. snip.
Quoted 3 lines
These patches are also visible at:
git://xenbits.xen.org/people/konradwilk/xen.gitclaim.v16
And the new version is:
git://xenbits.xen.org/people/konradwilk/xen.git claim.v17
All patches are Acked-by. There are two bugs that need to be fixed before Xen 4.3 comes out:
1). Ian Jacksons' observation about race:
* We need a race-free version of the hypercall API.
* We need a race-free version of the xc API.
* We need a race-free version of the libxl API.
2). defbool vs int and the 'claim_mode' usage.
docs/man/xl.conf.pod.5 | 43 +++++++++++++++++++++++++++++ docs/man/xl.pod.1 | 39 +++++++++++++++++++++++++- tools/examples/xl.conf | 6 ++++ tools/libxc/xc_dom.h | 1 + tools/libxc/xc_dom_x86.c | 12 ++++++++ tools/libxc/xc_domain.c | 31 +++++++++++++++++++++ tools/libxc/xc_hvm_build_x86.c | 23 +++++++++++++--- tools/libxc/xenctrl.h | 7 +++++ tools/libxc/xenguest.h | 2 ++ tools/libxl/libxl.c | 19 +++++++++++-- tools/libxl/libxl.h | 2 +- tools/libxl/libxl_create.c | 2 ++ tools/libxl/libxl_dom.c | 3 +- tools/libxl/libxl_types.idl | 3 +- tools/libxl/xl.c | 5 ++++ tools/libxl/xl.h | 2 ++ tools/libxl/xl_cmdimpl.c | 62 +++++++++++++++++++++++++++++++++++++----- tools/libxl/xl_cmdtable.c | 6 ++++ 18 files changed, 251 insertions(+), 17 deletions(-)
Dan Magenheimer (2):
xc: use XENMEM_claim_pages hypercall during guest creation.
xc: export outstanding_pages value in xc_dominfo structure.
Konrad Rzeszutek Wilk (5):
xl: Implement XENMEM_claim_pages support via 'claim_mode' global config
xl: 'xl info' print outstanding claims if enabled (claim_mode=1 in xl.conf)
xl: export 'outstanding_pages' value from xcinfo
xl: 'xl claims' print outstanding per domain claims
xl: Fix 'free_memory' to include outstanding_claims value.