From: Simon Horman Subject: Re: Re: Xen 3.4 multi-function pass-through tree, isn't working... Date: Fri, 24 Jul 2009 19:05:40 +1000 Message-ID: <20090724090539.GA32268@verge.net.au> References: <8686c3cd0907200403w2a05cf1lfaf25dc8d7eb1821@mail.gmail.com> <20090720120459.GA31891@verge.net.au> <8686c3cd0907200511h68ae5ea8ia5a833cd40b12c08@mail.gmail.com> <20090721032302.GA13928@verge.net.au> <8686c3cd0907210022p78ab0125s388b66f6f177ed8@mail.gmail.com> <20090721101459.GC31093@verge.net.au> <20090722061142.GA11245@verge.net.au> <8686c3cd0907220335w78a136d7g7856c53bfe53c3c3@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <8686c3cd0907220335w78a136d7g7856c53bfe53c3c3@mail.gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Tom Rotenberg Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hi Tom, I'm still scratching my head over this one. Would it be possible for you to apply the following patch and post the resulting xend.log? It includes your work-around as well as some extra debugging messages. I'm interested to try and see what kind of state your xenstore is getting into. Thanks Index: xen-3.4-testing-pass-through-multi-function/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-3.4-testing-pass-through-multi-function.orig/tools/python/xen/xend/XendDomainInfo.py 2009-07-24 19:01:00.000000000 +1000 +++ xen-3.4-testing-pass-through-multi-function/tools/python/xen/xend/XendDomainInfo.py 2009-07-24 19:02:35.000000000 +1000 @@ -2137,6 +2137,13 @@ class XendDomainInfo: log.info("createDevice: %s : %s" % (devclass, scrub_password(config))) dev_uuid = config.get('uuid') devid = self._createDevice(devclass, config) + + num_devs = self.getDeviceController(devclass).readBackend(devid, "num_devs") + if num_devs: + for i in range(int(num_devs)): + dev = self.getDeviceController(devclass).readBackend(devid, "dev-%i" % i) + state = self.getDeviceController(devclass).readBackend(devid, "state-%i" % i) + log.info("Created PCI device %s at index %i with state %s" % (dev, i, state)) # store devid in XendConfig for caching reasons if dev_uuid in self.info['devices']: Index: xen-3.4-testing-pass-through-multi-function/tools/python/xen/xend/server/pciif.py =================================================================== --- xen-3.4-testing-pass-through-multi-function.orig/tools/python/xen/xend/server/pciif.py 2009-07-24 14:53:03.000000000 +1000 +++ xen-3.4-testing-pass-through-multi-function/tools/python/xen/xend/server/pciif.py 2009-07-24 19:02:55.000000000 +1000 @@ -110,6 +110,9 @@ class PciController(DevController): states = config.get('states', []) num_olddevs = int(self.readBackend(devid, 'num_devs')) + log.debug('reconfigureDevice: num_devs=%d num_olddevs=%d' % + (num_devs, num_olddevs)) + for i in range(num_devs): try: dev = back['dev-%i' % i] @@ -126,10 +129,13 @@ class PciController(DevController): devno = self.reconfigureDevice_find(devid, num_olddevs, dev) if devno == None: devno = num_olddevs + i - log.debug('Attaching PCI device %s.' % dev) + log.debug('Attaching PCI device %s at index %d.' % + (dev, devno)) attaching = True else: - log.debug('Reconfiguring PCI device %s.' % dev) + state = self.readBackend(devid, 'state-%i' % devno) + log.debug(('Reconfiguring PCI device %s at index %d ' + + 'with state %s.') % (dev, devno, state)) attaching = False self.setupOneDevice(parse_pci_name(dev)) @@ -499,7 +505,14 @@ class PciController(DevController): num_devs = int(self.readBackend(devid, 'num_devs')) new_num_devs = 0 for i in range(num_devs): - state = int(self.readBackend(devid, 'state-%i' % i)) + dev = self.readBackend(devid, 'dev-%i' % i) + state_str = self.readBackend(devid, 'state-%i' % i) + log.debug('Cleanup PCI device %s at index %d with state %s' % (dev, i, state_str)) + try: + state = int(state_str) + except: + state = xenbusState['Unknown'] + if state == xenbusState['Closing']: # Detach I/O resources. pci_dev = parse_pci_name(self.readBackend(devid, 'dev-%i' % i))