Skip to content

Commit db82f31

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 <[email protected]>
1 parent 8712ff3 commit db82f31

File tree

6 files changed

+48
-5
lines changed

6 files changed

+48
-5
lines changed

tests/conftest.py

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

402402

403+
secret_free_test_cases = [False]
404+
if (
405+
global_props.host_linux_version_metrics == "next"
406+
and global_props.instance != "m6g.metal"
407+
):
408+
secret_free_test_cases.append(True)
409+
410+
411+
@pytest.fixture(params=secret_free_test_cases)
412+
def secret_free(request):
413+
"""Supported secret hiding configuration, based on hardware"""
414+
return request.param
415+
416+
403417
@pytest.fixture
404418
def results_dir(request, pytestconfig):
405419
"""

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().
@@ -470,6 +471,7 @@ def dimensions(self):
470471
"rootfs": self.rootfs_file.name,
471472
"vcpus": str(self.vcpus_count),
472473
"guest_memory": f"{self.mem_size_bytes / (1024 * 1024)}MB",
474+
"secret_free": str(self.secret_free or False),
473475
}
474476

475477
@property
@@ -737,6 +739,7 @@ def basic_config(
737739
rootfs_io_engine=None,
738740
cpu_template: Optional[str] = None,
739741
enable_entropy_device=False,
742+
secret_free=None,
740743
):
741744
"""Shortcut for quickly configuring a microVM.
742745
@@ -755,15 +758,23 @@ def basic_config(
755758
756759
Reference: file:../../src/vmm/src/vmm_config/boot_source.rs::DEFAULT_KERNEL_CMDLINE
757760
"""
761+
# Have to do it this way as otherwise A/B-tests fail if the 'A' revision
762+
# of Firecracker doesn't know about the secret_free parameter.
763+
kwargs = {}
764+
if secret_free:
765+
kwargs["secret_free"] = True
766+
758767
self.api.machine_config.put(
759768
vcpu_count=vcpu_count,
760769
smt=smt,
761770
mem_size_mib=mem_size_mib,
762771
track_dirty_pages=track_dirty_pages,
763772
huge_pages=huge_pages,
773+
**kwargs,
764774
)
765775
self.vcpus_count = vcpu_count
766776
self.mem_size_bytes = mem_size_mib * 2**20
777+
self.secret_free = secret_free or False
767778

768779
if self.custom_cpu_template is not None:
769780
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
@@ -169,15 +169,21 @@ def test_block_performance(
169169
fio_block_size,
170170
fio_engine,
171171
io_engine,
172+
secret_free,
172173
metrics,
173174
results_dir,
174175
):
175176
"""
176177
Execute block device emulation benchmarking scenarios.
177178
"""
179+
if secret_free and io_engine == "Async":
180+
pytest.skip("userspace bounce buffers not supported with async block engine")
181+
178182
vm = microvm_factory.build(guest_kernel_acpi, rootfs, monitor_memory=False)
179183
vm.spawn(log_level="Info", emit_metrics=True)
180-
vm.basic_config(vcpu_count=vcpus, mem_size_mib=GUEST_MEM_MIB)
184+
vm.basic_config(
185+
vcpu_count=vcpus, mem_size_mib=GUEST_MEM_MIB, secret_free=secret_free
186+
)
181187
vm.add_net_iface()
182188
# Add a secondary block device for benchmark tests.
183189
fs = drive_tools.FilesystemFile(

tests/integration_tests/performance/test_boottime.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ def to_ms(v, unit):
100100
)
101101
@pytest.mark.nonci
102102
def test_boottime(
103-
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,
104110
):
105111
"""Test boot time with different guest configurations"""
106112

@@ -113,6 +119,7 @@ def test_boottime(
113119
mem_size_mib=mem_size_mib,
114120
boot_args=DEFAULT_BOOT_ARGS + " init=/usr/local/bin/init",
115121
enable_entropy_device=True,
122+
secret_free=secret_free,
116123
)
117124
vm.add_net_iface()
118125
vm.start()

tests/integration_tests/performance/test_network_ab.py

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

3939

4040
@pytest.fixture
41-
def network_microvm(request, microvm_factory, guest_kernel_acpi, rootfs):
41+
def network_microvm(request, microvm_factory, guest_kernel_acpi, rootfs, secret_free):
4242
"""Creates a microvm with the networking setup used by the performance tests in this file.
4343
This fixture receives its vcpu count via indirect parameterization"""
4444

@@ -47,7 +47,9 @@ def network_microvm(request, microvm_factory, guest_kernel_acpi, rootfs):
4747

4848
vm = microvm_factory.build(guest_kernel_acpi, rootfs, monitor_memory=False)
4949
vm.spawn(log_level="Info", emit_metrics=True)
50-
vm.basic_config(vcpu_count=guest_vcpus, mem_size_mib=guest_mem_mib)
50+
vm.basic_config(
51+
vcpu_count=guest_vcpus, mem_size_mib=guest_mem_mib, secret_free=secret_free
52+
)
5153
vm.add_net_iface()
5254
vm.start()
5355
vm.pin_threads(0)

tests/integration_tests/performance/test_vsock_ab.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def test_vsock_throughput(
8383
mode,
8484
metrics,
8585
results_dir,
86+
secret_free,
8687
):
8788
"""
8889
Test vsock throughput for multiple vm configurations.
@@ -96,7 +97,9 @@ def test_vsock_throughput(
9697
mem_size_mib = 1024
9798
vm = microvm_factory.build(guest_kernel_acpi, rootfs, monitor_memory=False)
9899
vm.spawn(log_level="Info", emit_metrics=True)
99-
vm.basic_config(vcpu_count=vcpus, mem_size_mib=mem_size_mib)
100+
vm.basic_config(
101+
vcpu_count=vcpus, mem_size_mib=mem_size_mib, secret_free=secret_free
102+
)
100103
vm.add_net_iface()
101104
# Create a vsock device
102105
vm.api.vsock.put(vsock_id="vsock0", guest_cid=3, uds_path="/" + VSOCK_UDS_PATH)

0 commit comments

Comments
 (0)