[libvirt] Matching the type of mediated devices in the migration

Alex Williamson alex.williamson at redhat.com
Mon Jul 30 15:56:49 UTC 2018


On Sun, 29 Jul 2018 21:19:41 +0000
"Wang, Zhi A" <zhi.a.wang at intel.com> wrote:

> BACKGROUND
> 
> As the live migration of mdev is going to be supported in VFIO, a scheme of deciding if a mdev could be migratable between the source machine and the destination machine is needed. Mostly, this email is going to discuss a possible solution which needs fewer modifications of libvirt/VFIO.
> 
> The configuration of a mdev is located in the domain XML, which guides libvirt how to find the mdev and generating the command line for QEMU. It basically only includes the UUID of a mdev. The domain XML of the source machine and destination machine are going to be compared before the migration really happens. Each configuration item would be compared and checked by libvirt. If one item of the source machine is different from the item of destination machine, the migration fails. For mdev, there is no any check/match before the migration happens yet.
> 
> The user could use the node device list of libvirt to list the host devices and see the capabilities of those devices. The current node device code of libvirt has already been able to extract the supported mdev types from a host PCI device, plus some basic information, like max supported mdev instance of a host PCI device.
> 
> THE SOLUTION
> 
> To strictly check the mdev type and make sure the migration happens between the compatible mediated devices, three new mandatory elements in the domain XML below the hostdev element would be introduced:
> 
> vendorid: The vendor ID of the mdev, which comes from the host PCI device. A user could obtain this information from the host PCI device which supports mdev in the node device list.
> productid: The product ID of the mdev, which also comes from the host PCI device. A user could obtain this information from the same approach above.

The parent of an mdev device is not necessarily a PCI device.

> mdevtype: The type of the mdev. As the creation of the mdev is managed by the user, the user knows the type of the mdev and would be responsible for filling out this information.
> 
> These three elements are only needed when the device API of a mdev is "vfio-PCI". Take the example of mdev configuration from https://libvirt.org/formatdomain.html to illustrate the modification:
> 
>   <devices>
>     <hostdev mode='subsystem' type='mdev' model='vfio-pci'>
>     <source>
>       <address uuid='c2177883-f1bb-47f0-914d-32a22e3a8804'/>
>       <vendorid>0xdead</vendorid> <!-- The VID of the host PCI device which supports this mdev -->
>       <productid>0xbeef</productid> <!-- The PID of the host PCI device which supports this mdev -->
>       <mdevtype>type</mdevtype> <!-- The vendor-specific mdev type string -->
>     </source>
>     </hostdev>
> 
> With the newly introduced elements above, the flow of the creation of a domain XML with mdev will be like:
> 
> 1. The user obtains the vendorid/productid from node device list
> 2. The user fills the vendorid/productid/mdevtype in the domain XML
> 3. When a migration happens, libvirt check these elements. If one item is different between two domain XML, then migration fails.

I don't see how this solves anything.  The vendor and product are
redundant and specific to PCI hosted mdev devices.  These do nothing
to enhance the definition of an mdev type, where we've decided the
mdev type is a guest software compatible definition of a device.
Simply knowing the type doesn't help me know that the state data
between source and target is compatible.  This is the difference
between knowing I'm migrating from machine 'pc-440fx' to 'pc-440fx'
versus 'pc-i440fx-2.12' to 'pc-440fx-2.11'.  We need somehow to define
a version of a device, what we consider to be compatible versions for
migration, and hopefully some standard(ish) mechanism libvirt could
use to determine this.  Thanks,

Alex




More information about the libvir-list mailing list