From patchwork Fri Jan 9 15:56:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 42911 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 47A9D26CF1 for ; Fri, 9 Jan 2015 15:59:13 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id gq15sf8348319lab.3 for ; Fri, 09 Jan 2015 07:59:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:cc:subject :precedence:list-id:list-unsubscribe:list-post:list-help :list-subscribe:mime-version:content-type:content-transfer-encoding :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=SixdP0s0CGjwslr6skcfjb6D2rcdo3vkX0tXIjY9Id8=; b=aLuHUyUnaXjyzhl6uipWZ+g8D5g5VPRtjph6ujdBHikSqyjzIZGEQZ/wCPJ6xe9T69 OB51OJiy3iRVRDefnrQ3F17XMi6LEnXnqLFuIcITKGaN1ARL+ZrcV8cGW68HzW81K+W2 11vgmKqXnVX6qgkYmxBvA+tjadEvuXtp0A/YbZwEAvdEFqT6V2dvP8JgD4EzT6DdYNiP ENfmFiZfb2q5ZBqAQdkRTFuuG6DWbDO3rQPeZp3bM7oVwwJk36VAeJxAr2hSulmCOZDI KNAvlLEQUYiTM6O3reJ8/1bd/6j7GpW0APwStWeHOu+p9EyRoOIcHeQ1hgy1AkPMiZGY nzmA== X-Gm-Message-State: ALoCoQk7iNqnRc/Yy4sJPx/ihSEd/LMxmdcnoyXU1wXvom4qUqAaMLi1fvsMfL0k9G9+sTR2l12+ X-Received: by 10.180.77.167 with SMTP id t7mr496668wiw.6.1420819152209; Fri, 09 Jan 2015 07:59:12 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.38 with SMTP id ld6ls459455lac.50.gmail; Fri, 09 Jan 2015 07:59:12 -0800 (PST) X-Received: by 10.152.45.65 with SMTP id k1mr22638616lam.14.1420819151981; Fri, 09 Jan 2015 07:59:11 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id v4si13454359lav.88.2015.01.09.07.59.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 09 Jan 2015 07:59:11 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id p9so8808332lbv.7 for ; Fri, 09 Jan 2015 07:59:11 -0800 (PST) X-Received: by 10.112.41.234 with SMTP id i10mr22654810lbl.25.1420819151806; Fri, 09 Jan 2015 07:59:11 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp376396lbb; Fri, 9 Jan 2015 07:59:11 -0800 (PST) X-Received: by 10.52.97.9 with SMTP id dw9mr8461153vdb.4.1420819150240; Fri, 09 Jan 2015 07:59:10 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id qm8si4277754vcb.12.2015.01.09.07.59.09 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 09 Jan 2015 07:59:10 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Y9bw6-0007BT-Od; Fri, 09 Jan 2015 15:57:18 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Y9bw5-0007BK-UT for xen-devel@lists.xenproject.org; Fri, 09 Jan 2015 15:57:18 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id 0B/27-26652-D5AFFA45; Fri, 09 Jan 2015 15:57:17 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-14.tower-206.messagelabs.com!1420819036!11786786!1 X-Originating-IP: [209.85.212.171] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22539 invoked from network); 9 Jan 2015 15:57:16 -0000 Received: from mail-wi0-f171.google.com (HELO mail-wi0-f171.google.com) (209.85.212.171) by server-14.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 9 Jan 2015 15:57:16 -0000 Received: by mail-wi0-f171.google.com with SMTP id bs8so3148720wib.4 for ; Fri, 09 Jan 2015 07:57:16 -0800 (PST) X-Received: by 10.194.157.4 with SMTP id wi4mr32886210wjb.54.1420819036207; Fri, 09 Jan 2015 07:57:16 -0800 (PST) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id be4sm26187106wib.16.2015.01.09.07.57.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Jan 2015 07:57:15 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Fri, 9 Jan 2015 15:56:45 +0000 Message-Id: <1420819005-6222-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 Cc: Wei Liu , Julien Grall , Ian Jackson , Ian Campbell , Stefano Stabellini Subject: [Xen-devel] [PATCH v2] libxl: Don't ignore error when we fail to give access to ioport/irq/iomem X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: If we fail to give the access, the domain will unlikely work correctly. So we should bail out at the first error. Signed-off-by: Julien Grall Cc: Ian Jackson Cc: Stefano Stabellini Cc: Ian Campbell Cc: Wei Liu --- This patch is candidate for a backport for at least Xen 4.4 and Xen 4.5. Changes in v2: - Also bail out when libxl fails to give access to iomem --- tools/libxl/libxl_create.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 1198225..6f87d1c 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1167,6 +1167,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, "failed give dom%d access to ioports %"PRIx32"-%"PRIx32, domid, io->first, io->first + io->number - 1); ret = ERROR_FAIL; + goto error_out; } } @@ -1182,6 +1183,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, if (ret < 0) { LOGE(ERROR, "failed give dom%d access to irq %d", domid, irq); ret = ERROR_FAIL; + goto error_out; } } @@ -1198,7 +1200,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, "failed give dom%d access to iomem range %"PRIx64"-%"PRIx64, domid, io->start, io->start + io->number - 1); ret = ERROR_FAIL; - continue; + goto error_out; } ret = xc_domain_memory_mapping(CTX->xch, domid, io->gfn, io->start, @@ -1209,6 +1211,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, " to guest address %"PRIx64, domid, io->start, io->start + io->number - 1, io->gfn); ret = ERROR_FAIL; + goto error_out; } }