• A
    vfio/ccw/pci: Allow devices to opt-in for ballooning · 238e9172
    Alex Williamson 提交于
    If a vfio assigned device makes use of a physical IOMMU, then memory
    ballooning is necessarily inhibited due to the page pinning, lack of
    page level granularity at the IOMMU, and sufficient notifiers to both
    remove the page on balloon inflation and add it back on deflation.
    However, not all devices are backed by a physical IOMMU.  In the case
    of mediated devices, if a vendor driver is well synchronized with the
    guest driver, such that only pages actively used by the guest driver
    are pinned by the host mdev vendor driver, then there should be no
    overlap between pages available for the balloon driver and pages
    actively in use by the device.  Under these conditions, ballooning
    should be safe.
    
    vfio-ccw devices are always mediated devices and always operate under
    the constraints above.  Therefore we can consider all vfio-ccw devices
    as balloon compatible.
    
    The situation is far from straightforward with vfio-pci.  These
    devices can be physical devices with physical IOMMU backing or
    mediated devices where it is unknown whether a physical IOMMU is in
    use or whether the vendor driver is well synchronized to the working
    set of the guest driver.  The safest approach is therefore to assume
    all vfio-pci devices are incompatible with ballooning, but allow user
    opt-in should they have further insight into mediated devices.
    Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
    238e9172
trace-events 10.5 KB