F
F
F1eex2021-05-11 17:02:30
Video cards
F1eex, 2021-05-11 17:02:30

Forwarding a video card to a virtual machine and snapshots of the state?

Recently I managed to transfer a video card (AMD RX 560) to a virtual machine (Ubuntu 20.04 host, QEMU KVM, Win 8.1 guest) Then I found out that it is impossible to take snapshots with this configuration, although hibernation is possible in the Win 8.1 guest Are there other virtual machines in which Can I take pictures with a forwarded vidyakha? Is it even possible to take snapshots of the state of a virtual machine into which a video card is thrown? Or is there some fundamental limitation?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Armenian Radio, 2021-05-11
@gbg

This is fundamentally impossible outside the VM, because it is not clear how to restore the context of the video card when the VM wakes up.
Hibernation is what hibernation is for, that it can "ask" the card driver to put the device to sleep in a regular way.

C
CityCat4, 2021-05-12
@CityCat4

Recently I managed to forward a video card (AMD RX 560) to a virtual machine (Ubuntu 20.04 host, QEMU KVM, Win 8.1 guest)

Wow! Can you share a little more? What version of the kernel, QEMU, libvirt, what mother, what settings were made? There are many who want to repeat this there.

F
F1eex, 2021-05-13
@F1eex

So, my answer to my own question, summing up. A snapshot of the state with a forwarded video card is fundamentally impossible at the moment (05/13/2021). The only option left is to send the machine to hibernation, and then take a picture. In this case, in subsequent cases of restoring the snapshot, the machine will obviously be turned off and hibernated. So it needs to be turned on. Maybe not very convenient, but something.
I will describe how to do this procedure in QEMU KVM with gpu passthrough.
I will send Windows to hibernation from the host ubuntu via the virsh dompmsuspend https://libvirt.org/manpages/virsh.html#dompmsuspend command. To do this, you need to take the following steps:
1. In the xml of the virtual machine in the pm> section, you need to change suspend-to-mem enabled="no"/ and suspend-to-disk enabled="no"/ to "yes":

spoiler
<pm>
    <suspend-to-mem enabled="yes"/>
    <suspend-to-disk enabled="yes"/>
  </pm>

2. xml of the virtual machine, you need to add devices to the section:
spoiler
<channel type='unix'>
   <source mode='bind' path='/var/lib/libvirt/qemu/f16x86_64.agent'/>
   <target type='virtio' name='org.qemu.guest_agent.0'/>
</channel>

3. In guest Windows, you need to install QEMU Guest Agent. I downloaded it from an ISO image with Windows VirtIO drivers https://fedorapeople.org/groups/virt/virtio-win/di... QEMU Guest Agent is located in the guest-agent folder of the image.
Actually, the machine can be hibernated with the virsh dompmsuspend domain disk command, where domain is the name of the virtual machine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question