[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] 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> --- Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> CC: Shannon Zhao <shannon.zhao@xxxxxxxxxx> Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx> --- 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; -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |