Skip to content

Commit f1fe502

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 37e1e78 commit f1fe502

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
@@ -247,6 +247,20 @@ def test_brand_string(uvm_plain_any):
247247
]
248248
# fmt: on
249249

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

251265
MSR_SUPPORTED_TEMPLATES = ["T2A", "T2CL", "T2S"]
252266

@@ -432,7 +446,7 @@ def test_cpu_wrmsr_snapshot(microvm_factory, guest_kernel, rootfs, cpu_template_
432446
snapshot.save_to(snapshot_artifacts_dir)
433447

434448

435-
def check_msrs_are_equal(before_recs, after_recs):
449+
def check_msrs_are_equal(before_recs, after_recs, snapshot=False):
436450
"""
437451
Checks that reported MSRs and their values in the files are equal.
438452
"""
@@ -452,6 +466,8 @@ def check_msrs_are_equal(before_recs, after_recs):
452466
changes += 1
453467
elif msr in MSR_EXCEPTION_LIST:
454468
continue
469+
elif snapshot and msr in MSR_SNAPSHOT_EXCEPTION_LIST:
470+
continue
455471
elif before[msr] != after[msr]:
456472
# Compare values
457473
print(f"MSR changed {msr} before={before[msr]} after={after[msr]}")
@@ -502,7 +518,7 @@ def test_cpu_wrmsr_restore(microvm_factory, cpu_template_any, guest_kernel):
502518
# Compare the two lists of MSR values and assert they are equal
503519
before_recs = read_msr_csv(msrs_before_fname.open())
504520
after_recs = read_msr_csv(msrs_after_fname.open())
505-
check_msrs_are_equal(before_recs, after_recs)
521+
check_msrs_are_equal(before_recs, after_recs, True)
506522

507523

508524
def dump_cpuid_to_file(dump_fname, ssh_conn):

0 commit comments

Comments
 (0)