This content has been marked as final. Show 3 replies
Our of curiosity, are you passing PCI devices into guests? Care to share how your doing that and how well its working?
Yes - I am using pci-passthrough and it works really well. There are only a couple of steps involved to get that working, depending on how much you want to automate that.
First off, you have to create a new initrd with the xen-pciback module included. This is done like this:
mkinitrd -v -f initrd-pciback-`uname -r`.img `uname -r` --with=xen-pciback
Modify grub and either clone the current boot entry and substitute the used initrd with the newly created one or edit the actual one.
After rebooting you should be able to load the xen-pciback module:
Now comes the part where you need to decide which pci device you gonna bind to xen-pciback. The only thing to keep in mind is that you only can bind major device numbers to xen-pciback.
Let's see what lspci spits out:
07:00.0 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (rev 06)
07:00.1 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (rev 06)
This is the PCIe nic that I want to bind to xen-pciback and I think that I can't partially bind that nic to xen-pciback, that is, if one of these interfaces is already in use on the VM server, trying to bind the card to xen-pciback will result in an instant reboot - at least this is what I experienced with the Qlogic FC HBA, where I tried to bind one port to xen-pciback, while the other one connected to my FC SRs… ;)
Anyway, after having loaded xen-pciback you can actually bind the pci device to xen-pciback like this:
where /etc/pciback/pciback.sh looks like this:
if [ $# -eq 0 ] ; then
echo "Require a PCI device as parameter"
for pcidev in $@ ; do
if [ -h /sys/bus/pci/devices/"$pcidev"/driver ] ; then
echo "Unbinding $pcidev from" $(basename $(readlink /sys/bus/pci/devices/"$pcidev"/driver))
echo -n "$pcidev" > /sys/bus/pci/devices/"$pcidev"/driver/unbind
echo "Binding $pcidev to pciback"
echo -n "$pcidev" > /sys/bus/pci/drivers/pciback/new_slot
echo -n "$pcidev" > /sys/bus/pci/drivers/pciback/bind
The last thing to do is to modify the vm.cfg to actually pass the device to the guest, where you need to add the following line:
pci = ['07:00.0', '07:00.1']
Actually I am passing both ports to the same guest and I don't know, if one could pass one minor device to one guest, while passing the other minor device to another guest.
This has been working since OVM 2.2.x and pciback has been renamed xen-pciback in this 3.1.1 release - otherwise simply use pciback, when trying this on 2.2.x or up to 3.0.3
How well is it working? - Well great, as far as I can tell. The only issue is, that you loose the HA ability since you could only achieve HA using another VM server with the exact same hardware layout - even the slots would have to be occupied by the same cards using the same drivers, since otherwise your cards will probably show up in a different order and your pci option in the vm.cfg would not work anymore
Besides that - I have been using this for months now and never had any issue.
very interesting, thanks for sharing.