Skip to content

Commit 5fa8c8f

Browse files
committed
test: Reintroduce IA32_TSX_CTRL MSR exception
It is a known limitation where IA32_TSX_CTRL MSR cannot be restored, although there is a room to dive deeper. Also, manage the exception list separately for snapshot restore test unlike before. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent f0941ec commit 5fa8c8f

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

tests/integration_tests/functional/test_cpu_features_x86_64.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,20 @@ def test_brand_string(uvm_plain_any):
251251
]
252252
# fmt: on
253253

254+
# A list of MSRs that are not saved into a snapshot, thus are not restored.
255+
# fmt: off
256+
MSR_SNAPSHOT_EXCEPTION_LIST = [
257+
# It is a known limitation where MSR_IA32_TSX_CTRL cannot be restored.
258+
# See https://github.com/firecracker-microvm/firecracker/pull/3182
259+
#
260+
# TODO: Dive deep into kernel behaviors around IA32_TSX_CTRL MSR.
261+
# - https://github.com/torvalds/linux/commit/cbbaa2727aa3ae9e0a844803da7cef7fd3b94f2b
262+
# - https://github.com/torvalds/linux/commit/7131636e7ea5b50ca910f8953f6365ef2d1f741c
263+
# - https://github.com/torvalds/linux/commit/b9846a698c9aff4eb2214a06ac83638ad098f33f
264+
"0x122",
265+
]
266+
# fmt: on
267+
254268

255269
MSR_SUPPORTED_TEMPLATES = ["T2A", "T2CL", "T2S"]
256270

@@ -436,7 +450,7 @@ def test_cpu_wrmsr_snapshot(microvm_factory, guest_kernel, rootfs, cpu_template_
436450
snapshot.save_to(snapshot_artifacts_dir)
437451

438452

439-
def check_msrs_are_equal(before_recs, after_recs):
453+
def check_msrs_are_equal(before_recs, after_recs, snapshot=False):
440454
"""
441455
Checks that reported MSRs and their values in the files are equal.
442456
"""
@@ -448,6 +462,8 @@ def check_msrs_are_equal(before_recs, after_recs):
448462

449463
changes = 0
450464
for msr in all_msrs:
465+
if snapshot and msr in MSR_SNAPSHOT_EXCEPTION_LIST:
466+
continue
451467
if msr in before and msr not in after:
452468
print(f"MSR removed {msr} before={before[msr]}")
453469
changes += 1
@@ -506,7 +522,7 @@ def test_cpu_wrmsr_restore(microvm_factory, cpu_template_any, guest_kernel):
506522
# Compare the two lists of MSR values and assert they are equal
507523
before_recs = read_msr_csv(msrs_before_fname.open())
508524
after_recs = read_msr_csv(msrs_after_fname.open())
509-
check_msrs_are_equal(before_recs, after_recs)
525+
check_msrs_are_equal(before_recs, after_recs, True)
510526

511527

512528
def dump_cpuid_to_file(dump_fname, ssh_conn):

0 commit comments

Comments
 (0)