
on 2014/07/28 21:03, Aline Manera wrote:
On 07/28/2014 06:38 AM, Zhou Zheng Sheng wrote:
Hi,
Yu Xin and me tested the patches on a PC with RHEL6.4 installed. We turned on vt-d in BIOS, enabled intel_iommu=on in kernel command line.
After setting this, I verified the IOMMU is enabled. dmesg | grep -e DMAR -e IOMMU | grep -e "DRHD base" -e "enabled"
Unfortunately qemu failed to assign PCI devices. The Qemu log was vague. I googled and tried some solutions but none worked. It might be the problem of the machine itself or the maturity of this feature in kernel 2.6 and qemu-kvm 0.12.
I also find the libvirt version on RHEL6 is a bit old, it does not provide the necessary device information, so we have to write extra code to fetch it. Moreover, the iommu group sysfs is added in Kenel 3.5, so RHEL6 does not have it.
It seems we need more time and work to support RHEL6, so I suggest that, for the first release of this feature, we support the latest Fedora, then in next releases we improve the support for RHEL6.
What about RHEL7, openSUSE 13.1 and Ubuntu 14.04?
I find a Ubuntu 14.04 physical server and test the features, it works. VFIO driver does not work so I tested the traditional KVM driver. The VFIO problem may be related to a known apparmor bug https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1276719/+activity Investigated RHEL 7 on a virtual machine, the basic devices parsing and iommu sysfs work. I don't have spare machines for installing RHEL 7 to actually test the iommu and passthrough, but since the dependencies are ready, the patch should work on this distro. During the test I also updated my device XML parsing code. I'm sorry I can not send the unit test patches today because I was stuck on a bug. When I ran unit tests, I found the libvirt is stuck, after investigation I found it's because the device parsing code initiated a new libvirtconnection instance each time, and this object is not a singleton. So the result is that it always allocated a new connection instead of sharing an existing one. I didn't have time to improve libvirtconnection, so I changed the passthrough patches implementation a little to use an existing libvirtconnection instance and allocate existing connections.
on 2014/07/28 11:01, Zhou Zheng Sheng wrote:
Hi,
I rebased the patches and send you the drafts for you to test and develop. I'll add doc and unit tests, then send a formal v9 patch to list today.
on 2014/07/25 16:39, Yu Xin Huo wrote:
Apply failed.
On 7/21/2014 5:36 PM, Zhou Zheng Sheng wrote:
Hi,
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.
I'll update API and unit test once everyone is happy with the interface and logic.
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.
Zhou Zheng Sheng (4): 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
docs/API.md | 11 +- 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 | 7 +- src/kimchi/model/config.py | 2 + src/kimchi/model/host.py | 38 ++-- src/kimchi/model/hostdev.py | 311 +++++++++++++++++++++++++++++++ src/kimchi/model/libvirtstoragepool.py | 18 +- src/kimchi/model/vmhostdevs.py | 324 +++++++++++++++++++++++++++++++++ src/kimchi/rollbackcontext.py | 3 + src/kimchi/xmlutils.py | 26 ++- tests/test_rest.py | 6 +- tests/test_storagepool.py | 7 +- 15 files changed, 784 insertions(+), 40 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
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel