In this article I’d like to share my impressions I made with Xen during the last weeks. I met Xen a few months ago but due to general lack of interest I didn’t have the chance to give it a try.Para-virtualization - why bother at all? There were actually no significant reasons why I should use virtualization. But then it started with this thread, followed by this one. The really fascinating - and tough quite useful - aspect of virtualization consists of the hardware access policy which is implemented by the virtualization host. Guests (virtualized operating systems) may access specific devices like hard disks, PCI cards etc. The host system - in our case Xen’s domain-0 - can grant guests
access to physical hardware. Xen comes up with a great feature which allows you to pass a PCI device trough to an unprivileged domain. Once you pass the PCI device (as boot parameter) to Xen’s hypervisor you won’t be able to use it within your domain-0 (dom0). A dummy driver stops the dom0 from accessing the device. If everything went well, you should be able to see the device on your domU (unprivileged). That’s the idea so far…
I have tried many scenarios: NetBSD-CURRENT / {Xen3 ,Xen3.3}, NetBSD 5.0.1 / {Xen3, Xen3.3} and finally NetBSD 5.0_STABLE / {Xen3, Xen3.3}. The last combination worked devianatfine for me. NetBSD 5.0.1 had some problems during boot process so I decided to use a stable version which finally worked. If you tend to use Xen 3 (not Xen 3.3) be aware to use the vmlinux and NOT the compressed vmlinuz image. Otherwise you’ll get something like this:
|
|
Whatever kernel you may specify be sure its an ELF binary (ELF 64-bit LSB executable, x86-64, version 1 (SYSV) in my case). You should find a vmlinux
file in the kernel source directory (usually /usr/src). Be sure you use this file as your domU kernel and don’t forget to create a ramdisk image as this is required by Xen. I won’t waste my time helping you how to configure your domU and how to setup Xen + Xen tools. There are a lot of tutorials and (good) papers related to this issue. Feel free to invest some time in understanding Xen and the virtualization system. Perhaps I should mention that Xen 3.3 has a better kernel image support than Xen 3. You should be able to specify a compressed kernel image (bzImage) in your domU configuration without any problems. You should however - therefor I’d like to thank #xen on Freenode for their great support - use a kernel image >= 2.6.26 (correct me if I’m wrong ?!). Debian Lenny provides vmlinuz-2.6.30 so you should be fine with that. At the moment there is no pciback support for Xen 3.3. As told here someone with python knowledge has to port pkgsrc/sysutils/xentools3/patches/{patch-dm,patch-dn} to xentools33. Although I had some good intensions and took a look at the files that have to be modified, I quickly gave it up due to its complexity. Maybe someone else - with more spare time - could commit some changes. Xen 3.3 needs pciback and I need pciback support on NetBSD. Back to Xen 3 … So I was able to pass some PCI device to my domU. Well not really, at least not using my own kernel. I had this configuration:
|
|
And got this:
|
|
Since wmlinuz-2.6.18-xen doesn’t have built-in driver support for my WLAN card, I had to use some different kernel (2.6.30). Then I sould theoretically be able to use my PCI device. Well things turned up to be a little be different as expected:
|
|
dmesg
told me:
|
|
… and lspci
told me nothing:
|
|
What went wrong? Did I miss something in the kernel configuration file? As you see there is a lot of work to do. I suppose there are no such problems under Linux (as dom0). Again: Correct me if I’m wrong! I really appreciate NetBSDs Xen support on this mailing list as it provides precious information you might find helpful - like I did. Nevertheless we sholuld push up the whole porting process so we can have a 100% functionable Xen integration in NetBSD. If you got some ideas that might solve my problem (in particular) don’t esitate to contact me. Or even better: Write a mail to the mailing list. The whole discussion can be followed on NetBSD’s mailing list port-xen.