From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Alexandr Moshkov <dtalexundeer@yandex-team.ru>
Cc: qemu-devel@nongnu.org, Cleber Rosa <crosa@redhat.com>,
"yc-core @ yandex-team . ru" <yc-core@yandex-team.ru>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v3] tests/functional: add memlock tests
Date: Tue, 15 Apr 2025 10:20:44 +0100 [thread overview]
Message-ID: <Z_4k7DEDiiaznG2q@redhat.com> (raw)
In-Reply-To: <20250415090854.71526-1-dtalexundeer@yandex-team.ru>
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.
> Signed-off-by: Alexandr Moshkov <dtalexundeer@yandex-team.ru>
> ---
> tests/functional/meson.build | 1 +
> tests/functional/test_memlock.py | 100 +++++++++++++++++++++++++++++++
> 2 files changed, 101 insertions(+)
> create mode 100644 tests/functional/test_memlock.py
Test files need to have execute permission set.
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2025-04-15 9:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-15 9:08 [PATCH v3] tests/functional: add memlock tests Alexandr Moshkov
2025-04-15 9:20 ` Daniel P. Berrangé [this message]
2025-04-15 10:27 ` Alexandr Moshkov
2025-04-15 10:36 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z_4k7DEDiiaznG2q@redhat.com \
--to=berrange@redhat.com \
--cc=crosa@redhat.com \
--cc=dtalexundeer@yandex-team.ru \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yc-core@yandex-team.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.