All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Glauber de Oliveira Costa <gcosta@redhat.com>,
	kvm <kvm@vger.kernel.org>, Gleb Natapov <gleb@redhat.com>
Subject: [PATCH] qemu-kvm initialize vcpu state after machine initialization
Date: Mon, 14 Dec 2009 18:36:37 -0200	[thread overview]
Message-ID: <20091214203637.GA7120@amt.cnet> (raw)
In-Reply-To: <4B20C32B.7070005@redhat.com>


So that the vcpu state is initialized, from vcpu thread context, after 
machine initialization is settled.

This allows to revert apic_init's apic_reset call. apic_reset now
happens through system_reset, similarly to qemu upstream.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

diff --git a/hw/apic.c b/hw/apic.c
index ae805dc..627ff98 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -1131,11 +1131,6 @@ int apic_init(CPUState *env)
     vmstate_register(s->idx, &vmstate_apic, s);
     qemu_register_reset(apic_reset, s);
 
-    /* apic_reset must be called before the vcpu threads are initialized and load
-     * registers, in qemu-kvm.
-     */
-    apic_reset(s);
-
     local_apics[s->idx] = s;
     return 0;
 }
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 44e8b75..ef8c288 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1918,11 +1918,6 @@ static void *ap_main_loop(void *_env)
     setup_kernel_sigmask(env);
 
     pthread_mutex_lock(&qemu_mutex);
-    cpu_single_env = env;
-
-    kvm_arch_init_vcpu(env);
-
-    kvm_arch_load_regs(env);
 
     /* signal VCPU creation */
     current_env->created = 1;
@@ -1934,6 +1929,8 @@ static void *ap_main_loop(void *_env)
 
     /* re-initialize cpu_single_env after re-acquiring qemu_mutex */
     cpu_single_env = env;
+    kvm_arch_init_vcpu(env);
+    kvm_arch_load_regs(env);
 
     kvm_main_loop_cpu(env);
     return NULL;

  reply	other threads:[~2009-12-14 20:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-09 17:46 qemu-kvm requires apic initialized before vcpu main loop Marcelo Tosatti
2009-12-09 18:23 ` Jan Kiszka
2009-12-09 19:23   ` Gleb Natapov
2009-12-09 20:09     ` Jan Kiszka
2009-12-09 20:13       ` Marcelo Tosatti
2009-12-09 20:21         ` Jan Kiszka
2009-12-09 20:50       ` Gleb Natapov
2009-12-09 21:01         ` Jan Kiszka
2009-12-10  6:36           ` Gleb Natapov
2009-12-10  8:12             ` Jan Kiszka
2009-12-09 20:02   ` Marcelo Tosatti
2009-12-09 20:22   ` Marcelo Tosatti
2009-12-09 18:25 ` Glauber Costa
2009-12-09 19:00   ` Jan Kiszka
2009-12-09 20:21     ` Marcelo Tosatti
2009-12-10 11:06       ` Glauber Costa
2009-12-09 20:09   ` Marcelo Tosatti
2009-12-09 19:20 ` Gleb Natapov
2009-12-09 20:26   ` Marcelo Tosatti
2009-12-10  9:33 ` Avi Kivity
2009-12-10  9:45   ` Avi Kivity
2009-12-14 20:36     ` Marcelo Tosatti [this message]
2009-12-15 10:16       ` [PATCH] qemu-kvm initialize vcpu state after machine initialization Avi Kivity
2009-12-15 11:20       ` Gleb Natapov
2009-12-15 12:24         ` Marcelo Tosatti
2009-12-15 12:31           ` Avi Kivity
2009-12-15 12:51             ` Marcelo Tosatti
2009-12-15 12:33           ` Gleb Natapov
2009-12-16 14:12             ` Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091214203637.GA7120@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=gcosta@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.