All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxl/x86: check return value of SHADOW_OP_SET_ALLOCATION domctl
@ 2021-06-28 11:47 Jan Beulich
  2021-06-28 15:59 ` Andrew Cooper
  2021-07-01  9:36 ` Anthony PERARD
  0 siblings, 2 replies; 8+ messages in thread
From: Jan Beulich @ 2021-06-28 11:47 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Wei Liu, Anthony Perard, Andrew Cooper

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

Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
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 &&



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-07-02 15:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28 11:47 [PATCH] libxl/x86: check return value of SHADOW_OP_SET_ALLOCATION domctl Jan Beulich
2021-06-28 15:59 ` Andrew Cooper
2021-07-01  9:36 ` Anthony PERARD
2021-07-02 12:29   ` Jan Beulich
2021-07-02 14:46     ` Anthony PERARD
2021-07-02 15:12       ` Jan Beulich
2021-07-02 15:14         ` Jan Beulich
2021-07-02 15:51           ` Anthony PERARD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.