On Thu, 2017-06-29 at 20:03 +0200, Andrea Bolognani wrote:
This series is required to solve a known limitation in the
current incarnation of device isolation support[1], namely
the inability to isolate host devices coming from IOMMU
group 0.
The issue lies in the fact that virDomainDeviceInfo, and
all virDomain*Def that embed it, are usually allocated
through VIR_ALLOC(), which result in all their fields being
initialized to zero.
That's worked out just fine so far, because zero was a
sensible default value for all existing fields; however,
when implementing isolation groups, we add a new
virDomainDeviceInfo::isolationGroup field which we need
to be initialized to -1 instead so that it doesn't overlap
with IOMMU group 0 mentioned above.
Or we could just, you know, do the sensible thing and
store (IOMMU group + 1) instead of (IOMMU group) in
virDomainDeviceInfo::isolationGroup and avoid the issue
altogether? I'm actually quite embarassed I didn't think
of that earlier :/
Solving the issue involves creating twenty or so
virDomain*DefNew() functions and using them instead of
VIR_ALLOC() every time a virDomain*Def needs to be created,
which is arguably a pretty good idea regardless.
We could still merge this series, though, or at least
parts of it. It improves upon some questionable code.
--
Andrea Bolognani / Red Hat / Virtualization