Skip to content

Commit b8c1f7b

Browse files
committed
test: run throughput perf tests with secret freedom enabled
Aadditionally parametrize some of our throughput performance tests (network, block and vsock) by memory config, so that they run with secret freedom (and hence bounce buffering) enabled. Also add it to the boottime test, because bouncing can impact the time taken to read the rootfs. Skip them on m6g.metal because secret freedom does not work here for architectural reasons (and our patches do not take this into account, so trying to use secret freedom here would result in host kernel panics). Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
1 parent deb856c commit b8c1f7b

File tree

6 files changed

+58
-26
lines changed

6 files changed

+58
-26
lines changed

tests/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,20 @@ def io_engine(request):
386386
return request.param
387387

388388

389+
secret_free_test_cases = [False]
390+
if (
391+
global_props.host_linux_version_metrics == "next"
392+
and global_props.instance != "m6g.metal"
393+
):
394+
secret_free_test_cases.append(True)
395+
396+
397+
@pytest.fixture(params=secret_free_test_cases)
398+
def secret_free(request):
399+
"""Supported secret hiding configuration, based on hardware"""
400+
return request.param
401+
402+
389403
@pytest.fixture
390404
def results_dir(request):
391405
"""

tests/framework/microvm.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ def __init__(
249249
self.disks_vhost_user = {}
250250
self.vcpus_count = None
251251
self.mem_size_bytes = None
252+
self.secret_free = False
252253
self.cpu_template_name = "None"
253254
# The given custom CPU template will be set in basic_config() but could
254255
# be overwritten via set_cpu_template().
@@ -463,6 +464,7 @@ def dimensions(self):
463464
"rootfs": self.rootfs_file.name,
464465
"vcpus": str(self.vcpus_count),
465466
"guest_memory": f"{self.mem_size_bytes / (1024 * 1024)}MB",
467+
"secret_free": str(self.secret_free or False),
466468
}
467469

468470
@property
@@ -730,6 +732,7 @@ def basic_config(
730732
rootfs_io_engine=None,
731733
cpu_template: Optional[str] = None,
732734
enable_entropy_device=False,
735+
secret_free=None,
733736
):
734737
"""Shortcut for quickly configuring a microVM.
735738
@@ -748,15 +751,23 @@ def basic_config(
748751
749752
Reference: file:../../src/vmm/src/vmm_config/boot_source.rs::DEFAULT_KERNEL_CMDLINE
750753
"""
754+
# Have to do it this way as otherwise A/B-tests fail if the 'A' revision
755+
# of Firecracker doesn't know about the secret_free parameter.
756+
kwargs = {}
757+
if secret_free:
758+
kwargs["secret_free"] = True
759+
751760
self.api.machine_config.put(
752761
vcpu_count=vcpu_count,
753762
smt=smt,
754763
mem_size_mib=mem_size_mib,
755764
track_dirty_pages=track_dirty_pages,
756765
huge_pages=huge_pages,
766+
**kwargs,
757767
)
758768
self.vcpus_count = vcpu_count
759769
self.mem_size_bytes = mem_size_mib * 2**20
770+
self.secret_free = secret_free or False
760771

761772
if self.custom_cpu_template is not None:
762773
self.set_cpu_template(self.custom_cpu_template)

tests/integration_tests/performance/test_block_ab.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,20 @@ def test_block_performance(
163163
fio_block_size,
164164
fio_engine,
165165
io_engine,
166+
secret_free,
166167
metrics,
167168
):
168169
"""
169170
Execute block device emulation benchmarking scenarios.
170171
"""
172+
if secret_free and io_engine == "Async":
173+
pytest.skip("userspace bounce buffers not supported with async block engine")
174+
171175
vm = microvm_factory.build(guest_kernel_acpi, rootfs, monitor_memory=False)
172176
vm.spawn(log_level="Info", emit_metrics=True)
173-
vm.basic_config(vcpu_count=vcpus, mem_size_mib=GUEST_MEM_MIB)
177+
vm.basic_config(
178+
vcpu_count=vcpus, mem_size_mib=GUEST_MEM_MIB, secret_free=secret_free
179+
)
174180
vm.add_net_iface()
175181
# Add a secondary block device for benchmark tests.
176182
fs = drive_tools.FilesystemFile(

tests/integration_tests/performance/test_boottime.py

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
import pytest
1010

11-
from framework.properties import global_props
12-
1311
# Regex for obtaining boot time from some string.
1412
TIMESTAMP_LOG_REGEX = r"Guest-boot-time\s+\=\s+(\d+)\s+us"
1513

@@ -19,14 +17,6 @@
1917
)
2018

2119

22-
DIMENSIONS = {
23-
"instance": global_props.instance,
24-
"cpu_model": global_props.cpu_model,
25-
"host_os": global_props.host_os,
26-
"host_kernel": "linux-" + global_props.host_linux_version_metrics,
27-
}
28-
29-
3020
def _get_microvm_boottime(vm):
3121
"""Auxiliary function for asserting the expected boot time."""
3222
boot_time_us = None
@@ -75,20 +65,16 @@ def find_events(log_data):
7565
)
7666
@pytest.mark.nonci
7767
def test_boottime(
78-
microvm_factory, guest_kernel_acpi, rootfs_rw, vcpu_count, mem_size_mib, metrics
68+
microvm_factory,
69+
guest_kernel_acpi,
70+
rootfs_rw,
71+
vcpu_count,
72+
mem_size_mib,
73+
secret_free,
74+
metrics,
7975
):
8076
"""Test boot time with different guest configurations"""
8177

82-
metrics.set_dimensions(
83-
{
84-
**DIMENSIONS,
85-
"performance_test": "test_boottime",
86-
"guest_kernel": guest_kernel_acpi.name,
87-
"vcpus": str(vcpu_count),
88-
"mem_size_mib": str(mem_size_mib),
89-
}
90-
)
91-
9278
for _ in range(10):
9379
vm = microvm_factory.build(guest_kernel_acpi, rootfs_rw)
9480
vm.jailer.extra_args.update({"boot-timer": None})
@@ -98,10 +84,14 @@ def test_boottime(
9884
mem_size_mib=mem_size_mib,
9985
boot_args=DEFAULT_BOOT_ARGS + " init=/usr/local/bin/init",
10086
enable_entropy_device=True,
87+
secret_free=secret_free,
10188
)
10289
vm.add_net_iface()
10390
vm.start()
10491
vm.pin_threads(0)
92+
93+
metrics.set_dimensions({"performance_test": "test_boottime", **vm.dimensions})
94+
10595
boottime_us = _get_microvm_boottime(vm)
10696
metrics.put_metric("boot_time", boottime_us, unit="Microseconds")
10797
timestamps = find_events(vm.log_data)

tests/integration_tests/performance/test_network_ab.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def consume_ping_output(ping_putput, request_per_round):
3636

3737

3838
@pytest.fixture
39-
def network_microvm(request, microvm_factory, guest_kernel_acpi, rootfs):
39+
def network_microvm(request, microvm_factory, guest_kernel_acpi, rootfs, secret_free):
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

@@ -45,7 +45,9 @@ def network_microvm(request, microvm_factory, guest_kernel_acpi, rootfs):
4545

4646
vm = microvm_factory.build(guest_kernel_acpi, rootfs, monitor_memory=False)
4747
vm.spawn(log_level="Info", emit_metrics=True)
48-
vm.basic_config(vcpu_count=guest_vcpus, mem_size_mib=guest_mem_mib)
48+
vm.basic_config(
49+
vcpu_count=guest_vcpus, mem_size_mib=guest_mem_mib, secret_free=secret_free
50+
)
4951
vm.add_net_iface()
5052
vm.start()
5153
vm.pin_threads(0)

tests/integration_tests/performance/test_vsock_ab.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,14 @@ def guest_command(self, port_offset):
7373
@pytest.mark.parametrize("payload_length", ["64K", "1024K"], ids=["p64K", "p1024K"])
7474
@pytest.mark.parametrize("mode", ["g2h", "h2g", "bd"])
7575
def test_vsock_throughput(
76-
microvm_factory, guest_kernel_acpi, rootfs, vcpus, payload_length, mode, metrics
76+
microvm_factory,
77+
guest_kernel_acpi,
78+
rootfs,
79+
vcpus,
80+
payload_length,
81+
mode,
82+
metrics,
83+
secret_free,
7784
):
7885
"""
7986
Test vsock throughput for multiple vm configurations.
@@ -87,7 +94,9 @@ def test_vsock_throughput(
8794
mem_size_mib = 1024
8895
vm = microvm_factory.build(guest_kernel_acpi, rootfs, monitor_memory=False)
8996
vm.spawn(log_level="Info", emit_metrics=True)
90-
vm.basic_config(vcpu_count=vcpus, mem_size_mib=mem_size_mib)
97+
vm.basic_config(
98+
vcpu_count=vcpus, mem_size_mib=mem_size_mib, secret_free=secret_free
99+
)
91100
vm.add_net_iface()
92101
# Create a vsock device
93102
vm.api.vsock.put(vsock_id="vsock0", guest_cid=3, uds_path="/" + VSOCK_UDS_PATH)

0 commit comments

Comments
 (0)