From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K8W6I-0004qP-2n for qemu-devel@nongnu.org; Tue, 17 Jun 2008 03:59:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K8W6H-0004qB-2S for qemu-devel@nongnu.org; Tue, 17 Jun 2008 03:59:33 -0400 Received: from [199.232.76.173] (port=55452 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K8W6G-0004q8-VK for qemu-devel@nongnu.org; Tue, 17 Jun 2008 03:59:32 -0400 Received: from lizzard.sbs.de ([194.138.37.39]:22147) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K8W6G-0005JO-HJ for qemu-devel@nongnu.org; Tue, 17 Jun 2008 03:59:32 -0400 Received: from mail1.sbs.de (localhost [127.0.0.1]) by lizzard.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id m5H7wuFM006715 for ; Tue, 17 Jun 2008 09:58:56 +0200 Received: from [192.168.1.100] ([139.21.92.145]) by mail1.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id m5H7wt5K026995 for ; Tue, 17 Jun 2008 09:58:56 +0200 Message-ID: <48576EBE.2030506@siemens.com> Date: Tue, 17 Jun 2008 09:58:54 +0200 From: Jan Kiszka MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: loadvm and APIC Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org malc wrote: > Here's the scenario: > > 1. Start QEMU and boot Linux capable of using APIC > 2. Save the VM state > 3. Exit QEMU > 4. Start QEMU and loadvm > > Kernel instantly panics. Here's why: > > Upon starting eventually following happens: > ... -> pc_init -> ... -> pit_irq_timer_update > -> qemu_set_irq -> ... > -> apic_local_deliver -> cpu_interrupt(CPU_INTERRUPT_HARD) > > Then qemu_loadvm_state begins executing load handlers eventually coming > to apic_load which loads the state from the storage overriding all the > effects of apic_local_deliver, in the meantime env->interrupt_request > stays the same. > > Then cpu_exec is entered and it arrives at line 399 where > cpu_get_pic_interrupt calls apic_get_interrupt which returns -1, this > bogus interrupt number is then passed to do_interrupt and here it is > finally caught by a IDT limit check at line 649, general protection > fault is generated and kernel inside the VM panics. > > Hence: > > diff --git a/vl.c b/vl.c > index d759fde..11827ba 100644 > --- a/vl.c > +++ b/vl.c > @@ -6296,6 +6296,7 @@ void do_loadvm(const char *name) > goto the_end; > } > ret = qemu_loadvm_state(f); > + first_cpu->interrupt_request = 0; > qemu_fclose(f); > if (ret < 0) { > term_printf("Error %d while loading VM state\n", ret); > > Okay to commit? That is basically http://permalink.gmane.org/gmane.comp.emulators.qemu/26215, which I would prefer. Jan -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux