Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
QEMU/KVM GPU pass-through recommendations
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
NathanZachary
Moderator
Moderator


Joined: 30 Jan 2007
Posts: 2608

PostPosted: Thu Jul 04, 2024 6:01 pm    Post subject: QEMU/KVM GPU pass-through recommendations Reply with quote

Hello,

I have a Windows 10 VM that I use for Photoshop and sometimes some light gaming on Steam. The performance is quite laggy, even in Photoshop, so I would like to get a GPU to pass-through to the VM via QEMU/KVM (using virt-manager). I have a free PCIe 4.0 x16 slot available, and would like to find a decent AMD-based GPU for a reasonable price to handle these relatively light tasks. Do you have any recommendation on models that would be good for this purpose?

Thank you in advance.

Cheers,
Nathan Zachary
_________________
“Truth, like infinity, is to be forever approached but never reached.” --Jean Ayres (1972)
---avatar cropped from =AimanStudio---
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5929

PostPosted: Fri Jul 05, 2024 8:37 am    Post subject: Re: QEMU/KVM GPU pass-through recommendations Reply with quote

NathanZachary wrote:
Hello,

I have a Windows 10 VM that I use for Photoshop and sometimes some light gaming on Steam. The performance is quite laggy, even in Photoshop, so I would like to get a GPU to pass-through to the VM via QEMU/KVM (using virt-manager). I have a free PCIe 4.0 x16 slot available, and would like to find a decent AMD-based GPU for a reasonable price to handle these relatively light tasks. Do you have any recommendation on models that would be good for this purpose?

Thank you in advance.

Cheers,
Nathan Zachary


why not pass the active gpu to the vm?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
NathanZachary
Moderator
Moderator


Joined: 30 Jan 2007
Posts: 2608

PostPosted: Fri Jul 05, 2024 2:17 pm    Post subject: Reply with quote

That would require going headless on my main workstation then, I guess. That could be an option if need be. I also could try to spend more time optimising the VM because it seems odd to me that even moving a window around the screen has lag. Maybe there are better settings for performance?
_________________
“Truth, like infinity, is to be forever approached but never reached.” --Jean Ayres (1972)
---avatar cropped from =AimanStudio---
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3428

PostPosted: Fri Jul 05, 2024 2:58 pm    Post subject: Reply with quote

Moving windows is laggy?
Are you sure you have kvm enabled?
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
NathanZachary
Moderator
Moderator


Joined: 30 Jan 2007
Posts: 2608

PostPosted: Fri Jul 05, 2024 4:52 pm    Post subject: Reply with quote

Yes, there is a noticeable delay when performing basically any task in the Windows 10 VM. Here are some details:

Code:

Hypervisor: KVM
Architecture: x86_64
Emulator: /usr/bin/qemu-system-x86_64
Chipset: Q35
Firmware: UEFI

Logical host CPUs: 48
vCPU allocation: 8
Host-passthrough: Yes

Total host memory: 128699 MiB
Current allocation: 16384 MiB

Device type: VirtIO Disk 1
Disk bus: VirtIO

Video: QXL

Spice Server Listen Type: Address
Address: Hypervisor default


If you have any troubleshooting suggestions, I would greatly appreciate them.

Thank you.
_________________
“Truth, like infinity, is to be forever approached but never reached.” --Jean Ayres (1972)
---avatar cropped from =AimanStudio---
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6145
Location: Dallas area

PostPosted: Fri Jul 05, 2024 5:51 pm    Post subject: Reply with quote

Hard to say what's up, without seeing the config file.

But with win10 and up, you could use virtio-gpu, instead of a passthrough gpu.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
mrbassie
l33t
l33t


Joined: 31 May 2013
Posts: 821
Location: Go past the sign for cope, right at the sign for seethe. If you see the target you've missed it.

PostPosted: Fri Jul 05, 2024 5:54 pm    Post subject: Re: QEMU/KVM GPU pass-through recommendations Reply with quote

NathanZachary wrote:
I have a free PCIe 4.0 x16 slot available, and would like to find a decent AMD-based GPU for a reasonable price to handle these relatively light tasks. Do you have any recommendation on models that would be good for this purpose?


The best which can be hammered into that slot, purchased at the least possible expense whilst in factory condition.

(sorry, couldn't resist).
_________________
I spent a christmas in Vienna twenty something years ago. It was a beautiful city. Everyone was so friendly.
Back to top
View user's profile Send private message
Ralphred
l33t
l33t


Joined: 31 Dec 2013
Posts: 653

PostPosted: Fri Jul 05, 2024 6:30 pm    Post subject: Reply with quote

I uploaded this 5 second clip of the lag I get when using QXL on my windows VM. This lag is gone when using passthrough to an old RX560 card (Baffin - polaris11).

There are two other things that have seriously improved the performance:
  • Giving the VM its own SSD to run from*, the xml for it is below
    Code:
    <disk type="block" device="disk">
      <driver name="qemu" type="raw" cache="none" io="native" discard="unmap"/>
      <source dev="/dev/sda"/>
      <target dev="sda" bus="sata"/>
      <address type="drive" controller="0" bus="0" target="0" unit="0"/>
    </disk>
    This obviously doesn't effect input or display lag, but it's much snappier to work with.
  • Using https://atlasos.net to cut back on windows footprint and overhead. I only use(d) passthrough to run one game, a Ubisoft title, so a pretty good test of functionality, it worked flawlessly.
    It's fair to say that running Atlas in a VM >= Running vanilla windows 10 on the same hardware with no hypervisor - from a UI usability point of view. If it works for you in testing, I can't recommend it enough.


*I run two VM "templates" in VMM using the same partitions of the physical disk - one the "original" VM before making the changes to allow GPU passthrough, then the passthrough enabled VM. As long as I don't try and boot them both at the same time it works fine (as in I'll get QXL video if running one, passthrough the other). I think if I were to sysprep the windows install it might be bootable in a non-vm environment, it certainly has "all the right bits set" when viewed in parted.
Back to top
View user's profile Send private message
LiamOS
n00b
n00b


Joined: 06 Jun 2012
Posts: 67
Location: Ireland

PostPosted: Fri Jul 05, 2024 6:34 pm    Post subject: Reply with quote

I picked up an AMD 6500XT second hand recently for this exact purpose, was pretty much plug-and-play.
_________________
CFLAGS=" -O999999"
Back to top
View user's profile Send private message
Cruslan
n00b
n00b


Joined: 06 Jan 2024
Posts: 26

PostPosted: Fri Jul 05, 2024 7:32 pm    Post subject: Reply with quote

You can use 60 FPS patch for QEMU. In default QEMU's frame intervals set to 30 ms(about 30-31 FPS). It can be quite laggy. By decreasing that to 16 ms(60 FPS~) you can get better display output. You can apply that patch to app-emulation/qemu package. Patch;
Code:
diff --unified --recursive --text qemu-4.2.0/include/ui/console.h qemu-4.2.0.new/include/ui/console.h
--- qemu-4.2.0/include/ui/console.h    2019-12-12 13:20:48.000000000 -0500
+++ qemu-4.2.0.new/include/ui/console.h    2020-04-07 14:50:19.995242274 -0400
@@ -26,7 +26,7 @@
 #define QEMU_CAPS_LOCK_LED   (1 << 2)
 
 /* in ms */
-#define GUI_REFRESH_INTERVAL_DEFAULT    30
+#define GUI_REFRESH_INTERVAL_DEFAULT    16
 #define GUI_REFRESH_INTERVAL_IDLE     3000
 
 /* Color number is match to standard vga palette */
[/url]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum