Skip to content

Commit 15b0650

Browse files
committed
fix(cpu-template-helper): exclude TSC_DEADLINE MSR from fingerprints
The TSC_DEADLINE MSR value is volatile is it is getting updated by the guest kernel based on the current TSC value. Signed-off-by: Nikita Kalyazin <[email protected]>
1 parent 05cf11f commit 15b0650

13 files changed

+15
-49
lines changed

src/vmm/src/vstate/vcpu/x86_64.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ mod tests {
10201020
}
10211021

10221022
#[test]
1023-
fn test_fix_zero_tsc_deadline_msr() {
1023+
fn test_fix_zero_tsc_deadline_msr_zero() {
10241024
let mut msr_chunks = vec![
10251025
msrs_from_entries!(&[(MSR_TSC_AUX, 1)]),
10261026
msrs_from_entries!(&[(MSR_IA32_TSC_DEADLINE, 0), (MSR_IA32_TSC, 42)]),
@@ -1039,4 +1039,18 @@ mod tests {
10391039
]
10401040
);
10411041
}
1042+
1043+
#[test]
1044+
fn test_fix_zero_tsc_deadline_msr_non_zero() {
1045+
let mut msr_chunks = vec![msrs_from_entries!(&[
1046+
(MSR_IA32_TSC_DEADLINE, 1),
1047+
(MSR_IA32_TSC, 2)
1048+
])];
1049+
1050+
KvmVcpu::fix_zero_tsc_deadline_msr(&mut msr_chunks);
1051+
1052+
// We expect that MSR_IA32_TSC_DEADLINE should remain unchanged, because it is non-zero
1053+
// already.
1054+
assert_msrs!(msr_chunks, &[(MSR_IA32_TSC_DEADLINE, 1), (MSR_IA32_TSC, 2)]);
1055+
}
10421056
}

tests/data/cpu_template_helper/fingerprint_AMD_MILAN_4.14host.json

