Skip to contentSkip to conversation

libxl: create pci backend only when there are pci devices

PATCH In review Roger Pau Monne 3 participants 5 messages Sep 14, 2011 – Sep 22, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: create pci backend only when there are pci devices

# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1316002720 -7200
# Node ID 63e254468d6e8d81baeafaed68f05791dc21eb4e # Parent ac33d68e89767d49113824e5661c49a5465a18e7
libxl: create pci backend only when there are pci devices.

tools/libxl/libxl_create.c +8 -6
diff -r ac33d68e8976 -r 63e254468d6e tools/libxl/libxl_create.c
@@ -584,12 +584,14 @@ static int do_domain_create(libxl__gc *g
     for (i = 0; i < d_config->num_pcidevs; i++)
         libxl__device_pci_add(gc, domid, &d_config->pcidevs[i], 1);
 
-    ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs,
-                                    d_config->num_pcidevs);
-    if (ret < 0) {
-        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
-                   "libxl_create_pci_backend failed: %d", ret);
-        goto error_out;
+    if (d_config->num_pcidevs > 0) {
+        ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs,
+                                        d_config->num_pcidevs);
+        if (ret < 0) {
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                "libxl_create_pci_backend failed: %d", ret);
+            goto error_out;
+        }
     }
 
     if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_PV &&
#1 lore raw
Quoted 6 lines · Roger Pau Monne

# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1316002720 -7200
# Node ID 63e254468d6e8d81baeafaed68f05791dc21eb4e # Parent ac33d68e89767d49113824e5661c49a5465a18e7
libxl: create pci backend only when there are pci devices.

I think I recall discussing this a way back but I don't recall the specific rationale, can you add something to the commit message please?

Also does this continue to allow a subsequent pci hotplug to work? I expect it does but it would be useful to check.

Ian.

Quoted 32 lines

diff -r ac33d68e8976 -r 63e254468d6e tools/libxl/libxl_create.c

tools/libxl/libxl_create.c +8 -6
@@ -584,12 +584,14 @@ static int do_domain_create(libxl__gc *g
     for (i = 0; i < d_config->num_pcidevs; i++)
         libxl__device_pci_add(gc, domid, &d_config->pcidevs[i], 1);
 
-    ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs,
-                                    d_config->num_pcidevs);
-    if (ret < 0) {
-        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
-                   "libxl_create_pci_backend failed: %d", ret);
-        goto error_out;
+    if (d_config->num_pcidevs > 0) {
+        ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs,
+                                        d_config->num_pcidevs);
+        if (ret < 0) {
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                "libxl_create_pci_backend failed: %d", ret);
+            goto error_out;
+        }
     }
 
     if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_PV &&

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
In reply to Roger Pau Monne

If you want to have this patch applied to xen-4.1 then please mention this explicitely.

Christoph

Quoted 33 lines · Roger Pau Monne

# HG changeset patch
# User Roger Pau Monne<[email protected]>
# Date 1316002720 -7200
# Node ID 63e254468d6e8d81baeafaed68f05791dc21eb4e # Parent ac33d68e89767d49113824e5661c49a5465a18e7
libxl: create pci backend only when there are pci devices.

diff -r ac33d68e8976 -r 63e254468d6e tools/libxl/libxl_create.c

tools/libxl/libxl_create.c +8 -6
@@ -584,12 +584,14 @@ static int do_domain_create(libxl__gc *g
      for (i = 0; i<  d_config->num_pcidevs; i++)
          libxl__device_pci_add(gc, domid,&d_config->pcidevs[i], 1);
 
-    ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs,
-                                    d_config->num_pcidevs);
-    if (ret<  0) {
-        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
-                   "libxl_create_pci_backend failed: %d", ret);
-        goto error_out;
+    if (d_config->num_pcidevs>  0) {
+        ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs,
+                                        d_config->num_pcidevs);
+        if (ret<  0) {
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                "libxl_create_pci_backend failed: %d", ret);
+            goto error_out;
+        }
      }
 
      if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_PV&&
Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
#3 lore raw

This was commited as a part of another patch, and I've decided to submit it alone. This solves a problem with NetBSD Dom0 and at least Linux DomU, the DomU kernel waited a very long time at XENBUS init, because it was unable to attach the PCI devices (although there were no PCI devices, only an empty pci entry in xenstore). This prevents libxl from adding the pci entries to xenstore if there are no PCI devices and solves the problem. I don't have any Linux boxes, but I think this should not break anything.

If the patch is correct, please add it to xen-4.1 too.

Regards, Roger.