LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   PCI Passthrough Windows 10. Random stuttering. (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/pci-passthrough-windows-10-random-stuttering-4175697800/)

jmgibson1981 07-15-2021 07:42 PM

PCI Passthrough Windows 10. Random stuttering.
 
I've switched between Windows / Linux with a Windows 10 vm with the GPU passed through.

The issue. The vm totally lags and stutters out when I have Handbrake and Makemkv going on the host. Otherwise it runs bare metal near as I can tell. I know they add load. But when the machine is running Windows on the bare metal it doesn't cause an issue when the same programs are running at the same time as my games or whatever. In this case with the vm I don't even have a game running and it runs terrible. Stuttery mouse movement in the vm just mousing in Windows.

I followed this guide.

https://mathiashueber.com/pci-passth...rtual-machine/

I created this script based on the guides suggestions. I just wrapped it to check if the vm is running or not. I have it automated at 5 minute intervals via cron.

Code:

#!/bin/sh
# tadaen sylvermane | jason gibson
# test for cpu performance in kvm pass through vm
# source - https://mathiashueber.com/performance-tweaks-gaming-on-virtual-machines/

# changes cpu scaling governor depending on vm active or no

# in Xubuntu 20.04 the default is powersave on my system

if pgrep qemu-system-x86 ; then
        for file in \
        /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor ; do
                grep -q powersave "$file" && echo "performance" > "$file"
        done
else
        for file in \
        /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor ; do
                grep -q performance "$file" && echo "powersave" > "$file"
        done
fi

# end script #

My physical hardware is dated but I also don't run very demanding stuff (by today's standards). I dislike most of the newer games. Mostly in the World of Warcraft, Skyrim, Minecraft among a few others is where I spend my time.

CPU - i5 3470
RAM - 16gb DDR3 Corsair
SSD1 - 120gb Crucial I think
SSD2 - 250gb Crucial
PSU - 650w Seasonic

I have my Logitech unifying dongle plugged directly into my kvm switch. It only has the usb outputs going to the tower. One to the host and other to the passed through usb 3.0 pcix card. The display is a 32" 1080p tv. I Have hdmi from the host to the first hdmi port. Hdmi 2 is direct from the passed through video card.

*EDIT* I did consider storage activity however 2 things remove that. One, they are SSDs. Should be able to handle it. Two, both makemkv and handbrake are doing there business direct to the server over the network. Other than the actual programs themselves all data is on the server.

jefro 07-15-2021 07:57 PM

Permon on host or taskman to see load. I assume you are using all your resources ripping. Then check client. Somewhere you are maxing out resources. If you are using gpu to assist then it too can be bottleneck.

You can pause VM and check again.

jmgibson1981 07-15-2021 10:10 PM

Did some testing. I get the feeling that Windows prioritizes stuff by it's own rules whereas linux you have to control it. Better in many ways clearly if you know about it. I did some research and found the nice and renice commands. I added a single line to my script above. Performance is night and day compared to earlier. Thank you for turning me onto resource specifically. I knew it was load but didn't know how to tell or control it.

Code:

renice -19 $(ps aux | grep libvirt+ | grep Windows | awk '{print $2}')
As I understand it -20 being the max priority. This puts it way ahead of everything except the system itself.

*EDIT* Spoke to soon. Further testing and I got a nasty wake up call. Even with the VM at max priority it still no good. Works, just not great.

jefro 07-16-2021 02:19 PM

Still think it is a resource issue.

jmgibson1981 07-17-2021 12:02 PM

Agree. I tried hugepages. The vm has 8gb of ram. Still tinkering. It's definitely the host holding cup power. Just can't figure why it doesn't give it to the vm even with the nice value.

jmgibson1981 07-28-2021 05:24 PM

An update. I found out about Proton and Lutris. I switched to bare metal Xubuntu and I routinely get 90fps in World of Warcraft through Lutris. I've also been enjoying my steam games a bit. Bring on the Skyrim.

That being said I just now decided to try the load test again. I got the same thing. It's something about how Windows prioritizes. Any game seems to run like crap when I have a rip and encode running. Windows I can do those both and run games at the same time.

It's not a big deal really. Just bugs me. But with the aforementioned Proton & Lutris I can now have my cake and eat it too. The vm was not the issue, it's something on Linux. I'll dink around and chase it sometime. Maybe play with nice values on this now rather than through the vm.

jefro 07-28-2021 10:03 PM

Guess it's possible that the system you have isn't fully or correctly working/supported as it should.

Look at this too. https://wiki.gentoo.org/wiki/GPU_pas...bvirt_qemu_kvm

You never said what you saw on performance metrics. Is it memory/disk or what?

jmgibson1981 08-13-2021 03:42 PM

https://forums.lutris.net/t/wineserv...s-windows/1531

Forgive me. was out of town awhile.


I realized it started good then as the day went on with my log in and log out of the game it got worse. I found this link above talking about a problem with wine staging. I checked via top and ps and found I had a dozen or so battle.net processes even when it was closed. I wrote a simple script to kill any battle.net processes before launching Lutris. Thus far the performance is beautiful. I'm quite certain that it was full ram + swapping. I'll report back after awhile once I have more time under it to find if the problem returns.

Script here.

Code:

#!/bin/sh

# kill any previous battle.net
for process in $(ps aux | grep Battle | grep -v grep | awk '{print $2}') ; do
        kill "$process"
        wait
done
lutris &


jefro 08-13-2021 06:47 PM

Thanks for the update.


All times are GMT -5. The time now is 07:44 AM.