Patchwork Fix CPU topology initialization

login
register
mail settings
Submitter Jiri Denemark
Date Jan. 5, 2010, 4:26 p.m.
Message ID <416bd3c048a9b777180f2e2735e620f8b7206840.1262708768.git.jdenemar@redhat.com>
Download mbox | patch
Permalink /patch/42133/
State New
Headers show

Comments

Jiri Denemark - Jan. 5, 2010, 4:26 p.m.
Late initialization of CPU topology in CPUState prevents KVM guests to
actually see the topology.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 vl.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Anthony Liguori - Jan. 11, 2010, 4:01 p.m.
On 01/05/2010 10:26 AM, Jiri Denemark wrote:
> Late initialization of CPU topology in CPUState prevents KVM guests to
> actually see the topology.
>
> Signed-off-by: Jiri Denemark<jdenemar@redhat.com>
>    

Applied.  Thanks.

Regards,

Anthony Liguori
> ---
>   vl.c |    8 ++++----
>   1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index e881e45..a03d7a6 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3484,10 +3484,10 @@ void qemu_init_vcpu(void *_env)
>   {
>       CPUState *env = _env;
>
> -    if (kvm_enabled())
> -        kvm_init_vcpu(env);
>       env->nr_cores = smp_cores;
>       env->nr_threads = smp_threads;
> +    if (kvm_enabled())
> +        kvm_init_vcpu(env);
>       return;
>   }
>
> @@ -3813,12 +3813,12 @@ void qemu_init_vcpu(void *_env)
>   {
>       CPUState *env = _env;
>
> +    env->nr_cores = smp_cores;
> +    env->nr_threads = smp_threads;
>       if (kvm_enabled())
>           kvm_start_vcpu(env);
>       else
>           tcg_init_vcpu(env);
> -    env->nr_cores = smp_cores;
> -    env->nr_threads = smp_threads;
>   }
>
>   void qemu_notify_event(void)
>

Patch

diff --git a/vl.c b/vl.c
index e881e45..a03d7a6 100644
--- a/vl.c
+++ b/vl.c
@@ -3484,10 +3484,10 @@  void qemu_init_vcpu(void *_env)
 {
     CPUState *env = _env;
 
-    if (kvm_enabled())
-        kvm_init_vcpu(env);
     env->nr_cores = smp_cores;
     env->nr_threads = smp_threads;
+    if (kvm_enabled())
+        kvm_init_vcpu(env);
     return;
 }
 
@@ -3813,12 +3813,12 @@  void qemu_init_vcpu(void *_env)
 {
     CPUState *env = _env;
 
+    env->nr_cores = smp_cores;
+    env->nr_threads = smp_threads;
     if (kvm_enabled())
         kvm_start_vcpu(env);
     else
         tcg_init_vcpu(env);
-    env->nr_cores = smp_cores;
-    env->nr_threads = smp_threads;
 }
 
 void qemu_notify_event(void)