Simon Horman
2009-Apr-22 17:30 UTC
[Xen-devel] [patch] xm: Fix hot-unplug of statically-assigned devices
Prior to changset 19510:5c69f98c348e - ''xm, xend: Replace
"vslt" with "vslot"'',
both vslt and vslot were used in the xm code, often fairly arbitrarily.
However, in the dictionary that describes a pci function both vslt and vslot
were present. vslt stored the slot assigned to the function. And
vslot stored the slot the user requested for the function, or AUTO_PHP_SLOT
if no slot was requested.
With the renaming these two values got merged into a single entry.
This patch un-merges them by renaming the what was vslot to requested_vslot.
So an out of chronological order list of name changes is:
''vslot'' -> ''requested_vslot''
''vslt'' -> ''vslot''
Signed-off-by: Simon Horman <horms@verge.net.au>
---
I have given this only light testing, I would appreciate it if others
could look at it.
This bug should probably be fixed for 3.4.0
This bug is in Bugzilla as Bug #1446
http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1446
Index: xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py
==================================================================---
xen-unstable.hg.orig/tools/python/xen/xend/XendDomainInfo.py 2009-04-23
02:53:43.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py 2009-04-23
02:57:07.000000000 +1000
@@ -809,7 +809,7 @@ class XendDomainInfo:
existing_dev_uuid = sxp.child_value(existing_dev_info,
''uuid'')
existing_pci_conf =
self.info[''devices''][existing_dev_uuid][1]
existing_pci_devs = existing_pci_conf[''devs'']
- vslot = AUTO_PHP_SLOT_STR
+ vslot = ""
for x in existing_pci_devs:
if ( int(x[''domain''], 16) ==
int(dev[''domain''], 16) and
int(x[''bus''], 16) ==
int(dev[''bus''], 16) and
@@ -817,7 +817,7 @@ class XendDomainInfo:
int(x[''func''], 16) ==
int(dev[''func''], 16) ):
vslot = x[''vslot'']
break
- if vslot == AUTO_PHP_SLOT_STR:
+ if vslot == "":
raise VmError("Device %04x:%02x:%02x.%01x is not
connected"
% (int(dev[''domain''],16),
int(dev[''bus''],16),
int(dev[''slot''],16),
int(dev[''func''],16)))
Index: xen-unstable.hg/tools/python/xen/xend/XendConfig.py
==================================================================---
xen-unstable.hg.orig/tools/python/xen/xend/XendConfig.py 2009-04-23
02:44:49.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xend/XendConfig.py 2009-04-23
02:44:54.000000000 +1000
@@ -1285,7 +1285,7 @@ class XendConfig(dict):
dpci_record = {
''VM'': self[''uuid''],
''PPCI'': ppci_uuid,
- ''hotplug_slot'':
pci_dev.get(''vslot'', 0)
+ ''hotplug_slot'':
pci_dev.get(''requested_vslot'', 0)
}
dpci_opts = pci_dev.get(''opts'')
@@ -1847,7 +1847,7 @@ class XendConfig(dict):
dpci_record = {
''VM'': self[''uuid''],
''PPCI'': ppci_uuid,
- ''hotplug_slot'':
pci_dev.get(''vslot'', 0)
+ ''hotplug_slot'':
pci_dev.get(''requested_vslot'', 0)
}
dpci_opts = pci_dev.get(''opts'')
Index: xen-unstable.hg/tools/python/xen/xend/server/pciif.py
==================================================================---
xen-unstable.hg.orig/tools/python/xen/xend/server/pciif.py 2009-04-23
02:44:49.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xend/server/pciif.py 2009-04-23
03:04:32.000000000 +1000
@@ -79,7 +79,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(pci_config.get(''vslot'', 0))
+ requested_vslot =
parse_hex(pci_config.get(''requested_vslot'', 0))
opts = pci_config.get(''opts'',
'''')
if len(opts) > 0:
@@ -90,7 +90,7 @@ class PciController(DevController):
back[''dev-%i'' % pcidevid] =
"%04x:%02x:%02x.%01x" % \
(domain, bus, slot, func)
back[''uuid-%i'' % pcidevid] =
pci_config.get(''uuid'', '''')
- back[''vslot-%i'' % pcidevid] = "%02x" %
vslot
+ back[''vslot-%i'' % pcidevid] = "%02x" %
requested_vslot
pcidevid += 1
if vslots != "":
Index: xen-unstable.hg/tools/python/xen/xm/create.py
==================================================================---
xen-unstable.hg.orig/tools/python/xen/xm/create.py 2009-04-23 02:44:49.000000000
+1000
+++ xen-unstable.hg/tools/python/xen/xm/create.py 2009-04-23 02:44:54.000000000
+1000
@@ -710,7 +710,8 @@ def configure_pci(config_devs, vals):
config_pci_opts.append([k, d[k]])
config_pci_bdf = [''dev'', [''domain'',
domain], [''bus'', bus], \
- [''slot'', slot],
[''func'', func], [''vslot'', vslot]]
+ [''slot'', slot],
[''func'', func],
+ [''requested_vslot'', vslot]]
map(f, d.keys())
if len(config_pci_opts)>0:
config_pci_bdf.append([''opts'', config_pci_opts])
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Simon Horman
2009-Apr-23 01:42 UTC
Re: [Xen-devel] [patch v2] xm: Fix hot-unplug of statically-assigned devices
Prior to changset 19510:5c69f98c348e - ''xm, xend: Replace
"vslt" with "vslot"'',
both vslt and vslot were used in the xm code, often fairly arbitrarily.
However, in the dictionary that describes a pci function both vslt and vslot
were present. vslt stored the slot assigned to the function. And
vslot stored the slot the user requested for the function, or AUTO_PHP_SLOT
if no slot was requested.
With the renaming these two values got merged into a single entry.
This patch un-merges them by renaming the what was vslot to requested_vslot.
So an out of chronological order list of name changes is:
''vslot'' -> ''requested_vslot''
''vslt'' -> ''vslot''
Signed-off-by: Simon Horman <horms@verge.net.au>
---
Thu, 23 Apr 2009 03:30:54 +1000
* I have given this only light testing, I would appreciate it if others
could look at it.
* This bug should probably be fixed for 3.4.0
* This bug is in Bugzilla as Bug #1446
http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1446
Thu, 23 Apr 2009 11:41:36 +1000
* Removed spirous tools/python/xen/xend/XendDomainInfo.py fragments,
these were a cosmetic change I was working on.
Index: xen-unstable.hg/tools/python/xen/xend/XendConfig.py
==================================================================---
xen-unstable.hg.orig/tools/python/xen/xend/XendConfig.py 2009-04-23
11:38:54.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xend/XendConfig.py 2009-04-23
11:38:58.000000000 +1000
@@ -1285,7 +1285,7 @@ class XendConfig(dict):
dpci_record = {
''VM'': self[''uuid''],
''PPCI'': ppci_uuid,
- ''hotplug_slot'':
pci_dev.get(''vslot'', 0)
+ ''hotplug_slot'':
pci_dev.get(''requested_vslot'', 0)
}
dpci_opts = pci_dev.get(''opts'')
@@ -1847,7 +1847,7 @@ class XendConfig(dict):
dpci_record = {
''VM'': self[''uuid''],
''PPCI'': ppci_uuid,
- ''hotplug_slot'':
pci_dev.get(''vslot'', 0)
+ ''hotplug_slot'':
pci_dev.get(''requested_vslot'', 0)
}
dpci_opts = pci_dev.get(''opts'')
Index: xen-unstable.hg/tools/python/xen/xend/server/pciif.py
==================================================================---
xen-unstable.hg.orig/tools/python/xen/xend/server/pciif.py 2009-04-23
11:38:54.000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xend/server/pciif.py 2009-04-23
11:38:58.000000000 +1000
@@ -79,7 +79,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(pci_config.get(''vslot'', 0))
+ requested_vslot =
parse_hex(pci_config.get(''requested_vslot'', 0))
opts = pci_config.get(''opts'',
'''')
if len(opts) > 0:
@@ -90,7 +90,7 @@ class PciController(DevController):
back[''dev-%i'' % pcidevid] =
"%04x:%02x:%02x.%01x" % \
(domain, bus, slot, func)
back[''uuid-%i'' % pcidevid] =
pci_config.get(''uuid'', '''')
- back[''vslot-%i'' % pcidevid] = "%02x" %
vslot
+ back[''vslot-%i'' % pcidevid] = "%02x" %
requested_vslot
pcidevid += 1
if vslots != "":
Index: xen-unstable.hg/tools/python/xen/xm/create.py
==================================================================---
xen-unstable.hg.orig/tools/python/xen/xm/create.py 2009-04-23 11:38:54.000000000
+1000
+++ xen-unstable.hg/tools/python/xen/xm/create.py 2009-04-23 11:38:58.000000000
+1000
@@ -710,7 +710,8 @@ def configure_pci(config_devs, vals):
config_pci_opts.append([k, d[k]])
config_pci_bdf = [''dev'', [''domain'',
domain], [''bus'', bus], \
- [''slot'', slot],
[''func'', func], [''vslot'', vslot]]
+ [''slot'', slot],
[''func'', func],
+ [''requested_vslot'', vslot]]
map(f, d.keys())
if len(config_pci_opts)>0:
config_pci_bdf.append([''opts'', config_pci_opts])
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Zhai, Edwin
2009-Apr-23 09:13 UTC
Re: [Xen-devel] [patch v2] xm: Fix hot-unplug of statically-assigned devices
Simon, Thanks for your fix. How about switching to another xenstore entry for qemu => xend communication? That is, change store entry in both sync_pcidev_info and xenstore_write_vslots(qemu). Does it work when specifying vslot in config file? Thanks, edwin Simon Horman wrote:> Prior to changset 19510:5c69f98c348e - ''xm, xend: Replace "vslt" with "vslot"'', > both vslt and vslot were used in the xm code, often fairly arbitrarily. > > However, in the dictionary that describes a pci function both vslt and vslot > were present. vslt stored the slot assigned to the function. And > vslot stored the slot the user requested for the function, or AUTO_PHP_SLOT > if no slot was requested. > > With the renaming these two values got merged into a single entry. > This patch un-merges them by renaming the what was vslot to requested_vslot. > > So an out of chronological order list of name changes is: > > ''vslot'' -> ''requested_vslot'' > ''vslt'' -> ''vslot'' > > Signed-off-by: Simon Horman <horms@verge.net.au> > > --- > > Thu, 23 Apr 2009 03:30:54 +1000 > > * I have given this only light testing, I would appreciate it if others > could look at it. > > * This bug should probably be fixed for 3.4.0 > > * This bug is in Bugzilla as Bug #1446 > http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1446 > > Thu, 23 Apr 2009 11:41:36 +1000 > > * Removed spirous tools/python/xen/xend/XendDomainInfo.py fragments, > these were a cosmetic change I was working on. > > Index: xen-unstable.hg/tools/python/xen/xend/XendConfig.py > ==================================================================> --- xen-unstable.hg.orig/tools/python/xen/xend/XendConfig.py 2009-04-23 11:38:54.000000000 +1000 > +++ xen-unstable.hg/tools/python/xen/xend/XendConfig.py 2009-04-23 11:38:58.000000000 +1000 > @@ -1285,7 +1285,7 @@ class XendConfig(dict): > dpci_record = { > ''VM'': self[''uuid''], > ''PPCI'': ppci_uuid, > - ''hotplug_slot'': pci_dev.get(''vslot'', 0) > + ''hotplug_slot'': pci_dev.get(''requested_vslot'', 0) > } > > dpci_opts = pci_dev.get(''opts'') > @@ -1847,7 +1847,7 @@ class XendConfig(dict): > dpci_record = { > ''VM'': self[''uuid''], > ''PPCI'': ppci_uuid, > - ''hotplug_slot'': pci_dev.get(''vslot'', 0) > + ''hotplug_slot'': pci_dev.get(''requested_vslot'', 0) > } > > dpci_opts = pci_dev.get(''opts'') > Index: xen-unstable.hg/tools/python/xen/xend/server/pciif.py > ==================================================================> --- xen-unstable.hg.orig/tools/python/xen/xend/server/pciif.py 2009-04-23 11:38:54.000000000 +1000 > +++ xen-unstable.hg/tools/python/xen/xend/server/pciif.py 2009-04-23 11:38:58.000000000 +1000 > @@ -79,7 +79,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(pci_config.get(''vslot'', 0)) > + requested_vslot = parse_hex(pci_config.get(''requested_vslot'', 0)) > > opts = pci_config.get(''opts'', '''') > if len(opts) > 0: > @@ -90,7 +90,7 @@ class PciController(DevController): > back[''dev-%i'' % pcidevid] = "%04x:%02x:%02x.%01x" % \ > (domain, bus, slot, func) > back[''uuid-%i'' % pcidevid] = pci_config.get(''uuid'', '''') > - back[''vslot-%i'' % pcidevid] = "%02x" % vslot > + back[''vslot-%i'' % pcidevid] = "%02x" % requested_vslot > pcidevid += 1 > > if vslots != "": > Index: xen-unstable.hg/tools/python/xen/xm/create.py > ==================================================================> --- xen-unstable.hg.orig/tools/python/xen/xm/create.py 2009-04-23 11:38:54.000000000 +1000 > +++ xen-unstable.hg/tools/python/xen/xm/create.py 2009-04-23 11:38:58.000000000 +1000 > @@ -710,7 +710,8 @@ def configure_pci(config_devs, vals): > config_pci_opts.append([k, d[k]]) > > config_pci_bdf = [''dev'', [''domain'', domain], [''bus'', bus], \ > - [''slot'', slot], [''func'', func], [''vslot'', vslot]] > + [''slot'', slot], [''func'', func], > + [''requested_vslot'', vslot]] > map(f, d.keys()) > if len(config_pci_opts)>0: > config_pci_bdf.append([''opts'', config_pci_opts]) > >-- best rgds, edwin _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel