qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH uq/master 0/3] Fix MSI injection at load time
@ 2012-10-30 12:16 Paolo Bonzini
  2012-10-30 12:16 ` [Qemu-devel] [PATCH 1/3] kvm: move KVM_GET_LAPIC/KVM_SET_LAPIC to hw/kvm/apic.c Paolo Bonzini
                   ` (5 more replies)
  0 siblings, 6 replies; 21+ messages in thread
From: Paolo Bonzini @ 2012-10-30 12:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: jan.kiszka, mtosatti, avi, kvm

Alexander Larsson reported a migration bug where after migration
the Windows virtio-serial driver was not able to read anymore, not seeing
the data from the host.  He debugged it and noticed that after migration
the virtio-serial driver ddid not respond to any irqs.

During restore we virtio_notify() on the serial device, which eventually
raises the pci irq level to 1. However, the driver is never notified
and thus never responds to this by reading the VIRTIO_PCI_ISR, so the
irq level is never cleared, and all later virtio_notify() do nothing.

A simplified reproducer (that doesn't hang Linux,
but shows the message) is to start the VM without a backend for the
virtserialport, and to resume it with a backend, for example

$ qemu-system-x86_64 -device virtio-serial-pci -device virtserialport test.img --enable-kvm -m 512
$ qemu-system-x86_64 -device virtio-serial-pci -chardev stdio,id=vs0 -device virtserialport,chardev=vs0 test.img --enable-kvm -m 512 -incoming 'exec:cat foo.ckp'

In fact, interrupt injection fails and reports correctly "KVM: injection
failed, MSI lost".  The reason for the failure is that the LAPIC doesn't
think it's enabled, which in turn is because the LAPIC is restored after
the CPU and, when restoring the CPU, a dummy post-reset state is passed
to the in-kernel APIC.

The fix for this is to let the APIC update its in-kernel counterpart
after loading.  Patches 1 and 2 change the hard-coded references to
kvm_get_apic_state and kvm_put_apic_state to methods in APICCommonClass.
This is useful because it lets APICCommon force an update of the in-kernel
state after load (patch 3).

Patches 4 and 5 similarly add get/put methods to the IOAPIC hierarchy,
which replace pre_save/post_load.

Paolo

Paolo Bonzini (5):
  kvm: move KVM_GET_LAPIC/KVM_SET_LAPIC to hw/kvm/apic.c
  apic: add get/put methods
  apic: always update the in-kernel status after loading
  ioapic: change pre_save/post_load methods to get/put
  ioapic: unify reset callbacks

 hw/apic.h            |    2 +
 hw/apic_common.c     |   33 ++++++++++++++++++++
 hw/apic_internal.h   |    2 +
 hw/ioapic.c          |    2 -
 hw/ioapic_common.c   |   42 +++++++++++++++++---------
 hw/ioapic_internal.h |    6 +--
 hw/kvm/apic.c        |   80 ++++++++++++++++++++++++++++----------------------
 hw/kvm/ioapic.c      |   13 +-------
 kvm.h                |    3 --
 target-i386/kvm.c    |   34 +--------------------
 10 files changed, 115 insertions(+), 102 deletions(-)

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2012-11-02 15:21 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-30 12:16 [Qemu-devel] [PATCH uq/master 0/3] Fix MSI injection at load time Paolo Bonzini
2012-10-30 12:16 ` [Qemu-devel] [PATCH 1/3] kvm: move KVM_GET_LAPIC/KVM_SET_LAPIC to hw/kvm/apic.c Paolo Bonzini
2012-10-30 18:13   ` Jan Kiszka
2012-10-30 12:16 ` [Qemu-devel] [PATCH 2/3] apic: add get/put methods Paolo Bonzini
2012-10-30 18:17   ` Jan Kiszka
2012-10-30 12:16 ` [Qemu-devel] [PATCH 3/3] apic: always update the in-kernel status after loading Paolo Bonzini
2012-10-30 12:38   ` Avi Kivity
2012-10-30 14:16     ` Paolo Bonzini
2012-10-30 18:21       ` Jan Kiszka
2012-11-02 14:53         ` Paolo Bonzini
2012-11-02 14:59           ` Jan Kiszka
2012-11-02 15:07             ` Gerd Hoffmann
2012-11-02 15:13               ` Paolo Bonzini
2012-11-02 15:17                 ` Gerd Hoffmann
2012-11-02 15:21                   ` Paolo Bonzini
2012-10-30 18:17   ` Jan Kiszka
2012-10-30 12:16 ` [Qemu-devel] [PATCH 4/3] ioapic: change pre_save/post_load methods to get/put Paolo Bonzini
2012-10-30 18:18   ` Jan Kiszka
2012-10-30 12:16 ` [Qemu-devel] [PATCH 5/3] ioapic: unify reset callbacks Paolo Bonzini
2012-10-30 16:47 ` [Qemu-devel] [PATCH uq/master 0/3] Fix MSI injection at load time Paolo Bonzini
2012-10-30 18:22   ` Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).