Computers 'n Stuff: Building a Xen aware Nvidia grafic card driver: 6800GS SLI in Xen under OpenSuse10.2 64Bit

I here share the resolutions for my Linux problems so they might safe somebody some time.

Monday, June 11, 2007 parmanent link to this post

Building a Xen aware Nvidia grafic card driver: 6800GS SLI in Xen under OpenSuse10.2 64Bit

Xen is a highly professional Open Source virtualization technology which promises the least performance loss. Heres how I got the Closed Source Nvidia driver going unde OpenSuse-Xen 64bit AMD X2.

3D acceleration and SLI mode in particular are only supported by the closed source nvidia drivers. However, Xen requires a modified "Xen-Aware" kernel to run in a pravirtualized environment. Only the most recent CPUs support (SVM for AMD)fully virtulized virtual mashines that run without kernel modifications. On many websites you'll find the infromation that blah blah blah X2 CPUs from AMD would support full virtualization (SVM) blah blah. But this is wrong. Don't be mistaken only the AM2 version of X2 processors support SVM. If its not AM2 its not SVM. So don't make the same mistake like me and get a socket 939 CPU.

The Nvidia driver does not support Xen Kernels and its closed source, so you can't modifie it yourself. But not everything is lost. The nvidia driver uses a kernel module as a compatibility layer to load the binary driver. This kernel module is open source, so in theory it should be possible to modify the kernel module so that it works with Xen. And belive it or not some brave guys really hacked the kernel module to support xen-kernels.

So I had to get the hypervisor and the default-xen kernel of opoen suse 10.2 running. This is pretty easy you can use Yast to do the installation stuff (isntall hypervisor, install default-xen and have it change the bootloader settings) And of course you'll need all the devel packeges to compile the kernels.

Now boot with the default kernel and install install the binary nvidia drivers you are going to patch later.

sh NVIDIA-Linux-x86-1.0-9746-pkg2.run --x-module-path=/usr/lib64/xorg/modules/ -q
The version of the compatibility layer and the binaries have to match. the nvidia install script will do the job for you. However, it will refuse to run in a paravirualized environment. So for the Xen-kernel, be prepared to do everything manually.

Boot into the dom0 domain. you'll only have the console available because the xserver won't work. without the propreitary nvidiea driver with the GPUs in SLI mode.

init 3 # stops Xserver and swiches to runlevel 3

make cloneconfig
make prepare
wget NVIDIA_xen-9746.patch.gz
wget http://us.download.nvidia.com/XFree8...-9746-pkg1.run
sh NVIDIA-Linux-x86-1.0-9746-pkg2.run -x # extract sources
cd NVIDIA-Linux-x86-1.0-9746-pkg2/usr/src/nv
zcat ../../../../NVIDIA_xen-9746.patch.gz | patch -p4 #patch sources


Sombody stated you have to modify usr/src/nv/os-interface.c line 1288 modified to:

#if 0
to avoid compiling erroers. but this was not true for me. The driver compiled fine without any modifications. So first try without modification.


make SYSSRC=/usr/src/linux module # make nvidia kernel module
cp nvidia.ko /lib/modules/`uname -r`/updates/nvidia.ko
depmod -a
modprobe nvidia
init 5 # when successful enter runlevel 5 to start x server

Now the driver should load.
I also read this command to install the modules:
install -D -o root -g root -m 0644 nvidia.ko /lib/modules/`uname -r`/updates/nvidia.ko
But for me copying to the /udate folder of the kernel module folder was sufficient.
However my 3D performace was poor (1fps with glxgears)
So i'll try some older patches and see what happens.
The other patch I tried did not any better. It turned out they dont support SLI. If you turn of SLI by
nvidia-xconfig --no-sli
3D work descent (12800 fps for glxgears) which is about the same than without Xen.
Links to Nvidia kernel module Xen patches
another Nvidia xen patch howto for open suse

Labels: , , , , ,