On 4/15/25 14:20, Daniel P. Berrangé wrote:
On Tue, Apr 15, 2025 at 02:08:55PM +0500, Alexandr Moshkov wrote:
Add new tests to check the correctness of the `-overcommit memlock`
option (possible values: off, on, on-fault) by using
`/proc/{qemu_pid}/smaps` file to check in Size, Rss and Locked fields of
anonymous segments:

* if `memlock=off`, then Locked = 0 on every anonymous smaps;
* if `memlock=on`, then Size, Rss and Locked values must be equal for
every anon smaps where Rss is not 0;
* if `memlock=on-fault`, then Rss and Locked must be equal on every anon
smaps and anonymous segment with Rss < Size must exists.
How are you running this test ?  Unprivileged users don't get to
lock any non-trivial amount of memory by default, and QEMU functional
tests pretty much exclusively get run as an unprivileged user account.

This test immediately fails when run:

   qemu.machine.machine.VMLaunchFailure: ConnectError: Failed to establish 
session: EOFError
        Exit code: 1
        Command: ./build/qemu-system-x86_64 -display none -vga none -chardev 
socket,id=mon,fd=5 -mon chardev=mon,mode=control -overcommit mem-lock=on
        Output: qemu-system-x86_64: mlockall: Cannot allocate memory
         qemu-system-x86_64: locking memory failed

and we don't expect users to run anything as root.

Hello, thanks for reply! Looks like i have a larger amount of memory for locking in my system:

> ulimit -l
4063912

I think that's why this test was successfully running on my system.

Honestly,Idon't know yet how to solve this problem properly. Ithink the only ways is to runas root (whichis a bad idea)ortoincrease limits on an unprivileged user account by using /etc/security/limits.conf.

Best regards,

Alexandr

Reply via email to