public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH master/stable-0.12/stable-0.13] kvm: reset MSR_IA32_CR_PAT correctly
@ 2010-09-07 13:21 Avi Kivity
  2010-09-07 13:24 ` Avi Kivity
  2010-09-08 16:32 ` Marcelo Tosatti
  0 siblings, 2 replies; 3+ messages in thread
From: Avi Kivity @ 2010-09-07 13:21 UTC (permalink / raw)
  To: Marcelo Tosatti, kvm; +Cc: Sheng Yang

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.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 qemu-kvm-x86.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 4c32771..e02e896 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -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;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH master/stable-0.12/stable-0.13] kvm: reset MSR_IA32_CR_PAT correctly
  2010-09-07 13:21 [PATCH master/stable-0.12/stable-0.13] kvm: reset MSR_IA32_CR_PAT correctly Avi Kivity
@ 2010-09-07 13:24 ` Avi Kivity
  2010-09-08 16:32 ` Marcelo Tosatti
  1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2010-09-07 13:24 UTC (permalink / raw)
  To: Marcelo Tosatti, kvm; +Cc: Sheng Yang

  On 09/07/2010 04:21 PM, Avi Kivity wrote:
> 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.
>
> Signed-off-by: Avi Kivity<avi@redhat.com>
> ---
>   qemu-kvm-x86.c |   11 ++++++++++-
>   1 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
> index 4c32771..e02e896 100644
> --- a/qemu-kvm-x86.c
> +++ b/qemu-kvm-x86.c
> @@ -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);
>       }

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.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH master/stable-0.12/stable-0.13] kvm: reset MSR_IA32_CR_PAT correctly
  2010-09-07 13:21 [PATCH master/stable-0.12/stable-0.13] kvm: reset MSR_IA32_CR_PAT correctly Avi Kivity
  2010-09-07 13:24 ` Avi Kivity
@ 2010-09-08 16:32 ` Marcelo Tosatti
  1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2010-09-08 16:32 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm, Sheng Yang

On Tue, Sep 07, 2010 at 04:21:22PM +0300, Avi Kivity wrote:
> 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.
> 
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  qemu-kvm-x86.c |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)

Applied, thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-08 16:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-07 13:21 [PATCH master/stable-0.12/stable-0.13] kvm: reset MSR_IA32_CR_PAT correctly Avi Kivity
2010-09-07 13:24 ` Avi Kivity
2010-09-08 16:32 ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox