From patchwork Tue Oct 18 01:53:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 9381087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 96CE4608A7 for ; Tue, 18 Oct 2016 01:59:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CEA728CB7 for ; Tue, 18 Oct 2016 01:59:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 702D128CD7; Tue, 18 Oct 2016 01:59:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F3C0B28CCF for ; Tue, 18 Oct 2016 01:59:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwJem-0002tW-F5; Tue, 18 Oct 2016 01:57:32 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwJel-0002sm-Cl for xen-devel@lists.xen.org; Tue, 18 Oct 2016 01:57:31 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id F7/84-28497-A8185085; Tue, 18 Oct 2016 01:57:30 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRWlGSWpSXmKPExsVykCGBTberkTX CYNcRcYslHxezODB6HN39mymAMYo1My8pvyKBNePjr13MBRv5K+5t3MXcwPiLu4uRi0NIYAKj xO3T55m6GDk5JAR0JL5MesQEkdjNKLFk3UwghwPIyZeYfqYIpIZNIFSiffsMVhBbREBa4trny 4wg9cwC5xglWua3giWEBfwkjpw/ywxiswioSpzdcp0NxOYFii8+dZkdYpmcxLYtexhBbE4Bf4 nNq5+A9QoB1Sy6tAuqXlDi5MwnLCA3MAuoS6yfJwQS5hdQkti2/jJYK7OAvETz1tnMExgFZyH pmIXQMQtJ1QJG5lWMGsWpRWWpRbqGhnpJRZnpGSW5iZk5uoYGZnq5qcXFiempOYlJxXrJ+bmb GIFBywAEOxg/LQs4xCjJwaQkyjuviDVCiC8pP6UyI7E4I76oNCe1+BCjDAeHkgTv/HqgnGBRa npqRVpmDjB+YNISHDxKIry3QdK8xQWJucWZ6RCpU4yKUuK8Ug1ACQGQREZpHlwbLGYvMcpKCf MyAh0ixFOQWpSbWYIq/4pRnINRSZhXG2QKT2ZeCdz0V0CLmYAWn8tjAVlckoiQkmpg3P2w4s7 nS7ZtWTd1Jp6+tj2vUpxxTWDo7vPli649uhJqsjp/v+TDEFXRP6+3eX223/k4wpUrOKUrbLlG 8uITh9xycqWmtd1Yw6k1/8LKo0rev3x+KshNss45+nvXjSUGppoqv3u/+x+dG/NMOkx41qTGb 8qbDwooXHqp0n9YOcblQDOn9cc8HSWW4oxEQy3mouJEAMv48DfUAgAA X-Env-Sender: marmarek@mimuw.edu.pl X-Msg-Ref: server-7.tower-27.messagelabs.com!1476755850!61267396!1 X-Originating-IP: [193.0.96.6] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.0.13; banners=-,-,- X-VirusChecked: Checked Received: (qmail 61517 invoked from network); 18 Oct 2016 01:57:30 -0000 Received: from mail.mimuw.edu.pl (HELO mail.mimuw.edu.pl) (193.0.96.6) by server-7.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 18 Oct 2016 01:57:30 -0000 Received: from localhost (localhost [127.0.0.1]) by duch.mimuw.edu.pl (Postfix) with ESMTP id E22EC249; Tue, 18 Oct 2016 03:57:29 +0200 (CEST) X-Virus-Scanned: amavisd-new at mimuw.edu.pl Received: from mail.mimuw.edu.pl ([193.0.96.6]) by localhost (mail.mimuw.edu.pl [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id G8NkOhSiM0_v; Tue, 18 Oct 2016 03:57:28 +0200 (CEST) Received: by duch.mimuw.edu.pl (Postfix, from userid 1575) id C14B522D; Tue, 18 Oct 2016 03:57:26 +0200 (CEST) From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xen.org Date: Tue, 18 Oct 2016 03:53:33 +0200 Message-Id: <1476755613-3921-4-git-send-email-marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1476755613-3921-1-git-send-email-marmarek@invisiblethingslab.com> References: <1476755613-3921-1-git-send-email-marmarek@invisiblethingslab.com> MIME-Version: 1.0 Organization: Invisible Things Lab Cc: Wei Liu , Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Samuel Thibault Subject: [Xen-devel] [PATCH 3/3] libxl: don't try to manipulate json config for stubdomain X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Stubdomain do not have it's own config file - its configuration is derived from target domains. Do not try to manipulate it when attaching PCI device. This bug prevented starting HVM with stubdomain and PCI passthrough device attached. Signed-off-by: Marek Marczykowski-Górecki --- tools/libxl/libxl_pci.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index 3805d30..5ad70c5 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -151,14 +151,18 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, uint32_t domid, libxl_d GCNEW(device); libxl__device_from_pcidev(gc, domid, pcidev, device); - lock = libxl__lock_domain_userdata(gc, domid); - if (!lock) { - rc = ERROR_LOCK_FAIL; - goto out; - } + /* Stubdomain config is derived from its target domain, it doesn't have + its own file */ + if (!libxl_is_stubdom(CTX, domid, NULL)) { + lock = libxl__lock_domain_userdata(gc, domid); + if (!lock) { + rc = ERROR_LOCK_FAIL; + goto out; + } - rc = libxl__get_domain_configuration(gc, domid, &d_config); - if (rc) goto out; + rc = libxl__get_domain_configuration(gc, domid, &d_config); + if (rc) goto out; + } DEVICE_ADD(pci, pcidevs, domid, &pcidev_saved, COMPARE_PCI, &d_config); @@ -169,8 +173,10 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, uint32_t domid, libxl_d rc = libxl__xs_transaction_start(gc, &t); if (rc) goto out; - rc = libxl__set_domain_configuration(gc, domid, &d_config); - if (rc) goto out; + if (lock) { + rc = libxl__set_domain_configuration(gc, domid, &d_config); + if (rc) goto out; + } libxl__xs_writev(gc, t, be_path, libxl__xs_kvs_of_flexarray(gc, back));