Skip to content

Commit 103f7e3

Browse files
zulinx86pb8o
authored andcommitted
fix(vmm): Changes T2A to set RstrFpErrPtrs bit
[ Upstream commit 50b9fce ] 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 <[email protected]>
1 parent aa4c929 commit 103f7e3

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
@@ -6,6 +6,8 @@
66

77
- Fixed the T2A CPU template not to unset the MMX bit (CPUID.80000001h:EDX[23])
88
and the FXSR bit (CPUID.80000001h:EDX[24]).
9+
- Fixed the T2A CPU template to set the RstrFpErrPtrs bit
10+
(CPUID.80000008h:EBX[2]).
911

1012
## [1.4.0]
1113

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
@@ -122,7 +122,7 @@ pub fn t2a() -> CustomCpuTemplate {
122122
register: CpuidRegister::Ebx,
123123
bitmap: RegisterValueFilter {
124124
filter: 0b00000000000111000000001000000101,
125-
value: 0b00000000000111000000000000000000,
125+
value: 0b00000000000111000000000000000100,
126126
},
127127
}],
128128
},

tests/integration_tests/functional/test_feat_parity.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ def test_feat_parity_cpuid_inst_set(vm):
133133
),
134134
(0x80000008, 0x0, "ebx",
135135
(1 << 0) | # CLZERO
136-
(1 << 2) | # RstrFpErrPtrs
137136
(1 << 4) | # RDPRU
138137
(1 << 8) | # MCOMMIT
139138
(1 << 9) | # WBNOINVD

0 commit comments

Comments
 (0)