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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 28 Jun 2021 16:59:15 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=I1LhmWwCqtXrWqJaeO70GCgK0KHVkduuA9tc0a5w+b4=; b=MtpMtsNqbQMyPjtrwzo0Qkx1l+02soA4y1TqBEs55HtvAw93kaprNdYpV4lA8Dg3ChaIOv8VY7ZK0uT5mEjDjuh81cRKZ6iuZnqNqgfJ5nL1sREwm8ivGiIusMSyH2gfPToVZrJSxivh147rOBHAqHdfO1v9MJXEPisdXGFLVVtFXzmACQgr6fpGmlvcZ74OVtFGeIVKW5Xn5YPC/8FU9wM3ZDCYBYgVMJ764MeRYbZ9/Rjsh7zBrkOTKerRiCGaXo/cuy/6xYNtWjCn0hX/XRoK//f20PN4xjgjAP6EcLgsaJ3HgwR+SefyRiYin0bjJg4hPCJcVgaoxKgEYeT4pQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qe8GQsrSR5EEhLLCYPE3bNxwrPCiNNREx9xG1xnOU0ImNB07u231FiX/rg3DGAGuxojl+AJa9Fdcbdahp6NsowhEegO8U/FCo5gOp0leDYa0jxmVLJ1KZLdYnIYT0NWKTwq74Fz09dSjNEEOm9Y/ID1LICGbDc/XAvFPSi0P92BM++leDAWXf8+FMImc3AWSA0Hqy3EEeYY+ccoj+ZTGdFmIoTbc1Wb76Wm/j+NuMD55RnSNifiMZdyhJQCAdgFDbCC4NnUIVYO8JDvg93aml7PX+tYV95RT3yoygOiurRcAuTVDD+FH+vU2rc5egDqjSaKSWuW5Jm2WyBv9ZXrdVw==
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Mon, 28 Jun 2021 15:59:44 +0000
  • Ironport-hdrordr: A9a23:DAo0hq5eVtELRLhEHAPXwAzXdLJyesId70hD6qkQc3Fom62j5q WTdZEgvyMc5wx/ZJhNo7690cq7MBHhHPxOgbX5VI3KNGXbUQOTR72KhrGSoAEIdReeygZcv5 0QCZSXCrfLfCVHZRCR2njFLz4iquP3j5xBnY3lvhNQpZkBUdAZ0+9+YDzrdXFedU19KrcSMo GT3cZDryrIQwVtUizqbkN1OdQqvrfw5evbXSI=
  • Ironport-sdr: kOlcXvqGIFcGmP5ynFV8Om4x2BF4DDUzavt4O1RygXpy5Sl4vEoWKnGc3cNbWKggHuzZyUE058 6j3a1vyOSwWhBDI9vcQ+RoYe7eeyhi3nd1pDSRwPLwikCATvl2ksHThB2ONaKrsQE+BYiZS3WF I+kjtei4Z5kL0qV9q3ESZ+VqaO8XYXsBsDyZ3iIPNNHOkUnypPYrZfAwe3GgXNYMn9SS5/THGK aWiGFHOBU0M/6Xy/N22YuAQ9vxHc62zNVI1J6EvkZACpBuFMKfDQTF4D2KrEjL8sG5Iwj0aFn9 K3w=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28/06/2021 12:47, Jan Beulich wrote:
> 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",

The error message wants to include the value of shadow, just in case the
cause of the failure is because the value is stupidly high.

Having traced the number through, the local variable wants to be named
shadow_mb to try and make the units clearer.  (Also - why on earth do we
have a hypercall which takes integer units of MB, and a memkb field in
the config file...)

Otherwise, Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>




 


Rackspace

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