From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yu, Zhang" Subject: Re: [PATCH v3 3/3] tools: introduce parameter max_wp_ram_ranges. Date: Mon, 1 Feb 2016 23:15:37 +0800 Message-ID: <56AF7699.8090709@linux.intel.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> <20160201115707.GS25660@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20160201115707.GS25660@citrix.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: Wei Liu 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 List-Id: xen-devel@lists.xenproject.org On 2/1/2016 7:57 PM, Wei Liu wrote: > 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. > Thank you, Wei. I'll try to move this part into initiate_domain_create(). B.R. Yu > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel >