WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-3.4-testing] xend: pci: improve the assignability c

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.4-testing] xend: pci: improve the assignability checking
From: "Xen patchbot-3.4-testing" <patchbot-3.4-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 04 Jun 2009 10:26:26 -0700
Delivery-date: Thu, 11 Jun 2009 08:06:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1244109905 -3600
# Node ID 61322608361ea2ac6ab3013a8b5928fd6d45b5be
# Parent  11cadcaff051188117eeb103eeaf4fd9dcb14ea9
xend: pci: improve the assignability checking

1) fix some small typos in util/pci.py;
2) find_all_the_multi_functions(): BDFs of a multi-function PCIe
device could be different in all the 3 fields (bus, device, function),
so we need self.find_parent() and list all t
he BDFs below the parent;
3) to assign a device of the must-be-co-assigned devices, we require
all the related devices should be owned by pciback;
4) detect and disallow duplicate pci string specified in guest config
file due to carelessness.

Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
xen-unstable changeset:   19698:f72d26c00002
xen-unstable date:        Tue Jun 02 11:50:16 2009 +0100
---
 tools/python/xen/util/pci.py            |   10 +++++-----
 tools/python/xen/xend/XendDomainInfo.py |    1 +
 tools/python/xen/xend/server/pciif.py   |    5 +++++
 3 files changed, 11 insertions(+), 5 deletions(-)

diff -r 11cadcaff051 -r 61322608361e tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py      Thu Jun 04 10:58:47 2009 +0100
+++ b/tools/python/xen/util/pci.py      Thu Jun 04 11:05:05 2009 +0100
@@ -352,7 +352,7 @@ class PciDeviceAssignmentError(Exception
     def __init__(self,msg):
         self.message = msg
     def __str__(self):
-        return 'pci: impproper device assignment spcified: ' + \
+        return 'pci: improper device assignment specified: ' + \
             self.message
 
 class PciDevice:
@@ -556,10 +556,10 @@ class PciDevice:
 
     def find_all_the_multi_functions(self):
         sysfs_mnt = find_sysfs_mnt()
-        pci_names = os.popen('ls ' + sysfs_mnt + SYSFS_PCI_DEVS_PATH).read()
-        p = self.name
-        p = p[0 : p.rfind('.')] + '.[0-7]'
-        funcs = re.findall(p, pci_names)
+        parent = PCI_DEV_FORMAT_STR % self.find_parent()
+        pci_names = os.popen('ls ' + sysfs_mnt + SYSFS_PCI_DEVS_PATH + '/' + \
+            parent + '/').read()
+        funcs = re.findall(PCI_DEV_REG_EXPRESS_STR, pci_names)
         return funcs
 
     def find_coassigned_devices(self):
diff -r 11cadcaff051 -r 61322608361e tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Jun 04 10:58:47 2009 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Jun 04 11:05:05 2009 +0100
@@ -687,6 +687,7 @@ class XendDomainInfo:
         # co-assignment devices hasn't been assigned, or has been assigned to
         # domN.
         coassignment_list = pci_device.find_coassigned_devices()
+        pci_device.devs_check_driver(coassignment_list)
         assigned_pci_device_str_list = self._get_assigned_pci_devices()
         for pci_str in coassignment_list:
             (domain, bus, dev, func) = parse_pci_name(pci_str) 
diff -r 11cadcaff051 -r 61322608361e tools/python/xen/xend/server/pciif.py
--- a/tools/python/xen/xend/server/pciif.py     Thu Jun 04 10:58:47 2009 +0100
+++ b/tools/python/xen/xend/server/pciif.py     Thu Jun 04 11:05:05 2009 +0100
@@ -397,6 +397,9 @@ class PciController(DevController):
             pci_str_list = pci_str_list + [pci_str]
             pci_dev_list = pci_dev_list + [(domain, bus, slot, func)]
 
+        if len(pci_str_list) != len(set(pci_str_list)):
+            raise VmError('pci: duplicate devices specified in guest config?')
+
         for (domain, bus, slot, func) in pci_dev_list:
             try:
                 dev = PciDevice(domain, bus, slot, func)
@@ -413,6 +416,7 @@ class PciController(DevController):
                     log.warn(err_msg % dev.name)
                 else:
                     funcs = dev.find_all_the_multi_functions()
+                    dev.devs_check_driver(funcs)
                     for f in funcs:
                         if not f in pci_str_list:
                             (f_dom, f_bus, f_slot, f_func) = parse_pci_name(f)
@@ -440,6 +444,7 @@ class PciController(DevController):
                     # Remove the element 0 which is a bridge
                     del devs_str[0]
 
+                    dev.devs_check_driver(devs_str)
                     for s in devs_str:
                         if not s in pci_str_list:
                             (s_dom, s_bus, s_slot, s_func) = parse_pci_name(s)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.4-testing] xend: pci: improve the assignability checking, Xen patchbot-3.4-testing <=