Patchwork [12/18] kvm: Move irqchip event processing out of inner loop

login
register
mail settings
Submitter Jan Kiszka
Date Jan. 10, 2011, 8:32 a.m.
Message ID <0d68d0b6f32d1333ed7d1abe831d824da1e8f9d5.1294648329.git.jan.kiszka@web.de>
Download mbox | patch
Permalink /patch/78104/
State New
Headers show

Comments

Jan Kiszka - Jan. 10, 2011, 8:32 a.m.
From: Jan Kiszka <jan.kiszka@siemens.com>

Align with qemu-kvm and prepare for IO exit fix: There is no need to run
kvm_arch_process_irqchip_events in the inner VCPU loop. Any state change
this service processes will first cause an exit from kvm_cpu_exec
anyway. And we will have to reenter the kernel on IO exits
unconditionally, something that the current logic prevents.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 kvm-all.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

Patch

diff --git a/kvm-all.c b/kvm-all.c
index a8e9f2c..f3c8375 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -824,6 +824,12 @@  int kvm_cpu_exec(CPUState *env)
 
     DPRINTF("kvm_cpu_exec()\n");
 
+    if (kvm_arch_process_irqchip_events(env)) {
+        env->exit_request = 0;
+        env->exception_index = EXCP_HLT;
+        return 0;
+    }
+
     do {
 #ifndef CONFIG_IOTHREAD
         if (env->exit_request) {
@@ -833,11 +839,6 @@  int kvm_cpu_exec(CPUState *env)
         }
 #endif
 
-        if (kvm_arch_process_irqchip_events(env)) {
-            ret = 0;
-            break;
-        }
-
         if (env->kvm_vcpu_dirty) {
             kvm_arch_put_registers(env, KVM_PUT_RUNTIME_STATE);
             env->kvm_vcpu_dirty = 0;