Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Having performance issues (bottleneck?) with VM GPU passthrough

Featured Replies

I am doing a trial of Unraid and I have been trying to get a Windows 7 VM working at near-native performance levels, but I have had no luck so far.

 

Some of my hardware specs:

motherboard: GIGABYTE GA-990XA-UD3

CPU: AMD Phenom II X6 1090T

GPU: AMD Radeon RX 480

Monitor resolution: 4k

 

When I run Windows 7 natively, I am able to maintain 60fps during desktop operation, video streaming, and typical gaming.

When I run Windows 7 in my VM, my framerate is pretty low during all of the above scenarios. I even get rendering artifacts/delays when moving windows around on the desktop.

I installed the latest GPU software and did not notice an improvement. When I open up WattMan, it shows 0% GPU usage almost constantly when on the desktop or streaming video, with low usage even when I fire up a game (edit: this may be irrelevant - see following reply.)

I'm not sure where to start looking for the bottleneck. Does anyone have ideas of what I can try?

 

Below is my current VM XML config:

<domain type='kvm'>
  <name>Windows 7</name>
  <uuid>5df48de5-c63a-059c-2bed-6b6f7d6fa2ef</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 7" icon="windows7.png" os="windows7"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
    <locked/>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='1'/>
    <vcpupin vcpu='1' cpuset='2'/>
    <vcpupin vcpu='2' cpuset='4'/>
    <vcpupin vcpu='3' cpuset='5'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.5'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor id='none'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='4' threads='1'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Windows 7/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/Win7_HomePrem_SP1_English_x64.iso'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/virtio-win-0.1.118-2.iso'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:7c:b6:b8'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <source mode='connect'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <hostdev mode='subsystem' type='pci' managed='yes' xvga='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x14' function='0x2'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc049'/>
      </source>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc226'/>
      </source>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc227'/>
      </source>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </memballoon>
  </devices>
</domain>

  • Author

Additional info:

I decided to do a more direct performance comparison by running the same game with the same settings/map, and taking a screenshot of resource usage graphs after a short session.

The game was Killing Floor 2 on High graphics settings, with Vsync and variable framerate.

 

When in the VM, my framerate seemed to peak at 30 fps, with dips to around 20 fps when a lot of effects were rendered.

When native, my framerate stayed steady at 60 fps, and I was only able to get it to dip to 55 fps for a fraction of a second.

 

When I compared the resource usage graphs, I noticed that although I had thought my GPU usage was low on the VM, it was actually higher if anything. In addition, it looks like CPU usage was possibly higher on the VM, although more balanced between cores.

I will try to attach the pictures in a following post, although I am having trouble with that feature of the forum.

  • Author

Attaching screenshot of performance graphs after my test in native Windows 7

native.jpg.5fdf098c0dddf71cbbc58069475e980d.jpg

  • Author

Attaching screenshot of performance graphs after my test in a VM of Windows 7

VM.jpg.a2a6fd55001a1bbc44cf65211e30bdaa.jpg

so, you're going from giving windows 7 12 cores (native) to just 4 (vm)... that might be the first part of the differences.

 

read the thread stickied at the top about cpu pinning and isolating cores. that's step 1.

 

step 2 is to just experiment with core assignments. 

 

question: if you're running a 6 core chip, with 12 logical cores, then why does it skip a core in your assignment sequence?

  • Author

Where are you seeing 12 cores? I thought my CPU had 6 (logical.)

As for why I skip a core in the assignment sequence, I thought the pairing of cores was (0,3) (1,4) (2,5) but I could be wrong.

 

