Jun Zhu (Intern)
2010-Sep-26 18:30 UTC
[Xen-devel] [PATCH]:libxl__get_free_memory_slack cannot return when creating a vm by xl
Hi, This patch fixes the problem when xl create invokes libxl__get_free_memory_slack which does not return. In the libxl__fill_dom0_memory_info function, if */memory/target is existed, it returns directly, leaving */memory/freemem-slack still empty. I don''t think it is necessory to check */memory/target in the function libxl__fill_dom0_memory_info, since this function is to fill the dom0’s memory info. Moreover, it is not correct to believe that */memory/freemem-slack exists by checking */memory/target. signed-off-by:Jun Zhu<Jun.Zhu@citrix.com> diff -r 0c102f92d61e tools/libxl/libxl.c --- a/tools/libxl/libxl.c Sun Sep 26 18:53:15 2010 +0100 +++ b/tools/libxl/libxl.c Sun Sep 26 19:26:42 2010 +0100 @@ -2779,7 +2779,6 @@ static int libxl__fill_dom0_memory_info( int rc; libxl_dominfo info; libxl_physinfo physinfo; - char *target = NULL, *endptr = NULL; char *target_path = "/local/domain/0/memory/target"; char *max_path = "/local/domain/0/memory/static-max"; char *free_mem_slack_path = "/local/domain/0/memory/freemem-slack"; @@ -2790,19 +2789,6 @@ static int libxl__fill_dom0_memory_info( retry_transaction: t = xs_transaction_start(ctx->xsh); - target = libxl__xs_read(gc, t, target_path); - if (target) { - *target_memkb = strtoul(target, &endptr, 10); - if (*endptr != ''\0'') { - LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, - "invalid memory target %s from %s\n", target, target_path); - rc = ERROR_FAIL; - goto out; - } - rc = 0; - goto out; - } - rc = libxl_domain_info(ctx, &info, 0); if (rc < 0) return rc; @@ -2827,12 +2813,10 @@ retry_transaction: *target_memkb = (uint32_t) info.current_memkb; rc = 0; -out: if (!xs_transaction_end(ctx->xsh, t, 0)) if (errno == EAGAIN) goto retry_transaction; - return rc; } Jun Zhu Citrix Systems UK _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com lists.xensource.com/xen-devel
Stefano Stabellini
2010-Sep-27 10:39 UTC
Re: [Xen-devel] [PATCH]:libxl__get_free_memory_slack cannot return when creating a vm by xl
On Sun, 26 Sep 2010, Jun Zhu (Intern) wrote:> Hi, > > This patch fixes the problem when xl create invokes libxl__get_free_memory_slack which does not return. In the libxl__fill_dom0_memory_info function, if */memory/target is existed, it returns directly, leaving */memory/freemem-slack still empty. > I don''t think it is necessory to check */memory/target in the function libxl__fill_dom0_memory_info, since this function is to fill the dom0???s memory info. Moreover, it is not correct to believe that */memory/freemem-slack exists by checking */memory/target. >How did you get in the state of having the target on xenstore but not freemem-slack? If you are using libxl this shouldn''t be possible unless you mess around with xenstore directly. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com lists.xensource.com/xen-devel
Jun Zhu (Intern)
2010-Sep-27 10:58 UTC
RE: [Xen-devel] [PATCH]:libxl__get_free_memory_slack cannot return when creating a vm by xl
Hi,> How did you get in the state of having the target on xenstore but not > freemem-slack? > If you are using libxl this shouldn''t be possible unless you mess around > with xenstore directly.I did not try to find where target is created. I think the target is created when dom0 starts. I do nothing related with the dom0 infomation in xenstore. But, in my opition, it is not enough to check dom0 memory info only by target. BTW, is it consistent with the xm? Jun Zhu Citrix Systems UK ________________________________________ _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com lists.xensource.com/xen-devel
Stefano Stabellini
2010-Sep-27 11:21 UTC
RE: [Xen-devel] [PATCH]:libxl__get_free_memory_slack cannot return when creating a vm by xl
On Mon, 27 Sep 2010, Jun Zhu (Intern) wrote:> Hi, > > > How did you get in the state of having the target on xenstore but not > > freemem-slack? > > If you are using libxl this shouldn''t be possible unless you mess around > > with xenstore directly. > > I did not try to find where target is created. I think the target is created when dom0 starts. > I do nothing related with the dom0 infomation in xenstore. >Are you starting xend at boot?> But, in my opition, it is not enough to check dom0 memory info only by target.In that case you should add two more checks for the existance of static-max and freemem-slack, printing a warning if only one or two of the nodes are missing (because this state shouldn''t be possible if the user is only using libxl/xl). If some nodes are missing, we should only write those nodes to xenstore without overwriting the informations that are already there. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com lists.xensource.com/xen-devel