xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: xen-devel@lists.xen.org
Cc: "Wei Liu" <wei.liu2@citrix.com>,
	"Ian Jackson" <ian.jackson@eu.citrix.com>,
	"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
	"Samuel Thibault" <samuel.thibault@ens-lyon.org>
Subject: [PATCH 3/3] libxl: don't try to manipulate json config for stubdomain
Date: Tue, 18 Oct 2016 03:53:33 +0200	[thread overview]
Message-ID: <1476755613-3921-4-git-send-email-marmarek@invisiblethingslab.com> (raw)
In-Reply-To: <1476755613-3921-1-git-send-email-marmarek@invisiblethingslab.com>

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 <marmarek@invisiblethingslab.com>
---
 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));
 
-- 
2.5.5


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-10-18  1:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18  1:53 [PATCH 0/3] Fix PCI passthrough for HVM with stubdomain Marek Marczykowski-Górecki
2016-10-18  1:53 ` [PATCH 1/3] libxl: attach xen-pciback only to PV domains Marek Marczykowski-Górecki
2016-10-18 20:52   ` Konrad Rzeszutek Wilk
2016-10-18 21:03     ` Marek Marczykowski-Górecki
2016-10-19  9:37   ` Wei Liu
2016-10-19 20:46     ` Konrad Rzeszutek Wilk
2016-10-19 22:42       ` Marek Marczykowski-Górecki
2016-10-25 13:10         ` Konrad Rzeszutek Wilk
2016-10-25 19:22           ` Marek Marczykowski-Górecki
2016-10-25 19:42             ` Andrew Cooper
2016-10-18  1:53 ` [PATCH 2/3] libxl: attach PCI device to qemu only after setting pciback/pcifront Marek Marczykowski-Górecki
2016-10-19  9:37   ` Wei Liu
2016-10-18  1:53 ` Marek Marczykowski-Górecki [this message]
2016-10-19  9:38   ` [PATCH 3/3] libxl: don't try to manipulate json config for stubdomain Wei Liu
2016-10-19 10:32     ` Marek Marczykowski-Górecki
2016-10-18 18:44 ` [PATCH 0/3] Fix PCI passthrough for HVM with stubdomain Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476755613-3921-4-git-send-email-marmarek@invisiblethingslab.com \
    --to=marmarek@invisiblethingslab.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).