LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 07-15-2021, 07:42 PM   #1
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,141

Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
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.

Last edited by jmgibson1981; 07-15-2021 at 07:45 PM.
 
Old 07-15-2021, 07:57 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
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.

Last edited by jefro; 07-15-2021 at 07:59 PM.
 
Old 07-15-2021, 10:10 PM   #3
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,141

Original Poster
Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
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.

Last edited by jmgibson1981; 07-15-2021 at 11:12 PM.
 
Old 07-16-2021, 02:19 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
Still think it is a resource issue.
 
Old 07-17-2021, 12:02 PM   #5
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,141

Original Poster
Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
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.
 
Old 07-28-2021, 05:24 PM   #6
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,141

Original Poster
Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
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.

Last edited by jmgibson1981; 07-28-2021 at 05:26 PM.
 
Old 07-28-2021, 10:03 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
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?
 
Old 08-13-2021, 03:42 PM   #8
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,141

Original Poster
Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
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 &

Last edited by jmgibson1981; 08-13-2021 at 03:44 PM.
 
Old 08-13-2021, 06:47 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
Thanks for the update.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Xen PCI Passthrough RAID Bus Controller trispad Linux - Virtualization and Cloud 0 09-27-2011 07:23 AM
Chipset support for PCI Passthrough in KVM rajivdp Linux - Virtualization and Cloud 0 06-14-2011 02:02 AM
PCI Passthrough with KVM fails martdj Linux - Virtualization and Cloud 5 02-01-2010 08:01 AM
LXer: Linux virtualization and PCI passthrough LXer Syndicated Linux News 0 10-29-2009 12:20 PM
problem with kvm and pci passthrough with two devices vegatux Linux - General 0 09-24-2009 10:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 03:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration