# helpdesk #virtualization #kvm #qemu Windows vm really slow

So I’m using virt-manager on Ubuntu 18.04 to have a windows virtual machine to run the few windows apps I need and also to latter on pass a secondary GPU in order to play games but right now I only have one. My problem is that the virtual machine freezes every now and then and performers very slowly. I don’t know if maybe I have configured it bad so I will include screenshots of my config.
Screenshot%20from%202019-05-23%2016-36-20|720x303

Edit: oh can someone please teach me how to add the hashtags to the title I have done it in other posts but I can’t figure out how to do it here thanks:sweat_smile:

edit2: here are my system specs and and I forgot to mention that I have already enabled all the options in the bios for the host computer

[email protected]
OS: Ubuntu 18.04 bionic
Kernel: x86_64 Linux 5.0.17-050017-generic
Uptime: 37m
Packages: 4541
Shell: bash 4.4.19
Resolution: 2560x1080
DE: GNOME
WM: GNOME Shell
WM Theme: Arc-Dark
GTK Theme: Arc-Dark [GTK2/3]
Icon Theme: Paper
Font: Roboto 11
CPU: AMD Ryzen 7 2700X Eight-Core @ 16x 3.7GHz [49.5°C]
GPU: GeForce GTX 1080
RAM: 8686MiB / 16048MiB

You can take a few different approaches.

  1. GPU Passthrough. There are guides on this site and elsewhere on how to accomplish this. It’s not simple, but once it’s up and running it works. Disadvantage is that you’ll likely need a KVM or startup/shutdown the guest to access the host. Work is being done in this area to get things down to a single GPU, but I’ve yet to find a guide that will work out of the box without a second GPU.
  2. SteamPlay + Proton. Also most GoG games should work as well. SteamPlay has a growing list of games that work great on Linux. I don’t even need to use Windows anymore except for Adobe Creative Cloud work and MAYBE some Office 365. GoG games use qemu for a lot of the older DOS based games, so you can actually create a FreeDOS VM, set up your games, and run things that way.
  3. VMWare seems to have better performance from an ‘indirect GPU access’ standpoint, or at least it used to. To the best of my knowledge, QEMU’s GPU methods use a client/server model whereas VMWare has a built in display driver for better integration with the host. You can grab VMWare Player for free.
  4. EDIT: I forgot to mention you could also always run Windows as the host OS depending on your needs. I did this for a long time until SteamPlay got to where it is today. In this sense, you basically have an OS-X style system in a way. Have your VM run on boot, your shell open up an SSH connection, and Linux is containerized in VirtualBox or VMWare Player. It’s fast, works great, and stays out of the way. Great if you do a lot of terminal work, but not much GUI stuff.
1 Like

Oh Lord you have 16 sockets for your CPU config… noooo

You should set 1 socket and 2-4 cores and 2 threads.

2 Likes

lol thanks i was kinda wondering about that to as when it says sockets isn’t talking about how many cpu I have installed?

edit: okay so i think I fixed that but the vm is still lagging i going to try what @Richard1 said and used vmWare but, I would like to get kvm working in case I do need it latter down the line for gpu passthrough.

oh okay so for running my windows app (mostly just configuration software for different peripherals) it’s better to use VMware? that’s mainly my concern right now as I have yet to find a game that doesn’t work on proton I was just using kvm in case I ever decide to go down the gpu passthrough route.

You’ve configured it for a maximum of 8 but you’re only using one core per current allocation, change it to 8. Also you’re probably better off using host-passthrough instead of picking EPYC and would also benefit from CPU pinning too.

the problem is when I set it to copy host config if I do it before installing windows I get a blue screen when trying to load the windows iso and if I try to set it after it just resets to EPYC. and wow I didn’t notice that no wonder I was only getting a single core :man_facepalming: I fixed it so the config says current allocation 8 and max allocation 8 and it seems a little better but it still hanging

Not copy host config, host-passthrough. There is no option in the list I’m aware of, you have to edit it with virsh. I have an intel CPU but it would look something like this

  <cpu mode='host-passthrough' check='none'>
    <topology sockets='1' cores='4' threads='2'/>
  </cpu>
2 Likes

ohhhhh what file would I edit? Sorry kinda new to this

You use the virsh command and then edit win10. If you don’t see any VMs then use sudo virsh.

1 Like

thanks, I just tried that now I’m going to see if that helps

edit: its definitely better and the CPU usage is no longer at 100 but it still hangs every now and then. I think maybe something got messed up with the windows install maybe so I’m going to try and reinstalling and see if that helps, if not I might just use VMware or something I think that’s a little easier to get setup

