Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to map backing store for guest RAM: Cannot allocate memory after applying the HugePages Patch. #5

Open
Marietto2008 opened this issue Oct 15, 2019 · 3 comments

Comments

@Marietto2008
Copy link

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 :

https://github.com/sk1080/nvidia-kvm-patcher

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

please help me,thanks.

@Marietto2008
Copy link
Author

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

@Jack-Vaughn
Copy link

Had the same issue. @Marietto2008 solution worked for me.

@Marietto2008
Copy link
Author

yeah. u can also configure the hugepages with this sh script...

HUGEPAGES=8192

function activate_hugepages {
echo "Allocating hugepages..."
echo $HUGEPAGES > /proc/sys/vm/nr_hugepages
sleep 10s
ALLOC_PAGES=cat /proc/sys/vm/nr_hugepages

TRIES=0
while (( $ALLOC_PAGES != $HUGEPAGES && $TRIES < 1000 ))
do
echo 1 > /proc/sys/vm/compact_memory
echo $HUGEPAGES > /proc/sys/vm/nr_hugepages
ALLOC_PAGES=cat /proc/sys/vm/nr_hugepages
echo "Tried to allocate hugepages. Got pages $ALLOC_PAGES / $HUGEPAGES"
sleep 10s
let TRIES+=1
done

if [ "$ALLOC_PAGES" -ne "$HUGEPAGES" ]
then
echo "Not able to allocate hugepages"
echo 0 > /proc/sys/vm/nr_hugepages
sleep 10s
exit 1
fi
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants