Browse Source
* Remove deprecated s390-ccw-virtio-4.1 machine * Add memlock functional test * Various other small updates and fixes -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmhJfHgRHHRodXRoQHJl ZGhhdC5jb20ACgkQLtnXdP5wLbX/8Q//VCvEW3EKp/r+jDK32rfeuVtGPQfjsJ7u iDI3OkzhWZOKpU229Nthj2rKGMPl19mBXFMRavRHceO1pW/xYlPNAErMgT9WrU9K Cy2pYvOGIVK6pZj+qtjcWwG7wHo8mUtgklXXOvH46pXKunRaVc5vJ3ooIvxn96aE aq6r+U4iW4WHt65OJj35Od6Fdl7eDuAHgFEzPIrb0+ip4NUNIlQBX7Ro/9Aaok5X u7hDNbaPMqsYQ2lvU6biJEiVRYz+urqjVUbnNPSm//0SEDc+tGYbwa+XVXaGG8ws URijEu4CTo26zm85ZVIr/b7HW2uzkSqM+phWXh1vDqOeyQq7a9k5MQ8K01reHBHp XvJbfg5hYrKbeJIn9QFTwJ+1UPh7fkR0MUj0LCfTEyO5U42OM6TA0R3JyebVx3eG YpjxUGUZWHLc/5OJFzthIqy0oG/PKuw1fcWTIgiojFQEAd4XIDsYyV66utONe/hJ on1Tn3eniw0L8k2pw6/9Hwnwufe2U+HG/ZGNyfFWq0nPk0Ccdb1MrMUOryLjG3TK OGHqGBEINUKkgX7C3ox0my+fYzUQGwi0O+jKqhDEzZP8Ci5Ozcx5mIb0XejqDBXM IvUqPirXvLFwh0djnisIXIIdDNWYH6TpjyyGLyUj8rPeE2FVyiNBQRT25rNMNdVn 0zYwfxH7pno= =Ky62 -----END PGP SIGNATURE----- Merge tag 'pull-request-2025-06-11' of https://gitlab.com/thuth/qemu into staging * Remove aarch64 job from travis.yml * Remove deprecated s390-ccw-virtio-4.1 machine * Add memlock functional test * Various other small updates and fixes # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmhJfHgRHHRodXRoQHJl # ZGhhdC5jb20ACgkQLtnXdP5wLbX/8Q//VCvEW3EKp/r+jDK32rfeuVtGPQfjsJ7u # iDI3OkzhWZOKpU229Nthj2rKGMPl19mBXFMRavRHceO1pW/xYlPNAErMgT9WrU9K # Cy2pYvOGIVK6pZj+qtjcWwG7wHo8mUtgklXXOvH46pXKunRaVc5vJ3ooIvxn96aE # aq6r+U4iW4WHt65OJj35Od6Fdl7eDuAHgFEzPIrb0+ip4NUNIlQBX7Ro/9Aaok5X # u7hDNbaPMqsYQ2lvU6biJEiVRYz+urqjVUbnNPSm//0SEDc+tGYbwa+XVXaGG8ws # URijEu4CTo26zm85ZVIr/b7HW2uzkSqM+phWXh1vDqOeyQq7a9k5MQ8K01reHBHp # XvJbfg5hYrKbeJIn9QFTwJ+1UPh7fkR0MUj0LCfTEyO5U42OM6TA0R3JyebVx3eG # YpjxUGUZWHLc/5OJFzthIqy0oG/PKuw1fcWTIgiojFQEAd4XIDsYyV66utONe/hJ # on1Tn3eniw0L8k2pw6/9Hwnwufe2U+HG/ZGNyfFWq0nPk0Ccdb1MrMUOryLjG3TK # OGHqGBEINUKkgX7C3ox0my+fYzUQGwi0O+jKqhDEzZP8Ci5Ozcx5mIb0XejqDBXM # IvUqPirXvLFwh0djnisIXIIdDNWYH6TpjyyGLyUj8rPeE2FVyiNBQRT25rNMNdVn # 0zYwfxH7pno= # =Ky62 # -----END PGP SIGNATURE----- # gpg: Signature made Wed 11 Jun 2025 08:54:16 EDT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * tag 'pull-request-2025-06-11' of https://gitlab.com/thuth/qemu: scripts/meson-buildoptions: Sort coroutine_backend choices lexicographically MAINTAINERS: Update Akihiko Odaki's affiliation MAINTAINERS: Update the paths to the testing documentation files tests/vm/README: fix documentation path in tests/vm/README tests/functional: add memlock tests tests/functional: add skipLockedMemoryTest decorator tests/functional: Speed up the avr_mega2560 test tests/functional: Use the 'none' machine for the VNC test hw/s390x/s390-virtio-ccw: Remove the deprecated 4.1 machine type travis.yml: Remove the aarch64 job Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>pull/287/head
12 changed files with 117 additions and 70 deletions
@ -0,0 +1,79 @@ |
|||
#!/usr/bin/env python3 |
|||
# |
|||
# Functional test that check overcommit memlock options |
|||
# |
|||
# Copyright (c) Yandex Technologies LLC, 2025 |
|||
# |
|||
# Author: |
|||
# Alexandr Moshkov <dtalexundeer@yandex-team.ru> |
|||
# |
|||
# SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
import re |
|||
|
|||
from typing import Dict |
|||
|
|||
from qemu_test import QemuSystemTest |
|||
from qemu_test import skipLockedMemoryTest |
|||
|
|||
|
|||
STATUS_VALUE_PATTERN = re.compile(r'^(\w+):\s+(\d+) kB', re.MULTILINE) |
|||
|
|||
|
|||
@skipLockedMemoryTest(2_097_152) # 2GB |
|||
class MemlockTest(QemuSystemTest): |
|||
""" |
|||
Runs a guest with memlock options. |
|||
Then verify, that this options is working correctly |
|||
by checking the status file of the QEMU process. |
|||
""" |
|||
|
|||
def common_vm_setup_with_memlock(self, memlock): |
|||
self.vm.add_args('-overcommit', f'mem-lock={memlock}') |
|||
self.vm.launch() |
|||
|
|||
def test_memlock_off(self): |
|||
self.common_vm_setup_with_memlock('off') |
|||
|
|||
status = self.get_process_status_values(self.vm.get_pid()) |
|||
|
|||
self.assertTrue(status['VmLck'] == 0) |
|||
|
|||
def test_memlock_on(self): |
|||
self.common_vm_setup_with_memlock('on') |
|||
|
|||
status = self.get_process_status_values(self.vm.get_pid()) |
|||
|
|||
# VmLck > 0 kB and almost all memory is resident |
|||
self.assertTrue(status['VmLck'] > 0) |
|||
self.assertTrue(status['VmRSS'] >= status['VmSize'] * 0.70) |
|||
|
|||
def test_memlock_onfault(self): |
|||
self.common_vm_setup_with_memlock('on-fault') |
|||
|
|||
status = self.get_process_status_values(self.vm.get_pid()) |
|||
|
|||
# VmLck > 0 kB and only few memory is resident |
|||
self.assertTrue(status['VmLck'] > 0) |
|||
self.assertTrue(status['VmRSS'] <= status['VmSize'] * 0.30) |
|||
|
|||
def get_process_status_values(self, pid: int) -> Dict[str, int]: |
|||
result = {} |
|||
raw_status = self._get_raw_process_status(pid) |
|||
|
|||
for line in raw_status.split('\n'): |
|||
if m := STATUS_VALUE_PATTERN.match(line): |
|||
result[m.group(1)] = int(m.group(2)) |
|||
|
|||
return result |
|||
|
|||
def _get_raw_process_status(self, pid: int) -> str: |
|||
try: |
|||
with open(f'/proc/{pid}/status', 'r') as f: |
|||
return f.read() |
|||
except FileNotFoundError: |
|||
self.skipTest("Can't open status file of the process") |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
MemlockTest.main() |
|||
@ -1 +1 @@ |
|||
See docs/devel/testing.rst for help. |
|||
See docs/devel/testing/main.rst for help. |
|||
|
|||
Loading…
Reference in new issue