GPU passthrough cant install drivers when using virt-manager [SOLVED]

So I have finally gotten gpu passthrough working with qemu script. I would however like to use virt-manager for convenience. Video drivers installed just fine with the qemu command but the screen goes black when installing drivers with virt-manager and after a minute or so it reboots, very similar to BSOD just no actual output. The only difference in windows is that with virt-manager I am seeing an unknown "PCI device" where I did not when the VM is started with qemu.

OS: Arch Linux (latest kernel)

Here is how the virt-manager config looks like:

Everything in the config is either essential or cannot be removed except for usb controller and ethernet port passthrough. The unknown pci device is not one of the passthrough devices.

And here's my qemu script that works fine:

sudo qemu-system-x86_64 \
        -serial none \
        -parallel none \
        -nodefaults \
        -nodefconfig \
        -enable-kvm \
        -name windows-10 \
        -cpu host,kvm=off,check \
        -smp sockets=1,cores=4,threads=1 \
        -m 4096 \
        -rtc base=localtime \
        -device vfio-pci,host=01:00.0,multifunction=on \
        -device vfio-pci,host=01:00.1 \
        -device vfio-pci,host=00:1f.6 \
        -device vfio-pci,host=00:14.0 \
        -usbdevice host:005.004 \
        -usbdevice host:001.005 \
        -netdev user,id=user.0 -device e1000,netdev=user.0 \
        -drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/x64/ovmf_x64.bin \
        -drive if=pflash,format=raw,file=~/ovmf_vars_x64.bin \
        -device virtio-scsi-pci,id=scsi \
        -drive file=~/win10.qcow2,id=disk,format=qcow2,if=none,cache=writeback -device scsi-hd,drive=disk

Does anyone have any ideas what may be causing this?

Which distro and kernel are you using? Also knowing your hardware specs would be useful

Ooops. It's Arch Linux, linux-vfio kernel. Didn't actually need any patches in the end though.

Can you boot it without attatching the GPU to the VM?

With qemu I can boot with gpu and drivers just fine, with virt-manager it boots fine but crashes on driver install.

Could you take a screenshot of the CPU section of virtmanager?

I also used 4 cores before with no change. Not sure why cpu config would matter in this case. CPU is 6700k so 8 logical cores.

I would set CPU topology to:

Sockets: 1
Cores: 2
Threads: 1

See if that works

This is a problem I had when writing my tutorial http://www.xenxier.com/articles/vga-passthrough-1.htm. Don't copy host, uncheck that and type in "host-passthrough" in the model box, then set the topology to 1-2-2 for 4 cores (1 socket two cpu cores w/ hyper threading for 4 cores). You'll have to reinstall Windows after doing this.

8 sockets doesn't make sense indeed :) Didn't make a difference though and not sure why it would since it's gpu related problem. PCI device is still present in Device manager as well.

I spoke too soon. It seems to have worked. I did not have to reinstall btw.

Also shouldn't the topology match the cpu? in my case shouldn't it be 1-4-2 for 1 socket, 4 cores and 2 threads per core for a total of 8 threads? Current allocation sets what is actually being passed to the VM.

Any idea what the unknown PCI Device could be? Odd that it's there only with virt-manager...

If you want you can map all of your CPU cores to your VM, sure, but you might not see any performance gain since your host tends to also like CPU cores free. Have a play with it though.

Well if both the host and the VM need more cycles than there exists then yes one or the other will suffer but I think this allows for maximum overall CPU usage as both have access to all threads if they need it. Alternatively you will have some cores doing nothing when the VM or the host could make use of them. As long as there is not any major issues this seems like a good way to go. When 8+ core zen cpus come out then the host can have a couple of cores :)

It's still worth doing a cinebench score of something and comparing it with different numbers of CPU scores. You may find that performance suffers if you don't assign the host at least a few cores.

Cinebench score was 505 for 4 threads and 887 for 8 threads so seems very reasonable performance boost considering host uses some cycles.

1 Like

Fair enough, all is well now that the science has been done.

2 Likes