qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] loadvm and APIC


From: malc
Subject: [Qemu-devel] loadvm and APIC
Date: Tue, 17 Jun 2008 09:19:29 +0400 (MSD)

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?

--
mailto:address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]