hax: fixed missing interrupt, removed earlier work-around. 03/29703/4
authoryucheng yu <yu-cheng.yu@intel.com>
Fri, 31 Oct 2014 19:50:28 +0000 (12:50 -0700)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 6 Nov 2014 04:32:07 +0000 (20:32 -0800)
Fixed high cpu utilization.

Change-Id: I3e705fecb4bb95c01898eac19022b71dd6dd5172
Signed-off-by: yucheng yu <yu-cheng.yu@intel.com>
cpus.c
target-i386/hax-all.c

diff --git a/cpus.c b/cpus.c
index 9c96c8d..b28a92a 100644 (file)
--- 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);
index b0f074d..7b4bd46 100644 (file)
@@ -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);