On 04/04/2017 06:52 PM, Burakov, Anatoly wrote:
Hi Andrew,
I think a key to the main problem is the same IOMMU group used for both PCI
functions.
It tries to set IOMMU type using the same file descriptor twice. The second set
is dummy, since the same value is set, but still fails, I guess, because it is
already in use.
See logs with debug enabled and few extra logs below:
Yes you're right. Specifically, eal_vfio.c:vfio_setup_device() at line 311
(where we check for number of groups) - the code always assumes that one
active group means we've just initialized a new group, which may not
necessarily be the case if there's more than one device per group.
Alejandro, please correct me if I'm wrong, but I think this raises another
issue: vfio_release_device() seems to attempt to close group fd unconditionally,
which is probably a bad idea if there are more than one device per group.
If it is true, please, care about it.
Would you be so kind to come up with a patch to fix this oversight, or should I
do it? :)
Please, take a look at http://dpdk.org/dev/patchwork/patch/23202/
Basically it just moves IOMMU type set under previous container-not-set
condition.
Also my testing is very restricted, no hotplug, no different IOMMU groups.
Andrew.