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: only extract the exact pci

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.4-testing] xend: pci: only extract the exact pci BDFs
From: "Xen patchbot-3.4-testing" <patchbot-3.4-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 04 Jun 2009 10:26:27 -0700
Delivery-date: Thu, 11 Jun 2009 08:06:28 -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 1244109936 -3600
# Node ID ad354423c3ffcd1ac36c1f3013238dd4265a68f4
# Parent  61322608361ea2ac6ab3013a8b5928fd6d45b5be
xend: pci: only extract the exact pci BDFs

On some hosts:
[root@localhost ~]# ls /sys/bus/pci/devices/0000:00:05.0/
0000:00:05.0:pcie00  0000:05:00.0          class   driver  local_cpus
resource          subsystem_vendor
0000:00:05.0:pcie01  broken_parity_status  config  enable  modalias
subsystem         uevent
0000:00:05.0:pcie02  bus                   device  irq     power
subsystem_device  vendor

Here we should only get 0000:05:00.0, but we also get 0000:00:05.0
unexpectedly. With this patch, xend only extracts the exact BDF(s).

Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
xen-unstable changeset:   19726:d8b7b51f482b
xen-unstable date:        Thu Jun 04 10:47:56 2009 +0100
---
 tools/python/xen/util/pci.py |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff -r 61322608361e -r ad354423c3ff tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py      Thu Jun 04 11:05:05 2009 +0100
+++ b/tools/python/xen/util/pci.py      Thu Jun 04 11:05:36 2009 +0100
@@ -139,6 +139,18 @@ def parse_pci_name(pci_name_string):
 
     return (domain, bus, slot, func)
  
+
+def extract_the_exact_pci_names(pci_names):
+    result = []
+    pci_names = pci_names.split()
+    for pci in pci_names:
+        # The length of DDDD:bb:dd.f is 12.
+        if len(pci) !=  12:
+            continue
+        if re.match(PCI_DEV_REG_EXPRESS_STR, pci) is None:
+            continue
+        result = result + [pci]
+    return result
 
 def find_sysfs_mnt():
     try:
@@ -240,7 +252,7 @@ def find_all_devices_owned_by_pciback():
     sysfs_mnt = find_sysfs_mnt()
     pciback_path = sysfs_mnt + SYSFS_PCIBACK_PATH
     pci_names = os.popen('ls ' + pciback_path).read()
-    pci_list = re.findall(PCI_DEV_REG_EXPRESS_STR, pci_names)
+    pci_list = extract_the_exact_pci_names(pci_names)
     dev_list = []
     for pci in pci_list:
         (dom, b, d, f) = parse_pci_name(pci)
@@ -435,7 +447,7 @@ class PciDevice:
         sysfs_mnt = find_sysfs_mnt()
         self_path = sysfs_mnt + SYSFS_PCI_DEVS_PATH + '/' + self.name
         pci_names = os.popen('ls ' + self_path).read()
-        dev_list = re.findall(PCI_DEV_REG_EXPRESS_STR, pci_names)
+        dev_list = extract_the_exact_pci_names(pci_names)
 
         list = [self.name]
         for pci_str in dev_list:
@@ -472,7 +484,7 @@ class PciDevice:
             return [self.name]
 
         dev_list = dev.find_all_devices_behind_the_bridge(ignore_bridge)
-        dev_list = re.findall(PCI_DEV_REG_EXPRESS_STR, '%s' % dev_list)
+        dev_list = extract_the_exact_pci_names('%s' % dev_list)
         return dev_list
 
     def do_secondary_bus_reset(self, target_bus, devs):
@@ -559,7 +571,7 @@ class PciDevice:
         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)
+        funcs = extract_the_exact_pci_names(pci_names)
         return funcs
 
     def find_coassigned_devices(self):

_______________________________________________
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: only extract the exact pci BDFs, Xen patchbot-3.4-testing <=