Comment 5 for bug 1708305

Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

Hello Christian,

Attached you can find a xenial SRU patch based on commit (https://github.com/libvirt/libvirt/commit/7e667664d28f90bf6916604a55ebad7e2d85305b).

Here is the guest definition used on my testing (http://paste.ubuntu.com/25288141/)

Without the patch, the error is reproduced.

root@buneary:/home/ubuntu# virsh start reproducer2
error: Failed to start domain reproducer2
error: internal error: process exited while connecting to monitor: mlockall: Cannot allocate memory
2017-08-11T03:59:54.936275Z qemu-system-x86_64: locking memory failed

With the patch the guest is initialized correctly.

root@buneary:/var/lib/uvtool/libvirt/images# virsh start reproducer2
Domain reproducer2 started

I ran the following systemtap probe (probe kernel.function("sys_setrlimit") { printf("locked: %d -> %s\n", pid(), sprintf("%s, %s", _rlimit_resource_str($resource), _struct_rlimit_u($rlim))) } )

And the output shows that the RLIMIT_MEMLOCK process limit is set to 9007199254740991 (VIR_DOMAIN_MEMORY_PARAM_UNLIMITED)

root@buneary:/home/ubuntu# stap -g qemu_probe.stap -kv -g --suppress-time-limits
Pass 1: parsed user script and 465 library scripts using 112796virt/48440res/6664shr/42136data kb, in 130usr/40sys/164real ms.
Pass 2: analyzed script: 1 probe, 5 functions, 100 embeds, 0 globals using 164772virt/101848res/7988shr/94112data kb, in 660usr/120sys/776real ms.
Pass 3: translated to C into "/tmp/stapVXuoMi/stap_30601_src.c" using 164772virt/102040res/8180shr/94112data kb, in 10usr/0sys/5real ms.
Pass 4: compiled C into "stap_30601.ko" in 2160usr/540sys/3231real ms.
Pass 5: starting run.
locked: 31028 -> RLIMIT_MEMLOCK, [9007199254740991,9007199254740991]