[Kimchi-devel] [PATCH v9 0/5] Host device passthrough: Summary
Zhou Zheng Sheng
zhshzhou at linux.vnet.ibm.com
Fri Aug 1 03:08:04 UTC 2014
on 2014/08/01 04:13, Aline Manera wrote:
>
> On 07/30/2014 12:29 PM, Zhou Zheng Sheng wrote:
>> Hi all,
>>
>> v9:
>> Update API.md, API.json, unit tests and MockModel. Investigated
>> distro compatibility problems, adapted to Fedora 20, Fedora 19 and
>> Ubuntu 14.04.
>
> What about openSUSE 13.1 and RHEL7?
>
The investigation status is as follow.
Fedora 20: Tested on physical machine.
Fedora 19: Found some problems such as missing device information, so I
updated the code to gather the information, then tested on physical machine.
Ubuntu 14.04: Firstly test the patch on a VM, and found it support the
necessary dependencies. Then find a physical machine, test the patches.
The basic functions works but it fails to start a guest with passthrough
devices. It may be related to a known apparmor bug.
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1276719/+activity
RHEL 7: Didn't find a spare machine to install RHEL 7, and didn't
successfully setup a RHEL 7 VM with correct subscription. So I tested
CentOS 7 in a VM. It provides the necessary dependencies. Previously I
uses the same method to test a Ubuntu 14.04 VM and find it should
support dependencies. So I have some confidence on CentOS 7 too. Though
I can not promise it always works on RHEL 7, I expect if there is any
problems, it should be easy to fix and does not lead to large change in
code.
RHEL 6: The basic functions did not work because old libvirt does not
provide enough device information. It's the same problem as in Fedora
19, so the code changes in v9 solving this problem helps RHEL 6 too.
Tested the patches on a physical machine. Unfortunately the machine
hardware is too old to support PCI passthrough, but the basic function
works if I made some small changes to the code. I don't have other
spare modern machines, so I can just test this far. So I'll send v10 to
reflect this small change.
There is only one difference between a VM and physical machine. There is
no intel IOMMU emulation in QEMU so we can not actually start a nested
guest with passthrough in VM, but device information collection and
libvirt XML definition are the same.
>> v8:
>> Change the URI for listing affected passthrough devices, suggested by
>> Aline. Move hostdev.py to src/kimchi/model.py. Still discussing API
>> with the front-end developer. Once the API accepted, The author should
>> add tests for model and mockmodel, and change API.md and API.json
>> accordingly.
>> v7:
>> Some minor coding style improvements.
>> v6:
>> Do not passthrough PCI device of class code 0x07. It might contains
>> system device not suitable to assign to guest.
>> v5:
>> Filter ealigible pci devices according to pci class. When assigning a
>> device to VM, check if there are other VMs holding it. Use
>> "kimchi.model.utils.get_vm_config_flag()" to correctly set the device
>> attaching API flag.
>> v4:
>> Add new sub-collection to host device to list the VMs holding the
>> device.
>> v3:
>> Fix a small naming error introduced by rebase.
>> v2:
>> Handle the devices in VM's sub-collection "hostdevs".
>> v1:
>> Handle the devices in VM template.
>>
>> This patch series is to enable Kimchi to assign hos devices directly to
>> a VM, thus greately improve VM performance. Currently we support
>> assigning
>> PCI device, USB device and SCSI LUN. For example, we can assign an NIC
>> to VM to improve guest network throughput, or passthrough a USB camera
>> to enable the guest OS to record video.
>>
>> Host devices form a tree. We can assign most of the devices in the tree
>> to VM. By assigning a device, all the devices in its sub-tree are also
>> assigned. It might not make sense to assign a USB controller, because
>> the host may be using one of the devices connected to the controller.
>> Instead, Kimchi just presents the "leaf" devices to assign to guest.
>>
>> In recent Linux kernel and KVM, it is able to recognize the IOMMU group
>> of a PCI device. The "leaf" PCI devices in the same IOMMU group should
>> be assigned and dismissed together. The IOMMU group is the actual
>> smallest isolation granularity of the PCI devices.
>>
>> The first patch is to list all host devices information. It's useful on
>> its own to show host devices information.
>>
>> The second patch is to list all eligible host devices to assign, as well
>> as the "affected" devices in the same IOMMU group.
>>
>> The third patch creates a sub-collection "hostdevs" to the VM resource,
>> and deals with assigning and dismissing devices.
>>
>> The fourth patch adds a sub-collection "vm_holders" to the host device
>> resource. It's to list all VMs that are holding the device.
>>
>> 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 | 31 +++
>> src/kimchi/control/host.py | 7 +
>> src/kimchi/control/vm/hostdevs.py | 44 +++++
>> src/kimchi/featuretests.py | 10 +-
>> src/kimchi/i18n.py | 10 +
>> src/kimchi/mockmodel.py | 127 ++++++++++++-
>> src/kimchi/model/config.py | 2 +
>> src/kimchi/model/host.py | 39 ++--
>> src/kimchi/model/hostdev.py | 337
>> +++++++++++++++++++++++++++++++++
>> src/kimchi/model/libvirtstoragepool.py | 18 +-
>> src/kimchi/model/vmhostdevs.py | 324
>> +++++++++++++++++++++++++++++++
>> src/kimchi/rollbackcontext.py | 3 +
>> src/kimchi/xmlutils.py | 26 ++-
>> tests/test_model.py | 31 +++
>> tests/test_rest.py | 12 +-
>> tests/test_storagepool.py | 7 +-
>> 17 files changed, 1042 insertions(+), 52 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
>>
>
--
Zhou Zheng Sheng / 周征晟
E-mail: zhshzhou at linux.vnet.ibm.com
Telephone: 86-10-82454397
More information about the Kimchi-devel
mailing list