diff mbox

xl: don't free additional memory on soft reset

Message ID 1453978705-13504-1-git-send-email-vkuznets@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vitaly Kuznetsov Jan. 28, 2016, 10:58 a.m. UTC
We don't need to free anything extra from Dom0 in order to perform soft
reset. It can also fail soft reset if it happens that we don't have this
memory (which we don't need) available.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 tools/libxl/xl_cmdimpl.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Wei Liu Feb. 1, 2016, 10:39 a.m. UTC | #1
On Thu, Jan 28, 2016 at 11:58:25AM +0100, Vitaly Kuznetsov wrote:
> We don't need to free anything extra from Dom0 in order to perform soft
> reset. It can also fail soft reset if it happens that we don't have this
> memory (which we don't need) available.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  tools/libxl/xl_cmdimpl.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 25507c7..20704d2 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -2867,11 +2867,13 @@ start:
>      if (rc < 0)
>          goto error_out;
>  
> -    ret = freemem(domid, &d_config.b_info);
> -    if (ret < 0) {
> -        fprintf(stderr, "failed to free memory for the domain\n");
> -        ret = ERROR_FAIL;
> -        goto error_out;
> +    if (domid_soft_reset == INVALID_DOMID) {
> +        ret = freemem(domid, &d_config.b_info);
> +        if (ret < 0) {
> +            fprintf(stderr, "failed to free memory for the domain\n");
> +            ret = ERROR_FAIL;
> +            goto error_out;
> +        }
>      }
>  
>      libxl_asyncprogress_how autoconnect_console_how_buf;
> -- 
> 2.5.0
>
Ian Campbell Feb. 3, 2016, 11:48 a.m. UTC | #2
On Mon, 2016-02-01 at 10:39 +0000, Wei Liu wrote:
> On Thu, Jan 28, 2016 at 11:58:25AM +0100, Vitaly Kuznetsov wrote:
> > We don't need to free anything extra from Dom0 in order to perform soft
> > reset. It can also fail soft reset if it happens that we don't have
> > this
> > memory (which we don't need) available.
> > 
> > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>

Applied.
diff mbox

Patch

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 25507c7..20704d2 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -2867,11 +2867,13 @@  start:
     if (rc < 0)
         goto error_out;
 
-    ret = freemem(domid, &d_config.b_info);
-    if (ret < 0) {
-        fprintf(stderr, "failed to free memory for the domain\n");
-        ret = ERROR_FAIL;
-        goto error_out;
+    if (domid_soft_reset == INVALID_DOMID) {
+        ret = freemem(domid, &d_config.b_info);
+        if (ret < 0) {
+            fprintf(stderr, "failed to free memory for the domain\n");
+            ret = ERROR_FAIL;
+            goto error_out;
+        }
     }
 
     libxl_asyncprogress_how autoconnect_console_how_buf;