I'll try going through the CPU pinning guide again, but I didn't have any luck with it before. I think there are just too many things in it that I don't understand, and OVMF bios isn't even an option for me in the Unraid UI (it's greyed out on seaBIOS.)

  • Author

I've looked through all of the suggestions I can find for determining which logical cores are physically paired, but all of the information I can find makes it seem like all 6 of my cores are separate (no hyper threading.)

After digging around for mention of whether or not my model of CPU actually has hyper threading, I'm starting to think that maybe it does not. If anyone knows better, please correct me.

I've looked through all of the suggestions I can find for determining which logical cores are physically paired, but all of the information I can find makes it seem like all 6 of my cores are separate (no hyper threading.)

After digging around for mention of whether or not my model of CPU actually has hyper threading, I'm starting to think that maybe it does not. If anyone knows better, please correct me.

I looked around a little, and all I could find was a reference to turbo, which increases the clockspeed of 3 of the cores while pausing the other 3??? That doesn't make a whole lot of sense to me, but it may explain some of what you are seeing. Possibly playing around with power management to lock all 6 cores to normal speed and keep it out of turbo may help, or maybe try to identify which 3 cores are "primary" or something.

 

I have no personal experience, just did a little googling and found some interesting tidbits.

 

Maybe linux just isn't well optimized for virtualized performance on a CPU that old.

  • Author

Maybe linux just isn't well optimized for virtualized performance on a CPU that old.

That's possible, however I have definitely seen some solid performance on this hardware when running Linux natively.

Thanks for checking around. I'll continue to play with things and see if anything makes a difference.

I've looked through all of the suggestions I can find for determining which logical cores are physically paired, but all of the information I can find makes it seem like all 6 of my cores are separate (no hyper threading.)

After digging around for mention of whether or not my model of CPU actually has hyper threading, I'm starting to think that maybe it does not. If anyone knows better, please correct me.

 

I misread some info on your cpu when I looked it up. You have 6 cores.

 

but, you're still dropping from 6 cores to 4, losing 1/3 of your available cpu power.

 

the best you can do is isolate cpus 1,2,3,4,5 in the syslinux.cfg , assign all 5 of those cores to the vm, and put the emulator pin on core 0.

 

that would look like this (if your'e on 6.2.4):

 

default /syslinux/menu.c32
menu title Lime Technology, Inc.
prompt 0
timeout 50
label unRAID OS
  menu default
  kernel /bzimage
  append isolcpus=1,2,3,4,5 initrd=/bzroot
label unRAID OS GUI Mode
  kernel /bzimage
  append initrd=/bzroot,/bzroot-gui
label unRAID OS Safe Mode (no plugins, no GUI)
  kernel /bzimage
  append initrd=/bzroot unraidsafemode
label Memtest86+
  kernel /memtest

 

and then the xml

 

<vcpu placement='static'>5</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='1'/>
    <vcpupin vcpu='1' cpuset='2'/>
    <vcpupin vcpu='2' cpuset='3'/>
    <vcpupin vcpu='3' cpuset='4'/>
    <vcpupin vcpu='4' cpuset='5'/>
    <emulatorpin cpuset='0'/>
  </cputune>

 

If you're trying run other dockers/plugins, you may need to give unRaid another core, and only give the vm 4 then.

  • Author

I had to make a new VM from scratch, but I got one running with the 0.1.100 virtio drivers recommended in the pinning guide, and the pinning set up just like suggested. The CPU graph when gaming looks much more like the graph in my native test now, although my framerate still suffers (I think there may be less stuttering now.)

I think there is something wrong with the GPU passthrough itself. Maybe it's something to do with my particular motherboard model? If it is, I suppose I could do another trial run of Unraid someday when I have a new motherboard.

did you install the manufacturers driver for the gpu?

 

did you isolate the 5 cores from unRaid via the syslinux.cfg?

 

does core 0 max out while gaming? (you'll have to monitor via web gui on another computer) Are you running anything else on the server while gaming, like a docker/plex streaming?

 

where i the vdisk for the vm located? on the array, on a cache drive? ssd? these can also impact performance.

 

 

I've looked through all of the suggestions I can find for determining which logical cores are physically paired, but all of the information I can find makes it seem like all 6 of my cores are separate (no hyper threading.)

After digging around for mention of whether or not my model of CPU actually has hyper threading, I'm starting to think that maybe it does not. If anyone knows better, please correct me.

I looked around a little, and all I could find was a reference to turbo, which increases the clockspeed of 3 of the cores while pausing the other 3??? That doesn't make a whole lot of sense to me, but it may explain some of what you are seeing. Possibly playing around with power management to lock all 6 cores to normal speed and keep it out of turbo may help, or maybe try to identify which 3 cores are "primary" or something.

 

I have no personal experience, just did a little googling and found some interesting tidbits.

 

Maybe linux just isn't well optimized for virtualized performance on a CPU that old.

 

also, did you follow up on this? I also have very little understanding of it, but if it's not allowing the cpu's to go to turbo mode (or if that is causing issues during transitional periods?), or even wake up, then that will cause them to not be able to feed the gpu. Did you check the bios settings on your server to see if you can have them unlocked and running all the time?

 

But I think it may be key to determine which are the main cores.

  • Author

did you install the manufacturers driver for the gpu?

 

did you isolate the 5 cores from unRaid via the syslinux.cfg?

 

does core 0 max out while gaming? (you'll have to monitor via web gui on another computer) Are you running anything else on the server while gaming, like a docker/plex streaming?

 

where i the vdisk for the vm located? on the array, on a cache drive? ssd? these can also impact performance.

 

I did install the latest driver from the manufacturer's website (AMD)

 

I did isolate the cores in syslinux.cfg, although I did so with 4 cores instead of 5 in order to more closely match the pinning guide.

When I tried again with 5 cores pinned, Windows went to blue screen and then the VM stopped recognizing the USB devices during boot so I was unable to recover the image (I was sloppy and did not back up the VDI with 0.1.100 virtio drivers and since I am in the last day of my trial period, I don't have enough time to create it again. Any further testing I do will have to be with the image I made using the latest virtio version.

 

I did get a good look at the load on all 6 cores during a gaming session, and core 0 was under very light load. While gaming, I had nothing other than the (pretty much idle) drive array running, so CPU load on the Unraid side is pretty light.

 

My vdisk is stored on my array's cache, which is a single SSD. Game load times did not seem longer than when I run on a native OS, although I didn't time it with an actual clock.

 

I've looked through all of the suggestions I can find for determining which logical cores are physically paired, but all of the information I can find makes it seem like all 6 of my cores are separate (no hyper threading.)

After digging around for mention of whether or not my model of CPU actually has hyper threading, I'm starting to think that maybe it does not. If anyone knows better, please correct me.

I looked around a little, and all I could find was a reference to turbo, which increases the clockspeed of 3 of the cores while pausing the other 3??? That doesn't make a whole lot of sense to me, but it may explain some of what you are seeing. Possibly playing around with power management to lock all 6 cores to normal speed and keep it out of turbo may help, or maybe try to identify which 3 cores are "primary" or something.

 

I have no personal experience, just did a little googling and found some interesting tidbits.

 

Maybe linux just isn't well optimized for virtualized performance on a CPU that old.

 

also, did you follow up on this? I also have very little understanding of it, but if it's not allowing the cpu's to go to turbo mode (or if that is causing issues during transitional periods?), or even wake up, then that will cause them to not be able to feed the gpu. Did you check the bios settings on your server to see if you can have them unlocked and running all the time?

 

But I think it may be key to determine which are the main cores.

 

I did look around in my BIOS for a Turbo setting and I did find one, but it was already disabled. It was nested under an optimization setting which I did have enabled, so just to be sure I turned that off, but I noticed no difference in performance.

  • Author

Note: I did try with 5 pinned cores assigned to the VM (latest virtio) and there was no notable change in performance, other than having slightly lower average CPU load (load was already not terribly high with 4 cores, something around 75% average (estimating visually) while gaming. None of the cores appeared to spike to 100% on the Windows CPU graphs at any point during gaming.

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.