提交 c6a94ba5 编写于 作者: A Alexander Graf 提交者: Michael S. Tsirkin

PPC: Add timer when running KVM

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: NAlexander Graf <agraf@suse.de>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 b2eca445
...@@ -37,6 +37,22 @@ ...@@ -37,6 +37,22 @@
do { } while (0) do { } while (0)
#endif #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) int kvm_arch_init(KVMState *s, int smp_cpus)
{ {
return 0; return 0;
...@@ -173,6 +189,12 @@ int kvm_arch_pre_run(CPUState *env, struct kvm_run *run) ...@@ -173,6 +189,12 @@ int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
int r; int r;
unsigned irq; 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 /* PowerPC Qemu tracks the various core input pins (interrupt, critical
* interrupt, reset, etc) in PPC-specific env->irq_input_state. */ * interrupt, reset, etc) in PPC-specific env->irq_input_state. */
if (run->ready_for_interrupt_injection && if (run->ready_for_interrupt_injection &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册