Simon Horman wrote:
> On Fri, May 15, 2009 at 07:31:23PM +0800, Cui, Dexuan wrote:
>> When we specify duplicate pci device strings in guest config file,
>> like pci=['01:00.0', '01:00.0'], or pci=['01:00.0',
>> '0000:01:00.0'], or pci=['01:00.0', '0000:01:00.0@7'],
>> xend doesn't detect this case and passes the pci string to ioemu and
>> ioemu invokes register_real_device() twice for the same physical
>> device and this could cause unexpected behavior.
>>
>> The patch detects this case and makes the domain construction fail.
>>
>> diff -r 40d4267296ad tools/python/xen/xend/server/pciif.py
>> --- a/tools/python/xen/xend/server/pciif.py Fri May 15 08:12:39 2009
>> +0100 +++ b/tools/python/xen/xend/server/pciif.py Fri May 15
>> 17:14:43 2009 +0800 @@ -396,6 +396,9 @@ class
>> PciController(DevController): pci_str =
>> '%04x:%02x:%02x.%01x' % (domain, bus, slot, func)
>> pci_str_list = pci_str_list + [pci_str] pci_dev_list =
>> pci_dev_list + [(domain, bus, slot, func)] + + if
>> pci_str_list != list(set(pci_str_list)): + raise
>> VmError('pci: duplicate devices specified in guest config?')
>>
>> for (domain, bus, slot, func) in pci_dev_list:
>> try:
>
> Hi Dexuan, Hi Keir,
>
> At a glance it seems that this might not be correct,
> as set() may not preserve the order of pci_str_list.
Thanks for pointing this out !
> However, as set will remove any duplicates, its probably
> sufficient to use:
>
> if len(pci_str_list) != len(set(pci_str_list):
Yes. This should be the right way.
Thanks,
-- Dexuan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|