From 43196919be75096f0e2a7a4fabb6b194cda7cf50 Mon Sep 17 00:00:00 2001 From: yucheng yu Date: Fri, 31 Oct 2014 12:50:28 -0700 Subject: [PATCH] hax: fixed missing interrupt, removed earlier work-around. Fixed high cpu utilization. Change-Id: I3e705fecb4bb95c01898eac19022b71dd6dd5172 Signed-off-by: yucheng yu --- cpus.c | 1 + target-i386/hax-all.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cpus.c b/cpus.c index 9c96c8d..b28a92a 100644 --- a/cpus.c +++ b/cpus.c @@ -996,6 +996,7 @@ static void *qemu_hax_cpu_thread_fn(void *arg) cpu->thread_id = qemu_get_thread_id(); cpu->created = true; + cpu->halted = 0; current_cpu = cpu; hax_init_vcpu(cpu); diff --git a/target-i386/hax-all.c b/target-i386/hax-all.c index b0f074d..7b4bd46 100644 --- a/target-i386/hax-all.c +++ b/target-i386/hax-all.c @@ -641,15 +641,15 @@ static int hax_vcpu_interrupt(CPUArchState *env) * Try to inject an interrupt if the guest can accept it * Unlike KVM, HAX kernel check for the eflags, instead of qemu */ - if (ht->ready_for_interrupt_injection /*&& - (cpu->interrupt_request & CPU_INTERRUPT_HARD)*/) + if (ht->ready_for_interrupt_injection && + (cpu->interrupt_request & CPU_INTERRUPT_HARD)) { int irq; - cpu->interrupt_request &= ~CPU_INTERRUPT_HARD; irq = cpu_get_pic_interrupt(env); if (irq >= 0) { hax_inject_interrupt(env, irq); + cpu->interrupt_request &= ~CPU_INTERRUPT_HARD; } } @@ -697,6 +697,13 @@ static int hax_vcpu_hax_exec(CPUArchState *env) return HAX_EMUL_EXITLOOP; } + cpu->halted = 0; + + if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { + cpu->interrupt_request &= ~CPU_INTERRUPT_POLL; + apic_poll_irq(x86_cpu->apic_state); + } + if (cpu->interrupt_request & CPU_INTERRUPT_INIT) { fprintf(stderr, "\nhax_vcpu_hax_exec: handling INIT for %d \n", cpu->cpu_index); do_cpu_init(x86_cpu); -- 2.7.4