From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: Re: [PATCH v3 3/3] tools: introduce parameter max_wp_ram_ranges. Date: Mon, 1 Feb 2016 11:57:07 +0000 Message-ID: <20160201115707.GS25660@citrix.com> References: <1454064314-7799-1-git-send-email-yu.c.zhang@linux.intel.com> <1454064314-7799-4-git-send-email-yu.c.zhang@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1454064314-7799-4-git-send-email-yu.c.zhang@linux.intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Yu Zhang Cc: kevin.tian@intel.com, keir@xen.org, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, Paul.Durrant@citrix.com, zhiyuan.lv@intel.com, jbeulich@suse.com, wei.liu2@citrix.com List-Id: xen-devel@lists.xenproject.org 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 > #include > #include > +#include > > #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.