|
17 | 17 | def _check_cpu_topology( |
18 | 18 | test_microvm, expected_cpu_count, expected_threads_per_core, expected_cpus_list |
19 | 19 | ): |
20 | | - expected_cpu_topology = { |
21 | | - "CPU(s)": str(expected_cpu_count), |
22 | | - "On-line CPU(s) list": expected_cpus_list, |
23 | | - "Thread(s) per core": str(expected_threads_per_core), |
24 | | - "Core(s) per socket": str(int(expected_cpu_count / expected_threads_per_core)), |
25 | | - "Socket(s)": "1", |
26 | | - "NUMA node(s)": "1", |
| 20 | + expected_lscpu_output = {} |
| 21 | + if PLATFORM == "x86_64": |
| 22 | + expected_lscpu_output = { |
| 23 | + "CPU(s)": str(expected_cpu_count), |
| 24 | + "On-line CPU(s) list": expected_cpus_list, |
| 25 | + "Thread(s) per core": str(expected_threads_per_core), |
| 26 | + "Core(s) per socket": str( |
| 27 | + int(expected_cpu_count / expected_threads_per_core) |
| 28 | + ), |
| 29 | + "Socket(s)": "1", |
| 30 | + "NUMA node(s)": "1", |
| 31 | + } |
| 32 | + else: |
| 33 | + expected_lscpu_output = { |
| 34 | + "CPU(s)": str(expected_cpu_count), |
| 35 | + "On-line CPU(s) list": expected_cpus_list, |
| 36 | + "Thread(s) per core": "1", |
| 37 | + "Core(s) per cluster": str( |
| 38 | + int(expected_cpu_count / expected_threads_per_core) |
| 39 | + ), |
| 40 | + "Cluster(s)": "1", |
| 41 | + "NUMA node(s)": "1", |
| 42 | + } |
| 43 | + |
| 44 | + utils.check_guest_cpuid_output( |
| 45 | + test_microvm, "lscpu", None, ":", expected_lscpu_output |
| 46 | + ) |
| 47 | + |
| 48 | + expected_hwloc_output = { |
| 49 | + "depth0": "1 Machine (type #0)", |
| 50 | + "depth1": "1 Package (type #1)", |
| 51 | + "depth2": "1 L3Cache (type #6)", |
| 52 | + "depth3": f"{expected_cpu_count} L2Cache (type #5)", |
| 53 | + "depth4": f"{expected_cpu_count} L1dCache (type #4)", |
| 54 | + "depth5": f"{expected_cpu_count} L1iCache (type #9)", |
| 55 | + "depth6": f"{expected_cpu_count} Core (type #2)", |
| 56 | + "depth7": f"{expected_cpu_count} PU (type #3)", |
27 | 57 | } |
28 | 58 |
|
29 | 59 | utils.check_guest_cpuid_output( |
30 | | - test_microvm, "lscpu", None, ":", expected_cpu_topology |
| 60 | + test_microvm, "hwloc-info", None, ":", expected_hwloc_output |
31 | 61 | ) |
32 | 62 |
|
33 | 63 |
|
@@ -148,15 +178,14 @@ def _check_cache_topology_arm(test_microvm, no_cpus, kernel_version_tpl): |
148 | 178 | assert guest_slice == host_slice |
149 | 179 |
|
150 | 180 |
|
151 | | -@pytest.mark.skipif( |
152 | | - PLATFORM != "x86_64", reason="Firecracker supports CPU topology only on x86_64." |
153 | | -) |
154 | 181 | @pytest.mark.parametrize("num_vcpus", [1, 2, 16]) |
155 | 182 | @pytest.mark.parametrize("htt", [True, False]) |
156 | 183 | def test_cpu_topology(uvm_plain_any, num_vcpus, htt): |
157 | 184 | """ |
158 | 185 | Check the CPU topology for a microvm with the specified config. |
159 | 186 | """ |
| 187 | + if htt and PLATFORM == "aarch64": |
| 188 | + pytest.skip("SMT is configurable only on x86.") |
160 | 189 | vm = uvm_plain_any |
161 | 190 | vm.spawn() |
162 | 191 | vm.basic_config(vcpu_count=num_vcpus, smt=htt) |
|
0 commit comments