Skip to content

Commit 9a3c33a

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 cb5542f commit 9a3c33a

File tree

6 files changed

+57
-26
lines changed

6 files changed

+57
-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: 10 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

1513
DEFAULT_BOOT_ARGS = (
@@ -18,14 +16,6 @@
1816
)
1917

2018

21-
DIMENSIONS = {
22-
"instance": global_props.instance,
23-
"cpu_model": global_props.cpu_model,
24-
"host_os": global_props.host_os,
25-
"host_kernel": "linux-" + global_props.host_linux_version_metrics,
26-
}
27-
28-
2919
def get_boottime_device_info(vm):
3020
"""Auxiliary function for asserting the expected boot time."""
3121
boot_time_us = None
@@ -110,20 +100,16 @@ def to_ms(v, unit):
110100
)
111101
@pytest.mark.nonci
112102
def test_boottime(
113-
microvm_factory, guest_kernel_acpi, rootfs_rw, vcpu_count, mem_size_mib, metrics
103+
microvm_factory,
104+
guest_kernel_acpi,
105+
rootfs_rw,
106+
vcpu_count,
107+
mem_size_mib,
108+
secret_free,
109+
metrics,
114110
):
115111
"""Test boot time with different guest configurations"""
116112

117-
metrics.set_dimensions(
118-
{
119-
**DIMENSIONS,
120-
"performance_test": "test_boottime",
121-
"guest_kernel": guest_kernel_acpi.name,
122-
"vcpus": str(vcpu_count),
123-
"mem_size_mib": str(mem_size_mib),
124-
}
125-
)
126-
127113
for _ in range(10):
128114
vm = microvm_factory.build(guest_kernel_acpi, rootfs_rw)
129115
vm.jailer.extra_args.update({"boot-timer": None})
@@ -133,11 +119,14 @@ def test_boottime(
133119
mem_size_mib=mem_size_mib,
134120
boot_args=DEFAULT_BOOT_ARGS + " init=/usr/local/bin/init",
135121
enable_entropy_device=True,
122+
secret_free=secret_free,
136123
)
137124
vm.add_net_iface()
138125
vm.start()
139126
vm.pin_threads(0)
140127

128+
metrics.set_dimensions({"performance_test": "test_boottime", **vm.dimensions})
129+
141130
boot_time_us, cpu_boot_time_us = get_boottime_device_info(vm)
142131
metrics.put_metric(
143132
"guest_boot_time",

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)