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

[PATCH] libxl/x86: check return value of SHADOW_OP_SET_ALLOCATION domctl


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 28 Jun 2021 13:47:03 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pchRJ7GBXfvuj3yvXkmACQFz+EgDnbCG1su6IHj8H1Y=; b=RPxyrh+nPn0rtEFpm6k4hp8drkFUkaD7W0h/BFNddh2yVw6HpE4Akn7ilYalbtXAnlBh9i/OmQxy0REZjlotS9f7CrWJeuLn3bQFI6IznZxIdR/lmFMwr29HTZNiNYOrW2f2/gB4bvpTJfpZS/MxtwtL4W3gc97H9L8lILbfc1WZ843bCNEmEr+CZsEVdaKkfSOwqM+94tNuRF/KcGcPoCLf8FqnsJ19qFLQDUv2x9v8KaTCQ0eiOCTGzqnIE+A/SvHskU+OV9ca/zOjlmT4Q/jMnK0fsDQ17Q2Y7cV7pEfaw5TgNhAHC+XkJ40IrzFfNsns3bMU8oA7O9beQ1GKdg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KwJzbxCRMpew94cYNpVb3dz0JZYNZLcqkGAAN92Q5FdQP1RjfBbph/HmdtJf5Y6nv4Is9yutQNL/Pt77KSa6qwNyVt81Yv578rlFTT5b+0RJo2Su7Bfwz48d31I9yCwkRENBBbZu7LrUfAagsMW8r9m02Y/X0pbPAvj0ZW18HlMDahWRgEjrbjtbt7sBVS525/nX7WKb8UGQ10N7cwGHw47RzlYr3LN8a+38vjjj1HJlnGbxhVzVtlE72qLfa2w+KoEpse5FqXskKGrVjJBrYXr9DspQbv+REoCFhpaJiVN7KE3ZDn27EgTQZB97RR9C/9ayHifu8b1WZZtr1NknmQ==
  • Authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com;
  • Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Mon, 28 Jun 2021 11:47:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The hypervisor may not have enough memory to satisfy the request.

Requested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Especially if the request was mostly fulfilled, guests may have done
fine despite the failure, so there is a risk of perceived regressions
here. But not checking the error at all was certainly wrong.

--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -531,8 +531,18 @@ int libxl__arch_domain_create(libxl__gc
     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);
+        int rc = xc_shadow_control(ctx->xch, domid,
+                                   XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION,
+                                   NULL, 0, &shadow, 0, NULL);
+
+        if (rc) {
+            LOGED(ERROR, domid,
+                  "Failed to set %s allocation: %d (errno:%d)\n",
+                  libxl_defbool_val(d_config->c_info.hap) ? "HAP" : "shadow",
+                  rc, errno);
+            ret = ERROR_FAIL;
+            goto out;
+        }
     }
 
     if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_PV &&




 


Rackspace

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