How to make VMs 'faster'?

I have quite a nice nvidia GPU and intel CPU even though they’re about 5 years old.

I am using virt-manager/qemu to manage my VMs and while I am hosting a Fedora VM that up to date, it just feels sluggish. Moving windows around in the VM is slow and isn’t seemless/leaves a drag around. Pop-ups or clicking any item leaves a delay. I tried using both GNOME and KDE in the VM but both feel slow.

I let the CPU copy the host/passthrough and it didn’t help, I allocated over 40 GB of ram and that doesn’t help, I tried to edit the resolution for both my host machine and VM and that didn’t help much, I didn’t my spice and tried turning on 3-D acceleration but that made things worse.

I just left it to “Spice server” and the virtual video to “virtio” since this seems to be the best option out of the many combinations I tried but had no luck. I must be doing something wrong. Can anyone help me fix this?

Sounds like it’s slow to render, which makes me think VirGL would help here? Though I’m not sure if that works with Nvidia?

Yes, the rendering is slow, and I am not sure about the rest. All my troubleshooting was done with the help of AI which made things worse. I looked up configs to make it seem faster but people say it is your hardware limitations but mine really isn’t.

How many processor cores did you allocate to the VM? My Fedora VM was sluggish with one, but is quite (not very) responsive with two.

It is currently 8, it was the maximum before which is 16 but AI said to go to 8 for some reason. I did try using other virtual CPUs but only made things much slower so I caved in and did host-passthrough even though the security is less is something I fear

Is virtualisation enabled in the BIOS? I can’t remember if it runs slowly or not at all with it disabled.

To enable virtual machines in BIOS, restart your PC and enter the BIOS/UEFI setup, then enabling Intel VT-x or AMD-V depending on your processor.

I’m not sure you’ve done anything wrong… There was one time I started Linux on a very new machine (intel CPU and nvidia GPU, too), but because there was something wrong between nouveau (Nvidia GPU’s FOSS driver) and the nvidia GPU, even using it normally (like opening the file explorer to browse files) was unbearably sluggish, and nouveau was spamming the kernel message. Maybe you can disable your GPU to check if that’s a similar problem?

I am sure it is on, but I will check now and be back in 15 minutes

I will try this, I tried to give my nvidia gpu to passthrough the vms and it wouldn’t work/open the vm and had to use my integrated intel gpu to have the vm boot

I used to use the foss driver but now installed nvidia’s closed-source driver. I did disable the gpu passthrough and when I try to use my nvidia gpu the vm won’t boot. I have to use my integrated gpu/none at all since

It is enabled

Please help :sob:

Some Intel CPUs have different kinds of CPU cores. They have big ones for performance sensitive tasks and little ones for smaller tasks so they can save power. I’d suggest finding out if your CPU has such an architecture and then determining if you’re allocating big or little CPU cores to your VM. I went with an AMD CPU that had all big cores so I could avoid this, so I’m not sure how it’s done but it’s worth looking into. Others here with Intel CPUs may know.

We have very little info about your hardware. Please post the output of inxi -ezxx as preformated text (use the </> button).

Also we have little info on how you have configured your VM. Can you also paste the XML of the config here, also as preformatted text.

You can also type markup like this to get pre-formated text:

```
pre-formatted text
    here that preserves space
```

What VM software are you using? I made a couple of notes on the topic as I use VMs a lot. I use libvirt/Virt-Manager (which could use a much better UI).
I’m assuming here you’re on a recent Intel platform.

  1. Use the VirtIO-SCSI driver instead of virtio disks (mostly for SSDs - this allows TRIM to be passed through and allows the host to reclaim the unused space):
    a. Add a Controller of type “VirtIO-SCSI”
    b. Configure the storage units as “scsi”, and set “rotation_rate=1” in the bus tag in the XML.

  2. Enable graphics acceleration (Display Spice, Video Virtio)

  3. Enable IOMMU pass-through on the kernel command line (this speeds it up a LOT):
    [Intel]: Add to GRUB command line: intel_iommu=on iommu=pt
    Note: only do this AFTER you confirm VT-x/VT-d is enabled!

More info here: Enable IOMMU (VT-d/AMD-Vi) in Proxmox VE - BIOS & Bootloader Setup Guide | Vormox Blog

In Virtual Machine Manager, I’ve made this one tweak that always provides me massive increases in speed:

With your VM shutdown, click once on the VM name, select Open (don’t load or start the machine), tap the blue “i” button for info.

Then go to CPUs, drop down next to Topology, check “Manually set topology” and set it to
Socket: 1
Cores: 4 (or 8 or however many your CPU can handle)
Threads: 1

I don’t understand the complexities of why it works, but this always gets my VM to run significantly faster then letting VMM automatically configure things.