On Wed, Jun 03, 2009 at 01:21:57AM +1000, Simon Horman wrote:
> On Tue, Jun 02, 2009 at 10:52:39PM +1000, Simon Horman wrote:
> > On Tue, Jun 02, 2009 at 07:31:35PM +0800, Cui, Dexuan wrote:
> > > Cui, Dexuan wrote:
> > > > Simon Horman wrote:
> > > >> On Tue, Jun 02, 2009 at 04:38:17PM +0800, Cui, Dexuan wrote:
> > > >>> Simon Horman wrote:
> > > >>>> On Tue, Jun 02, 2009 at 01:05:16PM +0800, Cui, Dexuan wrote:
> > > >>
> > > >> [snip]
> > > >>
> > > >>>>> BTW, there is another bug with guest hotplug:
> > > >>>>> After I create a guest without assigning any device to it, I can
> > > >>>>> 'xm pci-attach' a device into the guest, but "xm pci-list" doesn't
> > > >>>>> show the vslot info. Looks this issue is originally introduced by
> > > >>>>> c/s 19510. Can you and Masaki Kanno have a look?
> > > >>>>
> > > >>>> Yes, of course, I will look into it.
> > > >>>>
> > > >>>> Which revisions of xen-unstable.hg and qemu-xen-unstable.git are
> > > >>>> you using?
> > > >>> I'm using the latest xen c/s 19696 and ioemu
> > > >>> 72f4654095e0ac1539749b628e98f5e1569c9801 plus applying your patch
> > > >>> manually now and can still reproduce it.
> > > >>
> > > >> Are you booting an HVM domain?
> > > >> I am not able to see this problem with the config below
> > > >> and running the following commands to attach a device:
> > > >>
> > > >> $ xm pci-list debian
> > > >> $ xm pci-attach debian 01:00.0
> > > >> $ xm pci-list debian
> > > >> domain bus slot func
> > > >> 0x0000 0x01 0x00 0x0
> > > > Here, I think the VSLT is missing?
> > >
> > > I expect it should be something like:
> > >
> > > $ xm pci-list debian
> > > VSlt domain bus slot func
> > > 0x04 0x0000 0x01 0x00 0x0
> >
> > Sorry, my mistake. I see the problem now. I will investigate.
>
> Hi Dexuan,
>
> can you see if the following resolves the problem that you are seeing?
Hi Dexuan,
I have a cleaner approach to this problem than the patch I sent last night:
----------------------------------------------------------------------
Subject: [patch] xm: passthrough: remove requested_vslots, always use vslots
To: xen-devel@xxxxxxxxxxxxxxxxxxx
Cc: Dexuan Cui <dexuan.cui@xxxxxxxxx>,
Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
From: Simon Horman <horms@xxxxxxxxxxxx>
As a result of the removal of the boot-time pass-through
protocol, requested_vslots is no longer needed.
Cc: Dexuan Cui <dexuan.cui@xxxxxxxxx>,
Cc: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
---
tools/python/xen/util/pci.py | 16 +---------------
tools/python/xen/xend/XendConfig.py | 7 +++----
tools/python/xen/xend/XendDomainInfo.py | 21 ++++++++-------------
tools/python/xen/xend/server/pciif.py | 2 +-
tools/python/xen/xm/create.py | 2 +-
tools/python/xen/xm/main.py | 4 ++--
6 files changed, 16 insertions(+), 36 deletions(-)
Index: xen-unstable.hg/tools/python/xen/util/pci.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/util/pci.py 2009-06-03
12:26:42.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/util/pci.py 2009-06-03
12:26:44.000000000 +1000
@@ -146,20 +146,6 @@ def parse_pci_name(pci_name_string):
return (domain, bus, slot, func)
-def assigned_or_requested_vslot(dev):
- if isinstance(dev, types.DictType):
- if dev.has_key("vslot"):
- return dev["vslot"]
- if dev.has_key("requested_vslot"):
- return dev["requested_vslot"]
- elif isinstance(dev, (types.ListType, types.TupleType)):
- vslot = sxp.child_value(dev, 'vslot', None)
- if not vslot:
- vslot = sxp.child_value(dev, 'requested_vslot', None)
- if vslot:
- return vslot
- raise PciDeviceVslotMissing("%s" % dev)
-
def find_sysfs_mnt():
try:
return utils.find_sysfs_mount()
@@ -379,7 +365,7 @@ class PciDeviceVslotMissing(Exception):
def __init__(self,msg):
self.message = msg
def __str__(self):
- return 'pci: no vslot or requested_vslot: ' + self.message
+ return 'pci: no vslot: ' + self.message
class PciDevice:
def __init__(self, domain, bus, slot, func):
Index: xen-unstable.hg/tools/python/xen/xend/XendConfig.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xend/XendConfig.py 2009-06-03
12:26:42.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xend/XendConfig.py 2009-06-03
12:26:44.000000000 +1000
@@ -36,7 +36,6 @@ from xen.xend.xenstore.xstransact import
from xen.xend.server.BlktapController import blktap_disk_types
from xen.xend.server.netif import randomMAC
from xen.util.blkif import blkdev_name_to_number, blkdev_uname_to_file
-from xen.util.pci import assigned_or_requested_vslot
from xen.util import xsconstants
import xen.util.auxbin
@@ -1288,7 +1287,7 @@ class XendConfig(dict):
dpci_record = {
'VM': self['uuid'],
'PPCI': ppci_uuid,
- 'hotplug_slot': pci_dev.get('requested_vslot', 0)
+ 'hotplug_slot': pci_dev.get('vslot', 0)
}
dpci_opts = pci_dev.get('opts')
@@ -1858,7 +1857,7 @@ class XendConfig(dict):
dpci_record = {
'VM': self['uuid'],
'PPCI': ppci_uuid,
- 'hotplug_slot': pci_dev.get('requested_vslot', 0)
+ 'hotplug_slot': pci_dev.get('vslot', 0)
}
dpci_opts = pci_dev.get('opts')
@@ -2131,7 +2130,7 @@ class XendConfig(dict):
bus = sxp.child_value(dev, 'bus')
slot = sxp.child_value(dev, 'slot')
func = sxp.child_value(dev, 'func')
- vslot = assigned_or_requested_vslot(dev)
+ vslot = sxp.child_value(dev, 'vslot')
opts = ''
for opt in sxp.child_value(dev, 'opts', []):
if opts:
Index: xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xend/XendDomainInfo.py
2009-06-03 12:26:42.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py 2009-06-03
12:26:44.000000000 +1000
@@ -39,7 +39,7 @@ from xen.util import asserts, auxbin
from xen.util.blkif import blkdev_uname_to_file, blkdev_uname_to_taptype
import xen.util.xsm.xsm as security
from xen.util import xsconstants
-from xen.util.pci import assigned_or_requested_vslot, serialise_pci_opts
+from xen.util.pci import serialise_pci_opts
from xen.xend import balloon, sxp, uuid, image, arch
from xen.xend import XendOptions, XendNode, XendConfig
@@ -641,10 +641,9 @@ class XendDomainInfo:
pci_conf = self.info['devices'][dev_uuid][1]
pci_devs = pci_conf['devs']
for x in pci_devs:
- x_vslot = assigned_or_requested_vslot(x)
- if (int(x_vslot, 16) == int(new_dev['requested_vslot'], 16) and
- int(x_vslot, 16) != AUTO_PHP_SLOT):
- raise VmError("vslot %s already have a device." %
(new_dev['requested_vslot']))
+ if (int(x['vslot'], 16) == int(new_dev['vslot'], 16) and
+ int(x['vslot'], 16) != AUTO_PHP_SLOT):
+ raise VmError("vslot %s already have a device." %
(new_dev['vslot']))
if (int(x['domain'], 16) == int(new_dev['domain'], 16) and
int(x['bus'], 16) == int(new_dev['bus'], 16) and
@@ -747,17 +746,14 @@ class XendDomainInfo:
new_dev['bus'],
new_dev['slot'],
new_dev['func'],
- # vslot will be used when activating a
- # previously activated domain.
- # Otherwise requested_vslot will be used.
- assigned_or_requested_vslot(new_dev),
+ new_dev['vslot'],
opts)
self.image.signalDeviceModel('pci-ins', 'pci-inserted', bdf_str)
vslot = xstransact.Read("/local/domain/0/device-model/%i/parameter"
% self.getDomid())
else:
- vslot = new_dev['requested_vslot']
+ vslot = new_dev['vslot']
return vslot
@@ -859,7 +855,7 @@ class XendDomainInfo:
int(x['bus'], 16) == int(dev['bus'], 16) and
int(x['slot'], 16) == int(dev['slot'], 16) and
int(x['func'], 16) == int(dev['func'], 16) ):
- vslot = assigned_or_requested_vslot(x)
+ vslot = x['vslot']
break
if vslot == "":
raise VmError("Device %04x:%02x:%02x.%01x is not connected"
@@ -1138,8 +1134,7 @@ class XendDomainInfo:
#find the pass-through device with the virtual slot
devnum = 0
for x in pci_conf['devs']:
- x_vslot = assigned_or_requested_vslot(x)
- if int(x_vslot, 16) == vslot:
+ if int(x['vslot'], 16) == vslot:
break
devnum += 1
Index: xen-unstable.hg/tools/python/xen/xm/create.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xm/create.py 2009-06-03
12:26:42.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xm/create.py 2009-06-03
12:26:44.000000000 +1000
@@ -716,7 +716,7 @@ def configure_pci(config_devs, vals):
config_pci_bdf = ['dev', ['domain', domain], ['bus', bus], \
['slot', slot], ['func', func],
- ['requested_vslot', vslot]]
+ ['vslot', vslot]]
map(f, d.keys())
if len(config_pci_opts)>0:
config_pci_bdf.append(['opts', config_pci_opts])
Index: xen-unstable.hg/tools/python/xen/xm/main.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xm/main.py 2009-06-03
12:26:42.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xm/main.py 2009-06-03 12:26:44.000000000
+1000
@@ -2198,7 +2198,7 @@ def xm_pci_list(args):
"bus": int(x["bus"], 16),
"slot": int(x["slot"], 16),
"func": int(x["func"], 16),
- "vslot": int(assigned_or_requested_vslot(x), 16)
+ "vslot": int(x["vslot"], 16)
}
devs.append(dev)
@@ -2500,7 +2500,7 @@ def parse_pci_configuration(args, state,
['bus', '0x'+ pci_dev_info['bus']],
['slot', '0x'+ pci_dev_info['slot']],
['func', '0x'+ pci_dev_info['func']],
- ['requested_vslot', '0x%x' % int(vslot, 16)]]
+ ['vslot', '0x%x' % int(vslot, 16)]]
if len(opts) > 0:
pci_bdf.append(['opts', opts])
pci.append(pci_bdf)
Index: xen-unstable.hg/tools/python/xen/xend/server/pciif.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xend/server/pciif.py 2009-06-03
12:26:42.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xend/server/pciif.py 2009-06-03
12:26:44.000000000 +1000
@@ -74,7 +74,7 @@ class PciController(DevController):
bus = parse_hex(pci_config.get('bus', 0))
slot = parse_hex(pci_config.get('slot', 0))
func = parse_hex(pci_config.get('func', 0))
- vslot = parse_hex(assigned_or_requested_vslot(pci_config))
+ vslot = parse_hex(pci_config.get('vslot', 0))
if pci_config.has_key('opts'):
opts = serialise_pci_opts(pci_config['opts'])
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|