[Kimchi-devel] [PATCH v12 0/6] Host Device Passthrough

Aline Manera alinefm at linux.vnet.ibm.com
Mon Oct 13 15:50:11 UTC 2014


I will apply the backend patches (1 to 5) as they are ready.

The front-end has just one comment so as soon as it is done it will be 
merged too.

On 10/08/2014 06:08 AM, Zhou Zheng Sheng wrote:
> Hi all,
>
> Host device passthrough is to directly assign host device to guest
> exclusively, so there is no virtualization overhead, and it improves
> guest performance greatly. It's useful if you have a server with lots
> of PCIe slots and cards.
>
> Changelog:
>
> This v12 patch improves the coding style. For example, using reflection
> instead of maintaining method map, using lxml.builder to generate XML
> strings.
>
> The v11 patch series improve disto compatibility and device filtering.
>
> Firstly, the patches adapt to Ubuntu 14.04, RHEL 6.5, RHEL 7, Fedora 20
> and Fedora 19. It just relies on libvirt node-device API, kernel vfio
> framework and /sys/kernel/iommu_group. So any distribution providing
> these features should work. On old distributions like RHEL 6.5, they
> are shipped with 2.6.X kernel which do not support vfio and sysfs iommu
> group. We also try to be compatible, but as far as we tested, the PCI
> passthrough feature using the traditional pci-stub + kvm approach is
> buggy and not mature. So in this patch series, the back-end provides a
> capability in /config/capabilities for the front-end to check, and then
> freezes PCI passthrough web UI in this case. Didn't test on SuSe, just
> because the author could not find a physical SuSe server. The patches
> should work on SuSe as long as it provides the dependencies.
>
> Secondly, there is 2 changes in PCI device filtering. Previously, we
> only allowed to assign the "leaf" devices to guest. For example,
> instead of assigning a USB controller, we assign the connected USB
> device. We also made a PCI device whitelist according to the class
> code. After some tests, we find that it's hardly useful if we only
> allow "leaf" device, because in many cases the user wants to assign a
> parent device. For example, the user may want to assign an HBA card to
> guest, while there are many children LUNs under this card. The PCI
> device code is also not a good way for checking if a device is suitable
> to be passed through. There are too many vendors and devices, you'll
> always find some "good" devices are out of the whitelist, and if we
> grant the relared class code, it'll introduce "bad" devices.
>
> So in this patch we just filter out video cards and PCI bridges. They
> are not for passthrough absolutely. We also allow to passthrough a
> parent device. The back-end provides API to check the affected devices
> if you passthrough a particular one. The affected devices are the
> devices in the same iommu group and their children devices.
>
> As regard to the front-end, we only implemented PCI device passthrough,
> PCI devices are the mostly useful and interesting devices to passthrough.
> The back-end actually supports passing through LUNs and USB devices.
>
> To test the patches, firstly reboot your host os, enable vt-d in BIOS.
> Before loading Linux kernel, append "intel_iommu=on" to kernel
> arguments. If you want to make it persistent, edit "grub.conf" and
> append it. Then just apply the patch, start Kimchi daemon, edit a
> shutdown guest, you'll see "Host PCI Device" tab. In the listing,
> select "To Add", then click "+" besides one of the device. You'll find
> PCI devices in the same group are also added. Then close the dialogue
> and start the guest. In guest OS, "lspci" can show you the passthrough
> devices.
>
> In future, we plan to add more helpful information to assist user. For
> example, when the user selects an NIC card, the front-end shows the
> configured IP address. When the user selects an HBA card, the front-end
> shows the related block devices such as sda sdb ... So the user can
> avoid assigning a device in use by the host.
>
> Yu Xin Huo (1):
>    Host device passthrough (Front-end): Add PCI Devices to VM
>
> Zhou Zheng Sheng (5):
>    Host device passthrough: List all types of host devices
>    Host device passthrough: List eligible device to passthrough
>    Host device passthrough: Directly assign and dissmis host device from
>      VM
>    Host device passthrough: List VMs that are holding a host device
>    Host device passthrough: Add unit tests and documents
>
>   docs/API.md                            |  66 ++++++-
>   src/kimchi/API.json                    |  38 ++++
>   src/kimchi/control/host.py             |   7 +
>   src/kimchi/control/vm/hostdevs.py      |  43 +++++
>   src/kimchi/featuretests.py             |  10 +-
>   src/kimchi/i18n.py                     |  13 ++
>   src/kimchi/mockmodel.py                |  94 +++++++++-
>   src/kimchi/model/config.py             |   6 +-
>   src/kimchi/model/host.py               |  48 +++--
>   src/kimchi/model/hostdev.py            | 323 +++++++++++++++++++++++++++++++++
>   src/kimchi/model/libvirtstoragepool.py |  18 +-
>   src/kimchi/model/vmhostdevs.py         | 314 ++++++++++++++++++++++++++++++++
>   src/kimchi/rollbackcontext.py          |   3 +
>   src/kimchi/xmlutils.py                 |  24 +++
>   tests/test_model.py                    |  31 ++++
>   tests/test_rest.py                     |  12 +-
>   tests/test_storagepool.py              |   7 +-
>   ui/css/theme-default/guest-edit.css    |  86 ++++++++-
>   ui/js/src/kimchi.api.js                |  55 ++++++
>   ui/js/src/kimchi.guest_edit_main.js    |  81 +++++++++
>   ui/pages/guest-edit.html.tmpl          |  28 +++
>   21 files changed, 1251 insertions(+), 56 deletions(-)
>   create mode 100644 src/kimchi/control/vm/hostdevs.py
>   create mode 100644 src/kimchi/model/hostdev.py
>   create mode 100644 src/kimchi/model/vmhostdevs.py
>




More information about the Kimchi-devel mailing list