[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/10] PPC: Add timer when running KVM
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PATCH 10/10] PPC: Add timer when running KVM |
Date: |
Tue, 9 Feb 2010 17:37:10 +0100 |
For some odd reason we sometimes hang inside KVM forever. I'd guess it's
a race condition where we actually have a level triggered interrupt, but
the infrastructure can't expose that yet, so the guest ACKs it, goes to
sleep and never gets notified that there's still an interrupt pending.
As a quick workaround, let's just wake up every 500 ms. That way we can
assure that we're always reinjecting interrupts in time.
Signed-off-by: Alexander Graf <address@hidden>
---
target-ppc/kvm.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index f889110..fafa6fb 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -37,6 +37,22 @@
do { } while (0)
#endif
+/* XXX For some odd reason we sometimes hang inside KVM forever. I'd guess it's
+ * a race condition where we actually have a level triggered interrupt, but
+ * the infrastructure can't expose that yet, so the guest ACKs it, goes to
+ * sleep and never gets notified that there's still an interrupt pending.
+ *
+ * As a quick workaround, let's just wake up every 500 ms. That way we can
+ * assure that we're always reinjecting interrupts in time.
+ */
+static QEMUTimer *idle_timer;
+
+static void do_nothing(void *opaque)
+{
+ qemu_mod_timer(idle_timer, qemu_get_clock(vm_clock) +
+ (get_ticks_per_sec() / 2));
+}
+
int kvm_arch_init(KVMState *s, int smp_cpus)
{
return 0;
@@ -173,6 +189,12 @@ int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
int r;
unsigned irq;
+ if (!idle_timer) {
+ idle_timer = qemu_new_timer(vm_clock, do_nothing, NULL);
+ qemu_mod_timer(idle_timer, qemu_get_clock(vm_clock) +
+ (get_ticks_per_sec() / 2));
+ }
+
/* PowerPC Qemu tracks the various core input pins (interrupt, critical
* interrupt, reset, etc) in PPC-specific env->irq_input_state. */
if (run->ready_for_interrupt_injection &&
--
1.6.0.2
- [Qemu-devel] [PATCH 00/10] PPC NewWorld fixery v4, Alexander Graf, 2010/02/09
- [Qemu-devel] [PATCH 06/10] PPC: Use macio IDE controller for Newworld, Alexander Graf, 2010/02/09
- [Qemu-devel] [PATCH 08/10] PPC: Add USB per default on U3, Alexander Graf, 2010/02/09
- [Qemu-devel] [PATCH 04/10] PPC: Make interrupts work, Alexander Graf, 2010/02/09
- [Qemu-devel] [PATCH 03/10] PPC: Include dump of lspci -nn on real G5, Alexander Graf, 2010/02/09
- [Qemu-devel] [PATCH 07/10] PPC: Get rid of segfaults in DBDMA emulation, Alexander Graf, 2010/02/09
- [Qemu-devel] [PATCH 10/10] PPC: Add timer when running KVM,
Alexander Graf <=
- [Qemu-devel] [PATCH 09/10] PPC: Fix large pages, Alexander Graf, 2010/02/09
- [Qemu-devel] [PATCH 01/10] PPC: Uninorth config space accessor, Alexander Graf, 2010/02/09
- [Qemu-devel] [PATCH 05/10] PPC: tell the guest about the time base frequency, Alexander Graf, 2010/02/09
- [Qemu-devel] [PATCH 02/10] PPC: Use Mac99_U3 type on ppc64, Alexander Graf, 2010/02/09
- [Qemu-devel] Re: [PATCH 00/10] PPC NewWorld fixery v4, Michael S. Tsirkin, 2010/02/09