Unable to map backing store for guest RAM: Cannot allocate memory after applying the HugePages Patch

Hello. I’m trying to configure the GPU Passthrough in my PC. I’m running Ubuntu 19.04 as host OS and I want to run Windows 10 as Guest. The mobo that I have is Gigabyte Aorus Pro ; Cpu I9-9900k ; 32 GB RAM ; I have two monitors and two graphic devices. The first is embedded inside the Mobo and it’s Intel Graphic 630. The second is Nvidia Geforce RTX 2080 ti. One monitor is attached to the intel graphic and the other one to the nvidia card. I have isolated the Nvidia Geforce RTX 2080 ti (going inside the BIOS and selecting the Intel graphic as primary device) and I gave it to a Qemu / KVM virtual machine using virt-manager. I’ve been able to load and run Windows 10 inside the virtual machine and it worked ok for sometime. What it didn’t work has been the Geforce RTX 2080 ti because it has not been recognized by Windows 10,that gave the error 43. But I’ve found this patch :

and I have applied it like so :

root@ziomario-Z390-AORUS-PRO:/home/ziomario/Scrivania/Pass# virshpatcher --error43 --hugepages --host-passthrough win10

Patching: win10

Applying: PatchE43

Applying: PatchHugepages

Applying: PatchHostPassthrough

but when I have restarted the win10 vm I’ve encountered this error :

Error starting domain : internal error: process exited while connecting to monitor: 2019-10-14T21:52:03.418937Z qemu-system-x86_64: unable to map backing store for guest RAM: Cannot allocate memory

Traceback (most recent call last):

File “/usr/share/virt-manager/virtManager/asyncjob.py”, line 75, in cb_wrapper

callback(asyncjob, *args, **kwargs)

File “/usr/share/virt-manager/virtManager/asyncjob.py”, line 111, in tmpcb

callback(*args, **kwargs)

File “/usr/share/virt-manager/virtManager/libvirtobject.py”, line 66, in newfn

ret = fn(self, *args, **kwargs)

File “/usr/share/virt-manager/virtManager/domain.py”, line 1400, in startup

self._backend.create()

File “/usr/lib/python3/dist-packages/libvirt.py”, line 1080, in create

if ret == -1: raise libvirtError (‘virDomainCreate() failed’, dom=self)

libvirt.libvirtError: internal error: process exited while connecting to monitor: 2019-10-14T21:52:03.418937Z qemu-system-x86_64: unable to map backing store for guest RAM: Cannot allocate memory

how can I revert the modifications that the patch did in relation with the HugePages ? because the VM started correctly before applying that. Only the nvidia graphic card did not work. So,my idea is to apply only these patches :

PatchE43

PatchHostPassthrough

These are some relevant informations that you may need to understand how to fix that error :

root@ziomario-Z390-AORUS-PRO:/home/ziomario/Scrivania/Pass# cat /proc/meminfo | grep Huge

AnonHugePages: 0 kB

ShmemHugePages: 0 kB

HugePages_Total: 0

HugePages_Free: 0

HugePages_Rsvd: 0

HugePages_Surp: 0

Hugepagesize: 2048 kB

Hugetlb: 0 kB

root@ziomario-Z390-AORUS-PRO:/home/ziomario/Scrivania/Pass# free -mh

total used free shared buff/cache available

Mem: 31Gi 1,5Gi 27Gi 223Mi 2,4Gi 29Gi

Swap: 31Gi 0B 31Gi

The solution seems to be to remove hugepages support from VM, edit XML file (probably /etc/libvirt/qemu/VM_name.xml) and delete tag.

Did you mount the hugepages at e.g. /hugepages and specify that path in your VM config?

Just had this problem and solved it.
Problem was guest memory was configured higher than hugepages. So, to fix it I’ve lowered the amount of RAM guest was using to the full hugepage amount. And it then worked just fine.