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

[Xen-changelog] [xen master] libxl: fix issues in 38cd0664



commit 031655daea9bb0f69ce54a32fea0eab319471d04
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Mon Oct 3 15:46:02 2016 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Oct 4 10:53:41 2016 +0100

    libxl: fix issues in 38cd0664
    
    A few issues were introduced in 38cd0664 ("libxl/arm: Add the size of
    ACPI tables to maxmem"):
    
    1. d_config was not properly initialised and disposed of.
    2. using libxl_retrieve_domain_configuration caused thread to
       deadlock itself.
    
    Fix those issues by:
    
    1. properly initialise and dispose of d_config.
    2. switch to use libxl__get_domain_configuration.
    
    Note that in theory we can refactor libxl_retrieve_domain_configuration
    a bit to get a function without locking, but up until the calculation of
    extra memory only relies on static configuration, hence we use the
    stored configuration only.
    
    Reported-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Tested-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 432e5d9..33c5e4c 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -4029,6 +4029,8 @@ int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t 
domid, uint64_t max_memkb)
     libxl__domain_userdata_lock *lock = NULL;
     libxl_domain_config d_config;
 
+    libxl_domain_config_init(&d_config);
+
     CTX_LOCK;
 
     lock = libxl__lock_domain_userdata(gc, domid);
@@ -4054,7 +4056,7 @@ int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t 
domid, uint64_t max_memkb)
         goto out;
     }
 
-    rc = libxl_retrieve_domain_configuration(ctx, domid, &d_config);
+    rc = libxl__get_domain_configuration(gc, domid, &d_config);
     if (rc < 0) {
         LOGE(ERROR, "unable to retrieve domain configuration");
         goto out;
@@ -4076,6 +4078,7 @@ int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t 
domid, uint64_t max_memkb)
 
     rc = 0;
 out:
+    libxl_domain_config_dispose(&d_config);
     if (lock) libxl__unlock_domain_userdata(lock);
     CTX_UNLOCK;
     GC_FREE;
@@ -4177,6 +4180,8 @@ int libxl_set_memory_target(libxl_ctx *ctx, uint32_t 
domid,
     libxl__domain_userdata_lock *lock;
     libxl_domain_config d_config;
 
+    libxl_domain_config_init(&d_config);
+
     CTX_LOCK;
 
     lock = libxl__lock_domain_userdata(gc, domid);
@@ -4185,7 +4190,7 @@ int libxl_set_memory_target(libxl_ctx *ctx, uint32_t 
domid,
         goto out_no_transaction;
     }
 
-    rc = libxl_retrieve_domain_configuration(ctx, domid, &d_config);
+    rc = libxl__get_domain_configuration(gc, domid, &d_config);
     if (rc < 0) {
         LOGE(ERROR, "unable to retrieve domain configuration");
         goto out_no_transaction;
@@ -4318,6 +4323,7 @@ out:
             goto retry_transaction;
 
 out_no_transaction:
+    libxl_domain_config_dispose(&d_config);
     if (lock) libxl__unlock_domain_userdata(lock);
     CTX_UNLOCK;
     GC_FREE;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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