Skip to content

Commit 6ce3d2b

Browse files
committed
feat(x86)64: add host vs guest cpu feature test
Add test comparing host and guest default cpu features. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent c04909e commit 6ce3d2b

File tree

1 file changed

+221
-0
lines changed

1 file changed

+221
-0
lines changed

tests/integration_tests/functional/test_cpu_features.py

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from framework.defs import SUPPORTED_HOST_KERNELS
2323
from framework.properties import global_props
2424
from framework.utils_cpu_templates import SUPPORTED_CPU_TEMPLATES
25+
from framework.utils_cpuid import CPU_FEATURES_CMD, CpuModel
2526

2627
PLATFORM = platform.machine()
2728
UNSUPPORTED_HOST_KERNEL = (
@@ -203,6 +204,226 @@ def test_brand_string(uvm_plain_any):
203204
assert False
204205

205206

207+
@pytest.mark.skipif(
208+
PLATFORM != "x86_64",
209+
reason="This is x86_64 specific test.",
210+
)
211+
def test_host_vs_guest_cpu_features_x86_64(uvm_nano):
212+
"""Check CPU features host vs guest"""
213+
214+
vm = uvm_nano
215+
vm.add_net_iface()
216+
vm.start()
217+
host_feats = set(utils.check_output(CPU_FEATURES_CMD).stdout.strip().split(" "))
218+
guest_feats = set(vm.ssh.check_output(CPU_FEATURES_CMD).stdout.strip().split(" "))
219+
220+
cpu_model = cpuid_utils.get_cpu_codename()
221+
match cpu_model:
222+
case CpuModel.AMD_MILAN:
223+
assert host_feats - guest_feats == {
224+
"cqm_mbm_local",
225+
"rapl",
226+
"cqm_llc",
227+
"cat_l3",
228+
"bpext",
229+
"cqm_mbm_total",
230+
"perfctr_nb",
231+
"wdt",
232+
"hw_pstate",
233+
"extapic",
234+
"extd_apicid",
235+
"amd_ppin",
236+
"flushbyasid",
237+
"succor",
238+
"smca",
239+
"overflow_recov",
240+
"v_spec_ctrl",
241+
"decodeassists",
242+
"cqm_occup_llc",
243+
"sev_es",
244+
"sev",
245+
"monitor",
246+
"svm_lock",
247+
"rdt_a",
248+
"ibs",
249+
"cdp_l3",
250+
"rdpru",
251+
"brs",
252+
"tce",
253+
"perfctr_llc",
254+
"irperf",
255+
"mwaitx",
256+
"mba",
257+
"cpb",
258+
"skinit",
259+
"aperfmperf",
260+
"cqm",
261+
}
262+
assert guest_feats - host_feats == {
263+
"tsc_known_freq",
264+
"hypervisor",
265+
"tsc_adjust",
266+
"tsc_deadline_timer",
267+
}
268+
case CpuModel.INTEL_SKYLAKE:
269+
assert host_feats - guest_feats == {
270+
"monitor",
271+
"cqm_occup_llc",
272+
"rdt_a",
273+
"ept_ad",
274+
"arch_perfmon",
275+
"cqm",
276+
"intel_pt",
277+
"sdbg",
278+
"est",
279+
"dts",
280+
"cdp_l3",
281+
"dca",
282+
"pts",
283+
"hwp_act_window",
284+
"smx",
285+
"xtpr",
286+
"cqm_mbm_local",
287+
"epb",
288+
"hwp_pkg_req",
289+
"pbe",
290+
"tpr_shadow",
291+
"tm2",
292+
"mba",
293+
"vnmi",
294+
"ds_cpl",
295+
"tm",
296+
"cat_l3",
297+
"bts",
298+
"pln",
299+
"vmx",
300+
"flexpriority",
301+
"vpid",
302+
"cqm_llc",
303+
"hwp_epp",
304+
"dtherm",
305+
"flush_l1d",
306+
"intel_ppin",
307+
"art",
308+
"pdcm",
309+
"acpi",
310+
"hwp",
311+
"aperfmperf",
312+
"ida",
313+
"cqm_mbm_total",
314+
"ept",
315+
"pebs",
316+
"dtes64",
317+
}
318+
assert guest_feats - host_feats == {"umip", "hypervisor", "tsc_known_freq"}
319+
case CpuModel.INTEL_CASCADELAKE:
320+
assert host_feats - guest_feats == {
321+
"cqm_occup_llc",
322+
"ept_ad",
323+
"tm2",
324+
"cqm",
325+
"xtpr",
326+
"cqm_mbm_local",
327+
"rdt_a",
328+
"aperfmperf",
329+
"ida",
330+
"intel_ppin",
331+
"dts",
332+
"pebs",
333+
"pln",
334+
"epb",
335+
"flexpriority",
336+
"tm",
337+
"cqm_llc",
338+
"intel_pt",
339+
"vpid",
340+
"cqm_mbm_total",
341+
"ds_cpl",
342+
"art",
343+
"vmx",
344+
"ept",
345+
"dtes64",
346+
"hwp_act_window",
347+
"cat_l3",
348+
"est",
349+
"pts",
350+
"monitor",
351+
"sdbg",
352+
"pdcm",
353+
"smx",
354+
"acpi",
355+
"hwp_epp",
356+
"vnmi",
357+
"mba",
358+
"cdp_l3",
359+
"dca",
360+
"flush_l1d",
361+
"bts",
362+
"arch_perfmon",
363+
"tpr_shadow",
364+
"dtherm",
365+
"hwp_pkg_req",
366+
"pbe",
367+
"hwp",
368+
}
369+
assert guest_feats - host_feats == {"hypervisor", "umip", "tsc_known_freq"}
370+
case CpuModel.INTEL_ICELAKE:
371+
assert host_feats - guest_feats == {
372+
"art",
373+
"dts",
374+
"monitor",
375+
"pebs",
376+
"bts",
377+
"flexpriority",
378+
"cqm_occup_llc",
379+
"ds_cpl",
380+
"tme",
381+
"hwp",
382+
"rdt_a",
383+
"sdbg",
384+
"pbe",
385+
"hwp_epp",
386+
"epb",
387+
"smx",
388+
"pts",
389+
"xtpr",
390+
"vnmi",
391+
"aperfmperf",
392+
"vpid",
393+
"hwp_pkg_req",
394+
"dca",
395+
"vmx",
396+
"pconfig",
397+
"cat_l3",
398+
"cqm_llc",
399+
"intel_pt",
400+
"cqm_mbm_local",
401+
"ept",
402+
"ida",
403+
"acpi",
404+
"tm2",
405+
"tpr_shadow",
406+
"est",
407+
"ept_ad",
408+
"cqm_mbm_total",
409+
"intel_ppin",
410+
"cqm",
411+
"arch_perfmon",
412+
"flush_l1d",
413+
"mba",
414+
"pln",
415+
"split_lock_detect",
416+
"tm",
417+
"pdcm",
418+
"hwp_act_window",
419+
"dtes64",
420+
"dtherm",
421+
}
422+
assert guest_feats - host_feats == {"tsc_known_freq", "hypervisor"}
423+
case _:
424+
assert False, f"Cpu model {cpu_model} is not supported"
425+
426+
206427
# From the `Intel® 64 Architecture x2APIC Specification`
207428
# (https://courses.cs.washington.edu/courses/cse451/24wi/documentation/x2apic.pdf):
208429
# > The X2APIC MSRs cannot to be loaded and stored on VMX transitions. A VMX transition fails

0 commit comments

Comments
 (0)