Skip to content

Commit 3064828

Browse files
committed
fix(x86_64): serialize full KVM custom MSR range for snapshot
KVM reserves the range 0x4b564d00-0x4b564dff for custom MSRs. The current snapshot implementation only serializes a small subset of these MSRs, which risks missing newly introduced KVM features. Some MSRs are already absent from the list (e.g. MSR_KVM_ASYNC_PF_INT and MSR_KVM_ASYNC_PF_ACK). Replace the individual MSR entries with a single range covering the full KVM custom MSR space so that all KVM-defined MSRs are included during snapshot serialization. Signed-off-by: Zhiheng Tao <junchuan.tzh@antgroup.com> Signed-off-by: junchuan.tzh <junchuan.tzh@antgroup.com>
1 parent 8b55c86 commit 3064828

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

src/vmm/src/arch/x86_64/msr.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,8 @@ const APIC_BASE_MSR: u32 = 0x800;
5050
const APIC_MSR_INDEXES: u32 = 0x400;
5151

5252
/// Custom MSRs fall in the range 0x4b564d00-0x4b564dff
53-
const MSR_KVM_WALL_CLOCK_NEW: u32 = 0x4b56_4d00;
54-
const MSR_KVM_SYSTEM_TIME_NEW: u32 = 0x4b56_4d01;
55-
const MSR_KVM_ASYNC_PF_EN: u32 = 0x4b56_4d02;
56-
const MSR_KVM_STEAL_TIME: u32 = 0x4b56_4d03;
57-
const MSR_KVM_PV_EOI_EN: u32 = 0x4b56_4d04;
58-
const MSR_KVM_POLL_CONTROL: u32 = 0x4b56_4d05;
59-
const MSR_KVM_ASYNC_PF_INT: u32 = 0x4b56_4d06;
53+
const MSR_KVM_RANGE_START: u32 = 0x4b56_4d00;
54+
const MSR_KVM_RANGE_END: u32 = 0x4b56_4dff;
6055

6156
/// Taken from arch/x86/include/asm/msr-index.h
6257
/// Spectre mitigations control MSR
@@ -218,11 +213,6 @@ static SERIALIZABLE_MSR_RANGES: &[MsrRange] = &[
218213
MSR_RANGE!(MSR_TURBO_ACTIVATION_RATIO),
219214
MSR_RANGE!(MSR_IA32_TSC_DEADLINE),
220215
MSR_RANGE!(APIC_BASE_MSR, APIC_MSR_INDEXES),
221-
MSR_RANGE!(MSR_KVM_WALL_CLOCK_NEW),
222-
MSR_RANGE!(MSR_KVM_SYSTEM_TIME_NEW),
223-
MSR_RANGE!(MSR_KVM_ASYNC_PF_EN),
224-
MSR_RANGE!(MSR_KVM_STEAL_TIME),
225-
MSR_RANGE!(MSR_KVM_PV_EOI_EN),
226216
MSR_RANGE!(MSR_EFER),
227217
MSR_RANGE!(MSR_STAR),
228218
MSR_RANGE!(MSR_LSTAR),
@@ -234,9 +224,11 @@ static SERIALIZABLE_MSR_RANGES: &[MsrRange] = &[
234224
MSR_RANGE!(MSR_TSC_AUX),
235225
MSR_RANGE!(MSR_MISC_FEATURES_ENABLES),
236226
MSR_RANGE!(MSR_K7_HWCR),
237-
MSR_RANGE!(MSR_KVM_POLL_CONTROL),
238-
MSR_RANGE!(MSR_KVM_ASYNC_PF_INT),
239227
MSR_RANGE!(MSR_IA32_TSX_CTRL),
228+
MSR_RANGE!(
229+
MSR_KVM_RANGE_START,
230+
MSR_KVM_RANGE_END - MSR_KVM_RANGE_START + 1
231+
),
240232
];
241233

242234
/// Specifies whether a particular MSR should be included in vcpu serialization.

0 commit comments

Comments
 (0)