edit 2: so im trying to reinstall windows and this is the blue screen

i was talking about earlier if i set copy host CPU configuration

Maybe try with Q35 chipset?

1 Like

nope does the same thing. I’m starting to worry if I’m having trouble with KVM already imagine when I try to get GPU passthrough:sweat_smile: maybe I should stick to vmware or something. stupid question probably but are games completely unplayable on those kinds of VM? even if the games that are not really demanding like visual novels and jrpgs

For giggles try using core2duo as the CPU type. When I had some blue screen issues that was what I used.

1 Like

no if i set it to any thing other the the host it will boot I guess it doesn’t like my cpu lol thanks but i think i’m going to go to vmware or maybe even better virtualbox

this type of bsod may be an instability in an overclock, or memory speed, or just bad vfio drivers in the guest.

get windows working first then add the pcie devices.

when it crashes, drop to a terminal type dmesg and paste the last 2-3 screens of dmesg output here please.

1 Like

here you go
[ 559.808848] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[ 1141.624648] virbr0: port 2(vnet0) entered blocking state
[ 1141.624649] virbr0: port 2(vnet0) entered disabled state
[ 1141.624701] device vnet0 entered promiscuous mode
[ 1141.624931] virbr0: port 2(vnet0) entered blocking state
[ 1141.624932] virbr0: port 2(vnet0) entered listening state
[ 1143.634154] virbr0: port 2(vnet0) entered learning state
[ 1145.650099] virbr0: port 2(vnet0) entered forwarding state
[ 1145.650110] virbr0: topology change detected, propagating
[ 1165.789748] virbr0: port 2(vnet0) entered disabled state
[ 1165.790795] device vnet0 left promiscuous mode
[ 1165.790801] virbr0: port 2(vnet0) entered disabled state
[ 1322.951678] virbr0: port 2(vnet0) entered blocking state
[ 1322.951680] virbr0: port 2(vnet0) entered disabled state
[ 1322.951735] device vnet0 entered promiscuous mode
[ 1322.952119] virbr0: port 2(vnet0) entered blocking state
[ 1322.952121] virbr0: port 2(vnet0) entered listening state
[ 1324.978592] virbr0: port 2(vnet0) entered learning state
[ 1326.990563] virbr0: port 2(vnet0) entered forwarding state
[ 1326.990566] virbr0: topology change detected, propagating
[ 1353.664813] virbr0: port 2(vnet0) entered disabled state
[ 1353.666664] device vnet0 left promiscuous mode
[ 1353.666669] virbr0: port 2(vnet0) entered disabled state
[ 1427.874226] virbr0: port 2(vnet0) entered blocking state
[ 1427.874229] virbr0: port 2(vnet0) entered disabled state
[ 1427.874301] device vnet0 entered promiscuous mode
[ 1427.874733] virbr0: port 2(vnet0) entered blocking state
[ 1427.874735] virbr0: port 2(vnet0) entered listening state
[ 1429.901397] virbr0: port 2(vnet0) entered learning state
[ 1431.917366] virbr0: port 2(vnet0) entered forwarding state
[ 1431.917369] virbr0: topology change detected, propagating
[ 1449.093189] virbr0: port 2(vnet0) entered disabled state
[ 1449.097265] device vnet0 left promiscuous mode
[ 1449.097272] virbr0: port 2(vnet0) entered disabled state
[ 2045.008440] virbr0: port 2(vnet0) entered blocking state
[ 2045.008444] virbr0: port 2(vnet0) entered disabled state
[ 2045.008552] device vnet0 entered promiscuous mode
[ 2045.008869] virbr0: port 2(vnet0) entered blocking state
[ 2045.008871] virbr0: port 2(vnet0) entered listening state
[ 2047.018863] virbr0: port 2(vnet0) entered learning state
[ 2049.034856] virbr0: port 2(vnet0) entered forwarding state
[ 2049.034859] virbr0: topology change detected, propagating
[ 2058.630177] SQUASHFS error: squashfs_read_data failed to read block 0x545978
[ 2178.893166] virbr0: port 2(vnet0) entered disabled state
[ 2178.894427] device vnet0 left promiscuous mode
[ 2178.894431] virbr0: port 2(vnet0) entered disabled state
[ 2728.129715] vboxdrv: Found 16 processor cores
[ 2728.148209] vboxdrv: TSC mode is Invariant, tentative frequency 3700020322 Hz
[ 2728.148211] vboxdrv: Successfully loaded version 6.0.8 (interface 0x00290008)
[ 2728.352245] VBoxNetFlt: Successfully started.
[ 2728.353795] VBoxNetAdp: Successfully started.
[ 2728.355492] VBoxPciLinuxInit
[ 2728.356983] vboxpci: IOMMU found
[ 2939.343402] SUPR0GipMap: fGetGipCpu=0xb
[ 2940.310971] vboxdrv: 0000000000000000 VMMR0.r0
[ 2940.487462] vboxdrv: 0000000000000000 VBoxDDR0.r0
[ 2940.573589] vboxpci: created IOMMU domain 00000000a7624391
[ 2940.837028] vboxdrv: 0000000000000000 VBoxEhciR0.r0
[ 3161.211763] vboxpci: freeing IOMMU domain 00000000a7624391
[ 3169.711649] vboxdrv: 0000000000000000 VMMR0.r0
[ 3169.857295] vboxdrv: 0000000000000000 VBoxDDR0.r0
[ 3169.921494] vboxpci: created IOMMU domain 00000000f31aea1c
[ 3170.231667] vboxdrv: 0000000000000000 VBoxEhciR0.r0
[ 3218.530473] vboxpci: freeing IOMMU domain 00000000f31aea1c
[ 3279.276466] vboxdrv: 0000000000000000 VMMR0.r0
[ 3279.403547] vboxdrv: 0000000000000000 VBoxDDR0.r0
[ 3279.461227] vboxpci: created IOMMU domain 00000000b9817cc2
[ 3279.752154] vboxdrv: 0000000000000000 VBoxEhciR0.r0
[ 3847.522290] RTW: recv eapol packet - WPA Group Key 1/2
[ 3847.531859] RTW: cfg80211_rtw_add_key(wlx24050ff72c9a) cipher=0xfac04
[ 3847.531860] RTW: cfg80211_rtw_add_key(wlx24050ff72c9a) key_len=16, key_index=1
[ 3847.531860] RTW: cfg80211_rtw_add_key(wlx24050ff72c9a) pairwise=0
[ 3847.531862] RTW: cfg80211_rtw_add_key(wlx24050ff72c9a) seq_len:6, seq:0x0
[ 3847.531863] RTW: rtw_cfg80211_set_encryption
[ 3847.531864] RTW: rtw_cfg80211_set_encryption(wlx24050ff72c9a) set CCMP GTK idx:1, len:16
[ 3847.531865] RTW: ==> rtw_set_key algorithm(4),keyid(1),key_mask(0)
[ 3847.531869] RTW: rtw_cfg80211_set_encryption, ret=0
[ 3847.531878] RTW: set group key camid:5, addr:d8:eb:97:33:0e:6f, kid:1, type:AES
[ 3847.531994] RTW: send eapol packet - WPA Group Key 2/2
[ 4363.583631] vboxpci: freeing IOMMU domain 00000000b9817cc2
[ 4556.346807] virbr0: port 2(vnet0) entered blocking state
[ 4556.346809] virbr0: port 2(vnet0) entered disabled state
[ 4556.346856] device vnet0 entered promiscuous mode
[ 4556.347116] virbr0: port 2(vnet0) entered blocking state
[ 4556.347117] virbr0: port 2(vnet0) entered listening state
[ 4558.355123] virbr0: port 2(vnet0) entered learning state
[ 4560.371083] virbr0: port 2(vnet0) entered forwarding state
[ 4560.371085] virbr0: topology change detected, propagating
[ 4561.446403] virbr0: port 2(vnet0) entered disabled state
[ 4561.448477] device vnet0 left promiscuous mode
[ 4561.448482] virbr0: port 2(vnet0) entered disabled state
[ 4694.073045] virbr0: port 2(vnet0) entered blocking state
[ 4694.073048] virbr0: port 2(vnet0) entered disabled state
[ 4694.073155] device vnet0 entered promiscuous mode
[ 4694.073415] virbr0: port 2(vnet0) entered blocking state
[ 4694.073418] virbr0: port 2(vnet0) entered listening state
[ 4696.080850] virbr0: port 2(vnet0) entered learning state
[ 4698.096838] virbr0: port 2(vnet0) entered forwarding state
[ 4698.096842] virbr0: topology change detected, propagating

edit: i should mention that while I don’t really have a manual overclock I do have amd precision boost to force enabled and and X.M.P profile on my ram im going to try and see what happens if I disable those to things

This output is right after a bsod?

yeah it is

Nothing looks too broken.

Try to set this up without adding pcie resources then let’s see if you get the bsod?