Skip to content

Commit c0c030b

Browse files
committed
test: Also emit post-restore latency metrics for huge pages
Runs the new test_post_restore_latency test also for hugepages-backed VMs Signed-off-by: Patrick Roy <[email protected]>
1 parent df46807 commit c0c030b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/integration_tests/performance/test_snapshot_ab.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import pytest
1111

1212
import host_tools.drive as drive_tools
13-
from framework.microvm import Microvm
13+
from framework.microvm import HugePagesConfig, Microvm
1414

1515
USEC_IN_MSEC = 1000
1616
NS_IN_MSEC = 1_000_000
@@ -36,6 +36,7 @@ class SnapshotRestoreTest:
3636
nets: int = 3
3737
blocks: int = 3
3838
all_devices: bool = False
39+
huge_pages: HugePagesConfig = HugePagesConfig.NONE
3940

4041
@property
4142
def id(self):
@@ -55,6 +56,7 @@ def configure_vm(self, microvm_factory, guest_kernel, rootfs, metrics) -> Microv
5556
vcpu_count=self.vcpus,
5657
mem_size_mib=self.mem,
5758
rootfs_io_engine="Sync",
59+
huge_pages=self.huge_pages,
5860
)
5961

6062
for _ in range(self.nets):
@@ -77,6 +79,7 @@ def configure_vm(self, microvm_factory, guest_kernel, rootfs, metrics) -> Microv
7779
"block_devices": str(self.blocks),
7880
"vsock_devices": str(int(self.all_devices)),
7981
"balloon_devices": str(int(self.all_devices)),
82+
"huge_pages_config": str(self.huge_pages),
8083
**vm.dimensions,
8184
}
8285
)
@@ -137,11 +140,15 @@ def test_restore_latency(
137140

138141
@pytest.mark.nonci
139142
@pytest.mark.parametrize("uffd_handler", [None, "valid"])
143+
@pytest.mark.parametrize("huge_pages", HugePagesConfig)
140144
def test_post_restore_latency(
141-
microvm_factory, rootfs, guest_kernel_linux_5_10, metrics, uffd_handler
145+
microvm_factory, rootfs, guest_kernel_linux_5_10, metrics, uffd_handler, huge_pages
142146
):
143147
"""Collects latency metric of post-restore memory accesses done inside the guest"""
144-
test_setup = SnapshotRestoreTest(mem=1024, vcpus=2)
148+
if huge_pages != HugePagesConfig.NONE and uffd_handler is None:
149+
pytest.skip("huge page snapshots can only be restored using uffd")
150+
151+
test_setup = SnapshotRestoreTest(mem=1024, vcpus=2, huge_pages=huge_pages)
145152
vm = test_setup.configure_vm(
146153
microvm_factory, guest_kernel_linux_5_10, rootfs, metrics
147154
)

0 commit comments

Comments
 (0)