@@ -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
255269MSR_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 """
@@ -456,6 +470,8 @@ def check_msrs_are_equal(before_recs, after_recs):
456470 changes += 1
457471 elif msr in MSR_EXCEPTION_LIST :
458472 continue
473+ elif snapshot and msr in MSR_SNAPSHOT_EXCEPTION_LIST :
474+ continue
459475 elif before [msr ] != after [msr ]:
460476 # Compare values
461477 print (f"MSR changed { msr } before={ before [msr ]} after={ after [msr ]} " )
@@ -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
512528def dump_cpuid_to_file (dump_fname , ssh_conn ):
0 commit comments