[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen stable-4.12] libxl/x86: check return value of SHADOW_OP_SET_ALLOCATION domctl
commit c6c5f9d8b3e23178341cd7f9b7614a463df74266 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Mon Jul 19 12:28:09 2021 +0200 Commit: Ian Jackson <iwj@xxxxxxxxxxxxxx> CommitDate: Thu Aug 19 17:48:19 2021 +0100 libxl/x86: check return value of SHADOW_OP_SET_ALLOCATION domctl The hypervisor may not have enough memory to satisfy the request. While there, make the unit of the value clear by renaming the local variable. Requested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> backport-requested-by: Jan Beulich <jbeulich@xxxxxxxx> (cherry picked from commit 0be5a00af590c97ea553aadb60f1e0b3af53d8f6) (cherry picked from commit 6bbdcefd205903b2181b3b4fdc9503709ecdb7c4) (cherry picked from commit 61f28060d5b899c502e2b3bf45a39b1dd2a1224c) (cherry picked from commit 3cdc7b6b35106180c9021c1742cafacfa764fdad) --- tools/libxl/libxl_x86.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index c0f88a7eaa..5c1b78722d 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -345,10 +345,20 @@ int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config, xc_domain_set_time_offset(ctx->xch, domid, rtc_timeoffset); if (d_config->b_info.type != LIBXL_DOMAIN_TYPE_PV) { - unsigned long shadow = DIV_ROUNDUP(d_config->b_info.shadow_memkb, - 1024); - xc_shadow_control(ctx->xch, domid, XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION, - NULL, 0, &shadow, 0, NULL); + unsigned long shadow_mb = DIV_ROUNDUP(d_config->b_info.shadow_memkb, + 1024); + int r = xc_shadow_control(ctx->xch, domid, + XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION, + NULL, 0, &shadow_mb, 0, NULL); + + if (r) { + LOGED(ERROR, domid, + "Failed to set %lu MiB %s allocation", + shadow_mb, + libxl_defbool_val(d_config->c_info.hap) ? "HAP" : "shadow"); + ret = ERROR_FAIL; + goto out; + } } if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_PV && -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.12
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |