Skip to content

Commit 9072146

Browse files
committed
chore(test): Refine exception list for rdmsr consistency check
Some MSRs were not needed to be excepted and others had wrong comments. Make the exception list minimal and leave a more specific comment for each MSR. We might have to readd some of removed ones when upgrading guest kernels, but let's leave more details for them in that case. I'm the one who will update guest kernels to make a new release, so don't worry :) Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent 7a7f5f5 commit 9072146

File tree

1 file changed

+19
-37
lines changed

1 file changed

+19
-37
lines changed

tests/integration_tests/functional/test_cpu_features_x86_64.py

Lines changed: 19 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -206,57 +206,39 @@ def test_brand_string(uvm_plain_any):
206206
assert False
207207

208208

209-
# From the `Intel® 64 Architecture x2APIC Specification`
210-
# (https://courses.cs.washington.edu/courses/cse451/24wi/documentation/x2apic.pdf):
211-
# > The X2APIC MSRs cannot to be loaded and stored on VMX transitions. A VMX transition fails
212-
# > if the VMM has specified that the transition should access any MSRs in the address range
213-
# > from 0000_0800H to 0000_08FFH
214-
X2APIC_MSRS = [hex(i) for i in range(0x0000_0800, 0x0000_08FF + 1)]
215-
216-
217-
# Some MSR values should not be checked since they can change at guest runtime
218-
# and between different boots.
219-
# Current exceptions:
220-
# * FS and GS change on task switch and arch_prctl.
221-
# * TSC is different for each guest.
222-
# * MSR_{C, L}STAR used for SYSCALL/SYSRET; can be different between guests.
223-
# * MSR_IA32_SYSENTER_E{SP, IP} used for SYSENTER/SYSEXIT; same as above.
224-
# * MSR_KVM_{WALL, SYSTEM}_CLOCK addresses for struct pvclock_* can be different.
225-
# * MSR_IA32_TSX_CTRL is not available to read/write via KVM (known limitation).
209+
# Consistency of some MSR values should not be checked since they can change at
210+
# guest runtime or when updating guest kernels (within the same minor version)
211+
# or can vary between different boots.
226212
#
227-
# More detailed information about MSRs can be found in the Intel® 64 and IA-32
213+
# More detailed information about MSRs can be found in the Intel(R) 64 and IA-32
228214
# Architectures Software Developer’s Manual - Volume 4: Model-Specific Registers
229-
# Check `arch_gen/src/x86/msr_idex.rs` and `msr-index.h` in upstream Linux
230-
# for symbolic definitions.
215+
# For symbolic definitions, see `src/vmm/src/arch/x86_64/generated/msr_idex.rs`
216+
# in Firecracker source code or `arch/x86/include/asm/msr-index.h` in upstream
217+
# Linux source code
231218
# fmt: off
232219
MSR_EXCEPTION_LIST = [
220+
# Time-related MSRs are changing over guest runtime.
233221
"0x10", # MSR_IA32_TSC
234222
"0x11", # MSR_KVM_WALL_CLOCK
235223
"0x12", # MSR_KVM_SYSTEM_TIME
236-
"0x122", # MSR_IA32_TSX_CTRL
224+
# MSR_IA32_SYSENTER_E{SP,IP} value are loaded into R{SP,IP} when a SYSENTER
225+
# instruction is executed. This can change when updating guest kernels.
237226
"0x175", # MSR_IA32_SYSENTER_ESP
238227
"0x176", # MSR_IA32_SYSENTER_EIP
228+
# MSR_IA32_TSC_DEADLINE holds a TSC-dealine value that is set by OS at
229+
# runtime to get an interrupt when a certain period of time passes.
239230
"0x6e0", # MSR_IA32_TSC_DEADLINE
231+
# MSR_{L,C}STAR hold the kernel entry point address when a SYSCALL
232+
# instruction is executed from 64-bit mode (long mode) and compatibility
233+
# mode respectively. This can change when updating guest kernels.
240234
"0xc0000082", # MSR_LSTAR
241235
"0xc0000083", # MSR_CSTAR
236+
# FS and GS are segment registers that are used for special purposes such as
237+
# Threat-Local Storage (TLS) and per-thread data storage. MSR_{F,G}S_BASE
238+
# hold base addresses of {F,G}S. This value can vary between processes.
242239
"0xc0000100", # MSR_FS_BASE
243240
"0xc0000101", # MSR_GS_BASE
244-
# MSRs below are required only on T2A, however,
245-
# we are adding them to the common exception list to keep things simple
246-
"0x834" , # LVT Performance Monitor Interrupt Register
247-
"0xc0010007", # MSR_K7_PERFCTR3
248-
"0xc001020b", # Performance Event Counter MSR_F15H_PERF_CTR5
249-
"0xc0011029", # MSR_F10H_DECFG also referred to as MSR_AMD64_DE_CFG
250-
"0x830" , # IA32_X2APIC_ICR is interrupt command register and,
251-
# bit 0-7 represent interrupt vector that varies.
252-
"0x83f" , # IA32_X2APIC_SELF_IPI
253-
# A self IPI is semantically identical to an
254-
# inter-processor interrupt sent via the ICR,
255-
# with a Destination Shorthand of Self,
256-
# Trigger Mode equal to Edge,
257-
# and a Delivery Mode equal to Fixed.
258-
# bit 0-7 represent interrupt vector that varies.
259-
] + X2APIC_MSRS
241+
]
260242
# fmt: on
261243

262244

0 commit comments

Comments
 (0)