Skip to content

Commit 50b9fce

Browse files
zulinx86wearyzen
authored andcommitted
fix(vmm): Changes T2A to set RstrFpErrPtrs bit
According to AMD APM, the RstrFpErrPtrs bit (CPUID.0x80000008:EBX[2]) indicates that FXSAVE, XSAVE, FXSAVEOPT, XSAVEC, XSAVES always save error pointers and FXRSTOR, XRSTOR, XRSTORS always restore error pointers. Historically, the error pointers have been saved on Intel CPUs but were not on old AMD CPUs (called "FXSAVE leak"). To handle this difference, the linux kernel enables a workaround. See the following commit for more details. torvalds/linux@18bd057b1408 Given this sitaution, AMD decided to make their CPUs behave same as Intel CPUs and also added the CPUID bit to let softwares know this behavior. torvalds/linux@f2dbad36c55e In terms of KVM, KVM forgot to expose bit until kernel 5.4 via KVM_GET_SUPPORTED_CPUID and has passed through from host since the following commit. torvalds/linux@504ce1954fba As this bit is set on m6a.metal and the T2A template aims to provide feature parity with guests on Intel Cascade Lake and Ice Lake with the T2CL template, it would be better to set this bit in the T2A template. Given the fact that firecracker supports not only kernel 5.10 but also 4.14 (where the pass-through by KVM has not been available), the T2A template should set the bit to 1 rather than passing through. Signed-off-by: Takahiro Itazuri <itazur@amazon.com>
1 parent 2710c1b commit 50b9fce

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
- Fixed the T2A CPU template not to unset the MMX bit (CPUID.80000001h:EDX[23])
1616
and the FXSR bit (CPUID.80000001h:EDX[24]).
17+
- Fixed the T2A CPU template to set the RstrFpErrPtrs bit
18+
(CPUID.80000008h:EBX[2]).
1719

1820
## [1.4.0]
1921

resources/tests/static_cpu_templates/t2a.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"modifiers": [
8383
{
8484
"register": "ebx",
85-
"bitmap": "0bxxxxxxxxxxx111xxxxxxxx0xxxxxx0x0"
85+
"bitmap": "0bxxxxxxxxxxx111xxxxxxxx0xxxxxx1x0"
8686
}
8787
]
8888
}

src/vmm/src/cpu_config/x86_64/static_cpu_templates/t2a.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ pub fn t2a() -> CustomCpuTemplate {
235235
register: CpuidRegister::Ebx,
236236
bitmap: RegisterValueFilter {
237237
filter: 0b0000_0000_0001_1100_0000_0010_0000_0101,
238-
value: 0b0000_0000_0001_1100_0000_0000_0000_0000,
238+
value: 0b0000_0000_0001_1100_0000_0000_0000_0100,
239239
},
240240
},
241241
],

tests/integration_tests/functional/test_feat_parity.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ def test_feat_parity_cpuid_inst_set(vm):
129129
),
130130
(0x80000008, 0x0, "ebx",
131131
(1 << 0) | # CLZERO
132-
(1 << 2) | # RstrFpErrPtrs
133132
(1 << 4) | # RDPRU
134133
(1 << 8) | # MCOMMIT
135134
(1 << 9) | # WBNOINVD

0 commit comments

Comments
 (0)