[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 3/3] tools: introduce parameter max_wp_ram_ranges.



On Fri, Jan 29, 2016 at 06:45:14PM +0800, Yu Zhang wrote:
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 25507c7..0c19dee 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -35,6 +35,7 @@
>  #include <inttypes.h>
>  #include <limits.h>
>  #include <xen/hvm/e820.h>
> +#include <xenctrl.h>
>  
>  #include "libxl.h"
>  #include "libxl_utils.h"
> @@ -1626,6 +1627,22 @@ static void parse_config_data(const char 
> *config_source,
>  
>          if (!xlu_cfg_get_long (config, "rdm_mem_boundary", &l, 0))
>              b_info->u.hvm.rdm_mem_boundary_memkb = l * 1024;
> +
> +        if (!xlu_cfg_get_long (config, "max_wp_ram_ranges", &l, 0)) {
> +            uint64_t nr_pages = (b_info->max_memkb << 10) >> XC_PAGE_SHIFT;
> +
> +            /* Due to rangeset's ability to combine continuous ranges, this
> +             * parameter shall not be configured with values greater than 
> half
> +             * of the number of VM's page frames. It also shall not exceed 
> 4G,
> +             * because of the limitation from the rangeset side. */
> +            if (l > (nr_pages / 2) || l > UINT32_MAX) {
> +                fprintf(stderr, "ERROR: Invalid value for 
> \"max_wp_ram_ranges\". "
> +                        "Shall not exceed %ld or 4G.\n", nr_pages / 2);
> +                exit(1);
> +            }
> +            b_info->u.hvm.max_wp_ram_ranges = l;
> +        }
> +

Xl is only one of the applications that use libxl (the library).  This
check should be inside libxl so that all applications (xl, libvirt and
others) have the same behaviour.

Take a look at initiate_domain_create where numerous validations are
done.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.