From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: qemu-kvm requires apic initialized before vcpu main loop Date: Wed, 09 Dec 2009 20:00:41 +0100 Message-ID: <4B1FF3D9.5030501@siemens.com> References: <20091209174654.GA28056@amt.cnet> <20091209182545.GO30411@mothafucka.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , Avi Kivity , Glauber de Oliveira Costa , kvm To: Glauber Costa Return-path: Received: from david.siemens.de ([192.35.17.14]:19176 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756866AbZLITAz (ORCPT ); Wed, 9 Dec 2009 14:00:55 -0500 In-Reply-To: <20091209182545.GO30411@mothafucka.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: Glauber Costa wrote: > On Wed, Dec 09, 2009 at 03:46:54PM -0200, Marcelo Tosatti wrote: >> Otherwise a zero apic base is loaded into KVM, which results >> in interrupts being lost until a proper apic base with enabled >> bit set is loaded. >> >> Fixes WinXP migration in qemu-kvm origin/next. >> >> Signed-off-by: Marcelo Tosatti >> >> diff --git a/hw/apic.c b/hw/apic.c >> index 627ff98..45a4d2b 100644 >> --- a/hw/apic.c >> +++ b/hw/apic.c >> @@ -1131,6 +1131,11 @@ 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); >> + > But by doing this, the system-wide reset will re-reset the apic, possibly losing > some other information. > > Also, system_reset happens before we signal system_ready (or at least should). > This means the vcpus should not be running and producing anything useful yet. > So how does it happen, in the first place? There is kvm_arch_load_regs(env); before qemu_cond_wait in ap_main_loop. Probably part of the reason. Why is it there? Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux