From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54B7FC11F64 for ; Thu, 1 Jul 2021 09:37:18 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1916B61449 for ; Thu, 1 Jul 2021 09:37:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1916B61449 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.148326.274122 (Exim 4.92) (envelope-from ) id 1lyt86-0001H5-CI; Thu, 01 Jul 2021 09:37:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 148326.274122; Thu, 01 Jul 2021 09:37:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lyt86-0001Gy-6o; Thu, 01 Jul 2021 09:37:06 +0000 Received: by outflank-mailman (input) for mailman id 148326; Thu, 01 Jul 2021 09:37:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lyt85-0001Gs-4v for xen-devel@lists.xenproject.org; Thu, 01 Jul 2021 09:37:05 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 53b870e0-8784-4b35-93c2-ed344a96744e; Thu, 01 Jul 2021 09:37:02 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 53b870e0-8784-4b35-93c2-ed344a96744e DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1625132222; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=aMEQcTsDPgXtR1BmN6Rp3x+v5tEnrdawfN3Wbzs5MIQ=; b=Gk1bK/9RyibTwUPC5Atdsg/GtMcf08F7ouNdWobZWwiMuN/2P1Qma4nn z56HbMj4kdRJY6ot4g0j3nhr6MMNpdlUqW9tVRceHOJ9I4vqHDtLCPyoK 6Fav301b/Hv5iAmLl5cn9icC50meGBrnJX/aABxHx/OZ8Hphh0a+gOjKg U=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: D7sASBiW/pQzogWFFQWPVDciAodScg54xMExaFQMaLFKTfiUAVd5vN8t7M99S4jCzohkvw2Kt3 bHMkP4dM/TFe8F7qUIcJ+RlejgCz/IlbSxbuQZuY3TU+pLnx95CvIamn9/YJLU9Zmhbp+Lf91E lKrq1jMS+JiidRfnaICSipkHYoVz73/RiuTdiu7GRf1sT5GoqILTVLzQ1bQ4I6rmY039O3iErN AvIr34ve66y9IkNUqLxvx+pgCF4nj81u3ikbi+p48Y7Tg05sqzoA0LpxVbhi8qISeQbLSdrEod LF8= X-SBRS: 5.1 X-MesageID: 47361710 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:aV8rXagP0EaouoqsIqvy4nXxn3BQXtgji2hC6mlwRA09TySZ// rOoB0+726StN9xYgBFpTnuAsW9qB/nmqKdpLNhW4tKPzOW3VdATrsSjrcKqgeIc0aVm9K1l5 0QEZSWYOeAdGSS5vyb3ODXKbgd/OU= X-IronPort-AV: E=Sophos;i="5.83,313,1616472000"; d="scan'208";a="47361710" Date: Thu, 1 Jul 2021 10:36:58 +0100 From: Anthony PERARD To: Jan Beulich CC: "xen-devel@lists.xenproject.org" , "Ian Jackson" , Wei Liu , Andrew Cooper Subject: Re: [PATCH] libxl/x86: check return value of SHADOW_OP_SET_ALLOCATION domctl Message-ID: References: <5d2bb2cf-8c0c-7300-c895-75bef0e50817@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <5d2bb2cf-8c0c-7300-c895-75bef0e50817@suse.com> On Mon, Jun 28, 2021 at 01:47:03PM +0200, Jan Beulich wrote: > The hypervisor may not have enough memory to satisfy the request. > > Requested-by: Andrew Cooper > Signed-off-by: Jan Beulich > --- > 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, Could you use 'r' instead of 'rc' ? The later is reserved for libxl error codes while the former is for system and libxc calls. > + XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION, > + NULL, 0, &shadow, 0, NULL); > + > + if (rc) { xc_shadow_control seems to return "domctl.u.shadow_op.pages" in some cases, are all non-zero return value errors? > + LOGED(ERROR, domid, > + "Failed to set %s allocation: %d (errno:%d)\n", LOGED already prints prints the meaning of the "errno" value, so we don't need to log it. > + libxl_defbool_val(d_config->c_info.hap) ? "HAP" : "shadow", > + rc, errno); Is the return value of xc_shadow_control() actually useful when errno is already logged? Thanks, -- Anthony PERARD