All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhai, Edwin" <edwin.zhai@intel.com>
To: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	"horms@verge.net.au" <horms@verge.net.au>
Subject: Re: [PATCH] xend: Update info['platform']['pci']
Date: Mon, 01 Jun 2009 17:54:30 +0800	[thread overview]
Message-ID: <4A23A556.6050308@intel.com> (raw)
In-Reply-To: <80C9E29C5A6928kanno.masaki@jp.fujitsu.com>

[-- Attachment #1: Type: text/plain, Size: 2325 bytes --]

Masaki,
Attached is my patch to fix another bug caused by wrong synchronization 
of info['platform']['pci']. Just FYI. I don't know if it still can apply 
on unstable. We also need make sure old saved image can be restored with 
this fix.

Thanks,


Masaki Kanno wrote:
> Mon, 1 Jun 2009 14:01:58 +0800, "Zhai, Edwin" wrote:
>
>   
>> Masaki,
>> How about removing the 'pci' config from the info['platform']? We already 
>> have 
>> the info['devices'] to kept the pci/vif/disk config, so duplicated info in 
>> ['platform']['pci'] would cause synchronization troubles.
>>
>>
>> There are only several places using info['platform']['pci'], so take place 
>> of 
>> them with _getDeviceInfo_pci('0') should be okay.
>>     
>
> Hi Edwin,
>
> As far as I know, info['platform']['pci'] is referred in the following 
> places.
>  - _constructDomain@XendDomainInfo.py
>  - image_sxpr@XendConfig.py
>
> Are there any others than the above?  If there are others, I will 
> confirm them.
>
> Best regards,
>  Kan
>
>   
>> On Thu, May 28, 2009 at 03:01:50PM +0800, Masaki Kanno wrote:
>>     
>>> Hi,
>>>
>>> This patch updates info['platform']['pci'] for PCI devices assignment 
>>> to domains.
>>>
>>> When a domain is started, xend confirms by using xc.test_assign_device 
>>> whether PCI devices can be assigned to the domain. 
>>> For the confirmation, info['platform']['pci'] must be an appropriate 
>>> value.  However, info['platform']['pci'] may be not appropriate. 
>>> Because info['platform']['pci'] isn't almost always updated even if 
>>> the PCI device configuration of the domain was changed by using 
>>> xm pci-attach/detach. 
>>> This patch updates info['platform']['pci'] to the appropriate value 
>>> when domains are started.
>>>
>>> Cc: Simon Horman <horms@verge.net.au>
>>> Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
>>>
>>> Best regards,
>>>  Kan
>>>
>>>       
>> Content-Description: ATT00001.txt
>>     
>>> _______________________________________________
>>> Xen-devel mailing list
>>> Xen-devel@lists.xensource.com
>>> http://lists.xensource.com/xen-devel
>>>       
>> -- 
>> best rgds,
>> edwin
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
>>     
>
>   

-- 
best rgds,
edwin


[-- Attachment #2: remove_pci_conf_r19597.patch --]
[-- Type: text/plain, Size: 3550 bytes --]

Index: hv/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- hv.orig/tools/python/xen/xend/XendDomainInfo.py
+++ hv/tools/python/xen/xend/XendDomainInfo.py
@@ -851,18 +851,9 @@ class XendDomainInfo:
             if num_devs == 0:
                 if self.info.is_hvm():
                     self.destroyDevice('pci', devid, True)
-                    del self.info['devices'][dev_uuid]
-                    platform = self.info['platform']
-                    orig_dev_num = len(platform['pci'])
-                    # TODO: can use this to keep some info to ask high level
-                    # management tools to hot insert a new passthrough dev
-                    # after migration
-                    if orig_dev_num != 0:
-                        #platform['pci'] = ["%dDEVs" % orig_dev_num]
-                        platform['pci'] = []
                 else:
                     self.destroyDevice('pci', devid)
-                    del self.info['devices'][dev_uuid]
+                del self.info['devices'][dev_uuid]
         else:
             new_dev_sxp = ['pci']
             for cur_dev in sxp.children(existing_dev_info, 'dev'):
@@ -884,15 +875,6 @@ class XendDomainInfo:
             # If there is only 'vscsi' in new_dev_sxp, remove the config.
             if len(sxp.children(new_dev_sxp, 'dev')) == 0:
                 del self.info['devices'][dev_uuid]
-                if self.info.is_hvm():
-                    platform = self.info['platform']
-                    orig_dev_num = len(platform['pci'])
-                    # TODO: can use this to keep some info to ask high level
-                    # management tools to hot insert a new passthrough dev
-                    # after migration
-                    if orig_dev_num != 0:
-                        #platform['pci'] = ["%dDEVs" % orig_dev_num]
-                        platform['pci'] = []
 
         xen.xend.XendDomain.instance().managed_config_save(self)
 
@@ -2388,11 +2370,18 @@ class XendDomainInfo:
                               (self.getVCpuCount() * 100))
 
         # Test whether the devices can be assigned with VT-d
-        pci = self.info["platform"].get("pci")
         pci_str = ''
-        if pci and len(pci) > 0:
-            pci = map(lambda x: x[0:4], pci)  # strip options 
-            pci_str = str(pci)
+        pci_list = []
+        devid = '0'
+        dev_info = self._getDeviceInfo_pci(devid)
+        if dev_info is not None:
+            dev_uuid = sxp.child_value(dev_info, 'uuid')
+            pci_conf = self.info['devices'][dev_uuid][1]
+            pci_devs = pci_conf['devs']
+            for x in pci_devs:
+                pci_list.append([x['domain'], x['bus'], x['slot'], x['func']])
+            pci_str = str(pci_list)
+
         if hvm and pci_str:
             bdf = xc.test_assign_device(0, pci_str)
             if bdf != 0:
Index: hv/tools/python/xen/xend/XendConfig.py
===================================================================
--- hv.orig/tools/python/xen/xend/XendConfig.py
+++ hv/tools/python/xen/xend/XendConfig.py
@@ -163,7 +163,6 @@ XENAPI_PLATFORM_CFG_TYPES = {
     'vncpasswd': str,
     'vncunused': int,
     'xauthority': str,
-    'pci': str,
     'vhpt': int,
     'guest_os_type': str,
     'hap': int,
@@ -214,7 +213,6 @@ XENAPI_CFG_TYPES = {
     'other_config': dict,
     'target': int,
     'security_label': str,
-    'pci': str,
     'cpuid' : dict,
     'cpuid_check' : dict,
     'machine_address_size': int,

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

      reply	other threads:[~2009-06-01  9:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-28  7:01 [PATCH] xend: Update info['platform']['pci'] Masaki Kanno
2009-05-28 10:46 ` Simon Horman
2009-06-01  4:08   ` Masaki Kanno
2009-06-01  4:24     ` Simon Horman
2009-06-01  5:50       ` Masaki Kanno
2009-06-01  6:01 ` Zhai, Edwin
2009-06-01  9:35   ` Masaki Kanno
2009-06-01  9:54     ` Zhai, Edwin [this message]

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=4A23A556.6050308@intel.com \
    --to=edwin.zhai@intel.com \
    --cc=horms@verge.net.au \
    --cc=kanno.masaki@jp.fujitsu.com \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.