Skip to content

Commit 8fda100

Browse files
committed
Run secret free tests with userspace bounce buffers
Now that we have userspace bounce buffers, we can run secret freedom tests (including perf tests!) with then, which additionally allows us to run them on x86 too. Remove the swiotlb test cases from the performance tests, as the performance impact here was shown too significant. Signed-off-by: Patrick Roy <[email protected]>
1 parent dfe97ec commit 8fda100

File tree

6 files changed

+41
-30
lines changed

6 files changed

+41
-30
lines changed

tests/conftest.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -376,16 +376,12 @@ def io_engine(request):
376376
return request.param
377377

378378

379-
# 4MiB is the smallest swiotlb size that seems to generally work for all
380-
# perf tests. 2MiB makes the vsock throughput test consistently fail, and 1MiB makes
381-
# the network throughput test occasionally fail (both due to connection issues).
382-
# The block test passes even with the minimum of 1MiB. We pick 8 to have enough
383-
# buffer to the failing cases.
384379
secret_free_test_cases = [None]
385-
if platform.machine() == "aarch64":
386-
secret_free_test_cases.append((8, False))
387-
if global_props.instance != "m6g.metal":
388-
secret_free_test_cases.append((8, True))
380+
if (
381+
global_props.host_linux_version_metrics == "next"
382+
and global_props.instance != "m6g.metal"
383+
):
384+
secret_free_test_cases.append((0, True))
389385

390386

391387
@pytest.fixture(params=secret_free_test_cases)

tests/integration_tests/functional/test_secret_freedom.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# SPDX-License-Identifier: Apache-2.0
33
"""Test secret-freedom related functionality."""
44

5-
import platform
6-
75
import pytest
86

97
from framework import defs
@@ -23,17 +21,16 @@
2321
]
2422

2523

26-
@pytest.mark.skipif(
27-
platform.machine() != "aarch64",
28-
reason="only ARM can boot secret free VMs with I/O devices",
29-
)
30-
def test_secret_free_boot(microvm_factory, guest_kernel_linux_6_1, rootfs):
24+
def test_secret_free_boot(microvm_factory, guest_kernel, rootfs):
3125
"""Tests that a VM can boot if all virtio devices are bound to a swiotlb region, and
3226
that this swiotlb region is actually discovered by the guest."""
33-
vm = microvm_factory.build(guest_kernel_linux_6_1, rootfs)
27+
vm = microvm_factory.build(guest_kernel, rootfs)
3428
vm.spawn()
3529
vm.memory_monitor = None
36-
vm.basic_config(memory_config={"initial_swiotlb_size": 8, "secret_free": True})
30+
vm.basic_config(
31+
memory_config={"secret_free": True},
32+
boot_args="console=ttyS0 reboot=k panic=1 pci=off no-kvmclock",
33+
)
3734
vm.add_net_iface()
3835
vm.start()
3936

@@ -54,7 +51,7 @@ def test_secret_free_initrd(microvm_factory, guest_kernel):
5451
vcpu_count=1,
5552
boot_args="console=ttyS0 reboot=k panic=1 pci=off no-kvmclock",
5653
use_initrd=True,
57-
memory_config={"initial_swiotlb_size": 64, "secret_free": True},
54+
memory_config={"secret_free": True},
5855
)
5956

6057
uvm.start()
@@ -65,16 +62,15 @@ def test_secret_free_initrd(microvm_factory, guest_kernel):
6562
serial.rx(token=f"rootfs on / type {INITRD_FILESYSTEM}")
6663

6764

68-
@pytest.mark.skipif(
69-
platform.machine() != "aarch64",
70-
reason="only ARM can boot secret free VMs with I/O devices",
71-
)
72-
def test_secret_free_snapshot_creation(microvm_factory, guest_kernel_linux_6_1, rootfs):
65+
def test_secret_free_snapshot_creation(microvm_factory, guest_kernel, rootfs):
7366
"""Test that snapshot creation works for secret hidden VMs"""
74-
vm = microvm_factory.build(guest_kernel_linux_6_1, rootfs)
67+
vm = microvm_factory.build(guest_kernel, rootfs)
7568
vm.spawn()
7669
vm.memory_monitor = None
77-
vm.basic_config(memory_config={"initial_swiotlb_size": 8, "secret_free": True})
70+
vm.basic_config(
71+
memory_config={"secret_free": True},
72+
boot_args="console=ttyS0 reboot=k panic=1 pci=off no-kvmclock",
73+
)
7874
vm.add_net_iface()
7975
vm.start()
8076

tests/integration_tests/performance/test_block_ab.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,16 @@ def test_block_performance(
154154
"""
155155
Execute block device emulation benchmarking scenarios.
156156
"""
157-
if memory_config is not None and "6.1" not in guest_kernel_acpi.name:
157+
if (
158+
memory_config is not None
159+
and memory_config[0] != 0
160+
and "6.1" not in guest_kernel_acpi.name
161+
):
158162
pytest.skip("swiotlb only supported on aarch64/6.1")
159163

164+
if memory_config is not None and io_engine == "Async":
165+
pytest.skip("userspace bounce buffers not supported with async block engine")
166+
160167
vm = microvm_factory.build(guest_kernel_acpi, rootfs, monitor_memory=False)
161168
vm.spawn(log_level="Info", emit_metrics=True)
162169
vm.basic_config(

tests/integration_tests/performance/test_boottime.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ def test_boottime(
7575
):
7676
"""Test boot time with different guest configurations"""
7777

78-
if memory_config is not None and "6.1" not in guest_kernel_acpi.name:
78+
if (
79+
memory_config is not None
80+
and memory_config[0] != 0
81+
and "6.1" not in guest_kernel_acpi.name
82+
):
7983
pytest.skip("swiotlb only supported on aarch64/6.1")
8084

8185
for _ in range(10):

tests/integration_tests/performance/test_network_ab.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ def network_microvm(request, microvm_factory, guest_kernel_acpi, rootfs, memory_
4040
"""Creates a microvm with the networking setup used by the performance tests in this file.
4141
This fixture receives its vcpu count via indirect parameterization"""
4242

43-
if memory_config is not None and "6.1" not in guest_kernel_acpi.name:
43+
if (
44+
memory_config is not None
45+
and memory_config[0] != 0
46+
and "6.1" not in guest_kernel_acpi.name
47+
):
4448
pytest.skip("swiotlb only supported on aarch64/6.1")
4549

4650
guest_mem_mib = 1024

tests/integration_tests/performance/test_vsock_ab.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ def test_vsock_throughput(
9191
if mode == "bd" and vcpus < 2:
9292
pytest.skip("bidrectional test only done with at least 2 vcpus")
9393

94-
if memory_config is not None and "6.1" not in guest_kernel_acpi.name:
94+
if (
95+
memory_config is not None
96+
and memory_config[0] != 0
97+
and "6.1" not in guest_kernel_acpi.name
98+
):
9599
pytest.skip("swiotlb only supported on aarch64/6.1")
96100

97101
mem_size_mib = 1024

0 commit comments

Comments
 (0)