scnr.net

It’s not possible? Says who?

VGA passthrough to a Xen HVM DomU (Windows 7; Dom0: Arch Linux)

with 2 comments

I don’t like dual boot solutions to switch between Windows and Linux. I’m considering to put Windows into a virtual machine. However, the main reason to keep Windows at all is occasional gaming. Therefore I did a quick & dirty Xen installation to figure out whether this is a viable option for me.

Here are my notes:

  • basic Arch installation using archlinux-2012.12.01-dual.iso
  • as usual, the arch wiki pages were helpful: Official Arch Linux Install Guide, Unofficial Beginners’ Guide, Xen
  • installed xen-hg-unstable using packer
  • used lsusb -t to figure out which usb devices are connected to which root hub
  • used lsusb -v to get PCI-ID (iSerial) of that hub
  • to unbind a device from its driver and make it available for passthrough:
    • echo $ID > /sys/bus/pci/device/$ID/driver/unbind
    • echo $ID > /sys/bus/pci/drivers/pciback/new_slot
    • echo $ID > /sys/bus/pci/drivers/pciback/bind
  • after unbinding the VGA adapter: blank screen – therefore: ssh!
  • created a qcow2 Container for the guest system
  • config file for the VM:
  • name="windows"
    builder="hvm"
    vcpus=4
    memory=2048
    disk = [
            "/root/windows.qcow2.img,qcow2,hda,w",
    #       "/dev/sda,,hdb,w",
            "/root/en_windows_7_professional_x64.iso,,hdc,r,devtype=cdrom"
    ]
    vif=[ 'bridge=xenbr0' ]
    boot="cd"
    pae=1
    nx=1
    gfx_passthru=1
    pci=["00:02.0", "00:1a.0", "00:1b.0"]
     
    vnc=1
    vnclisten="0.0.0.0:2"
    vncpasswd="********"
  • VNC just shows “serial0 console”, but delivers mouse events!
  • lspci:
  • [...]
    00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
    [...]
    00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
    00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)
    [...]
  • 00:02.0 is Intel HD Graphics 2000 (from a Core i5-2500T)
  • 00:1a.0 has a keyboard and a mouse attached to it
  • the VM went into standby once, waking it up with ‘xl trigger windows s3resume’ resulted in a bluescreen -> disabled standby in Windows

I installed drivers from the Intel website for the graphics adapter, everything else worked fine out of the box.

To test the performance I used the “Windows Experience Index” and StarCraft II, once in the VM and once in a similar installation running directly on the same hardware:
xen-passthrough-perf
I combined three screenshots here… left to right: running without Xen; Xen (vcpus=2); Xen (vcpus=4). The degraded hard disk performance is probably due to using a container file instead of a real partition. Apart from the memory operations the results are quite good.

StarCraft II was running at 1920×1200 “Windowed (Fullscreen)”, low settings. I chose one of my last replays, about 20 minutes long, set it to follow the camera of the other player and used Fraps to measure the performance:

[FPS]  min   max   avg
VM:     19    60    41.160
real:   21    60    45.109

For a quick and dirty proof of concept this was quite successful. Next will be an attempt to do VGA passthrough on another machine with a NVidia GeForce GTX560Ti, but I don’t know when I will find time for that, yet.

Written by johnLate

December 17th, 2012 at 1:40 am

Posted in Uncategorized

2 Responses to 'VGA passthrough to a Xen HVM DomU (Windows 7; Dom0: Arch Linux)'

Subscribe to comments with RSS or TrackBack to 'VGA passthrough to a Xen HVM DomU (Windows 7; Dom0: Arch Linux)'.

  1. Nice write up, was looking at doing the same – the low i/o is from using qcow2 should see a boost launching from a lvm container.

    timmy

    17 Jan 13 at 17:28

  2. good news to read that integrated intel graphics support the VGA passthrough!

    About the disk performance and windows perf index, I’ve seen so far that 5.9 is the max for an HDD, thus 7.3 must be an SSD. Can it be that the virtualized Windows does not recognize the storage as an SSD? Did you try alternative drivers?

    The more I read about Xen, the more it seems it get superseded by KVM…

    Eric

    10 Feb 14 at 18:38

Leave a Reply