kvm: reset MSR_IA32_CR_PAT correctly
PATCH 1/1 kvm: reset MSR_IA32_CR_PAT correctly
The power-on value of MSR_IA32_CR_PAT is not 0 - that disables cacheing and makes everything dog slow.
Fix to reset MSR_IA32_CR_PAT to the correct value.
--- qemu-kvm-x86.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
qemu-kvm-x86.c +10 -1
@@ -1289,12 +1289,21 @@ static int kvm_reset_msrs(CPUState *env) } msr_data;int n;struct kvm_msr_entry *msrs = msr_data.entries; +uint32_t index; +uint64_t data;if (!kvm_msr_list)return -1 ;for (n =0 ; n < kvm_msr_list->nmsrs; n++) { -kvm_msr_entry_set (&msrs[n], kvm_msr_list->indices[n],0 ); + index = kvm_msr_list->indices[n]; +switch (index) { +case MSR_PAT : + data =0x0007040600070406ULL ; +default : + data =0 ; + } +kvm_msr_entry_set (&msrs[n], index, data); } msr_data.info.nmsrs = n;
Signature · 1 line
1.7.1
Quoted 25 lines · Avi Kivity
The power-on value of
MSR_IA32_CR_PATis not 0 - that disables cacheing and makes everything dog slow.Fix to reset
MSR_IA32_CR_PATto the correct value.Signed-off-by Avi Kivity<[email protected]>--- qemu-kvm-x86.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)qemu-kvm-x86.c +2
-0@@ -1289,12 +1289,21 @@ static int kvm_reset_msrs(CPUState *env) } msr_data;int n;struct kvm_msr_entry *msrs = msr_data.entries; +uint32_t index; +uint64_t data;if (!kvm_msr_list)return -1 ;for (n =0 ; n< kvm_msr_list->nmsrs; n++) {
qemu-kvm-x86.c static int kvm_reset_msrs(CPUState *env) · line 1307
Quoted 10 lines
qemu-kvm-x86.c +8
-1-kvm_msr_entry_set (&msrs[n], kvm_msr_list->indices[n],0 ); + index = kvm_msr_list->indices[n]; +switch (index) { +case MSR_PAT : + data =0x0007040600070406ULL ; +default : + data =0 ; + } +kvm_msr_entry_set (&msrs[n], index, data); }
Note: a better fix is to read all msr values during vm creation, so we get the kernel reset values instead of making up our own. This is more future proof wrt newer msrs. But let's start with the simple fix first.
Signature · 1 line
error compiling committee.c: too many arguments to function
Marcelo Tosatti
AppliedQuoted 9 lines · Avi Kivity
The power-on value of
MSR_IA32_CR_PATis not 0 - that disables cacheing and makes everything dog slow.Fix to reset
MSR_IA32_CR_PATto the correct value.Signed-off-by Avi Kivity <[email protected]>--- qemu-kvm-x86.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
Applied, thanks.