-4
Original file line numberDiff line numberDiff line change
@@ -1276,10 +1276,6 @@
12761276
"addr": "0x277",
12771277
"bitmap": "0b0000000000000111000001000000011000000000000001110000010000000110"
12781278
},
1279-
{
1280-
"addr": "0x6e0",
1281-
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"
1282-
},
12831279
{
12841280
"addr": "0x4b564d00",
12851281
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"

tests/data/cpu_template_helper/fingerprint_AMD_MILAN_5.10host.json

-4
Original file line numberDiff line numberDiff line change
@@ -1426,10 +1426,6 @@
14261426
"addr": "0x277",
14271427
"bitmap": "0b0000000000000111000001000000011000000000000001110000010000000110"
14281428
},
1429-
{
1430-
"addr": "0x6e0",
1431-
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"
1432-
},
14331429
{
14341430
"addr": "0x4b564d00",
14351431
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"

tests/data/cpu_template_helper/fingerprint_AMD_MILAN_6.1host.json

-4
Original file line numberDiff line numberDiff line change
@@ -1472,10 +1472,6 @@
14721472
"addr": "0x277",
14731473
"bitmap": "0b0000000000000111000001000000011000000000000001110000010000000110"
14741474
},
1475-
{
1476-
"addr": "0x6e0",
1477-
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"
1478-
},
14791475
{
14801476
"addr": "0x4b564d00",
14811477
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"

tests/data/cpu_template_helper/fingerprint_INTEL_CASCADELAKE_4.14host.json

-4
Original file line numberDiff line numberDiff line change
@@ -962,10 +962,6 @@
962962
"addr": "0x277",
963963
"bitmap": "0b0000000000000111000001000000011000000000000001110000010000000110"
964964
},
965-
{
966-
"addr": "0x6e0",
967-
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"
968-
},
969965
{
970966
"addr": "0xd90",
971967
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"

tests/data/cpu_template_helper/fingerprint_INTEL_CASCADELAKE_5.10host.json

-4
Original file line numberDiff line numberDiff line change
@@ -1158,10 +1158,6 @@
11581158
"addr": "0x277",
11591159
"bitmap": "0b0000000000000111000001000000011000000000000001110000010000000110"
11601160
},
1161-
{
1162-
"addr": "0x6e0",
1163-
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"
1164-
},
11651161
{
11661162
"addr": "0xd90",
11671163
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"

tests/data/cpu_template_helper/fingerprint_INTEL_CASCADELAKE_6.1host.json

-4
Original file line numberDiff line numberDiff line change
@@ -1158,10 +1158,6 @@
11581158
"addr": "0x277",
11591159
"bitmap": "0b0000000000000111000001000000011000000000000001110000010000000110"
11601160
},
1161-
{
1162-
"addr": "0x6e0",
1163-
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"
1164-
},
11651161
{
11661162
"addr": "0xd90",
11671163
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"

tests/data/cpu_template_helper/fingerprint_INTEL_ICELAKE_4.14host.json

-4
Original file line numberDiff line numberDiff line change
@@ -916,10 +916,6 @@
916916
"addr": "0x277",
917917
"bitmap": "0b0000000000000111000001000000011000000000000001110000010000000110"
918918
},
919-
{
920-
"addr": "0x6e0",
921-
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"
922-
},
923919
{
924920
"addr": "0x4b564d00",
925921
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"

tests/data/cpu_template_helper/fingerprint_INTEL_ICELAKE_5.10host.json

-4
Original file line numberDiff line numberDiff line change
@@ -1250,10 +1250,6 @@
12501250
"addr": "0x277",
12511251
"bitmap": "0b0000000000000111000001000000011000000000000001110000010000000110"
12521252
},
1253-
{
1254-
"addr": "0x6e0",
1255-
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"
1256-
},
12571253
{
12581254
"addr": "0x4b564d00",
12591255
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"

tests/data/cpu_template_helper/fingerprint_INTEL_ICELAKE_6.1host.json

-4
Original file line numberDiff line numberDiff line change
@@ -1273,10 +1273,6 @@
12731273
"addr": "0x277",
12741274
"bitmap": "0b0000000000000111000001000000011000000000000001110000010000000110"
12751275
},
1276-
{
1277-
"addr": "0x6e0",
1278-
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"
1279-
},
12801276
{
12811277
"addr": "0x4b564d00",
12821278
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"

tests/data/cpu_template_helper/fingerprint_INTEL_SKYLAKE_4.14host.json

-4
Original file line numberDiff line numberDiff line change
@@ -962,10 +962,6 @@
962962
"addr": "0x277",
963963
"bitmap": "0b0000000000000111000001000000011000000000000001110000010000000110"
964964
},
965-
{
966-
"addr": "0x6e0",
967-
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"
968-
},
969965
{
970966
"addr": "0xd90",
971967
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"

tests/data/cpu_template_helper/fingerprint_INTEL_SKYLAKE_5.10host.json

-4
Original file line numberDiff line numberDiff line change
@@ -1158,10 +1158,6 @@
11581158
"addr": "0x277",
11591159
"bitmap": "0b0000000000000111000001000000011000000000000001110000010000000110"
11601160
},
1161-
{
1162-
"addr": "0x6e0",
1163-
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"
1164-
},
11651161
{
11661162
"addr": "0xd90",
11671163
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"

tests/data/cpu_template_helper/fingerprint_INTEL_SKYLAKE_6.1host.json

-4
Original file line numberDiff line numberDiff line change
@@ -1158,10 +1158,6 @@
11581158
"addr": "0x277",
11591159
"bitmap": "0b0000000000000111000001000000011000000000000001110000010000000110"
11601160
},
1161-
{
1162-
"addr": "0x6e0",
1163-
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"
1164-
},
11651161
{
11661162
"addr": "0xd90",
11671163
"bitmap": "0b0000000000000000000000000000000000000000000000000000000000000000"

0 commit comments

Comments
 (0)