From patchwork Mon Dec 14 20:36:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 67345 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nBEKarr5009619 for ; Mon, 14 Dec 2009 20:36:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752051AbZLNUgw (ORCPT ); Mon, 14 Dec 2009 15:36:52 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752029AbZLNUgw (ORCPT ); Mon, 14 Dec 2009 15:36:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5163 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751791AbZLNUgv (ORCPT ); Mon, 14 Dec 2009 15:36:51 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBEKapXD014269 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 14 Dec 2009 15:36:51 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBEKao0L013678; Mon, 14 Dec 2009 15:36:50 -0500 Received: from amt.cnet (vpn-10-217.rdu.redhat.com [10.11.10.217]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id nBEKan9K014012; Mon, 14 Dec 2009 15:36:49 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 471DE68017D; Mon, 14 Dec 2009 18:36:38 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id nBEKabVA007134; Mon, 14 Dec 2009 18:36:37 -0200 Date: Mon, 14 Dec 2009 18:36:37 -0200 From: Marcelo Tosatti To: Avi Kivity Cc: Glauber de Oliveira Costa , kvm , Gleb Natapov Subject: [PATCH] qemu-kvm initialize vcpu state after machine initialization Message-ID: <20091214203637.GA7120@amt.cnet> References: <20091209174654.GA28056@amt.cnet> <4B20C058.5080307@redhat.com> <4B20C32B.7070005@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4B20C32B.7070005@redhat.com> User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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;