qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [patch 01/11] qemu: create helper for event notificatio


From: Anthony Liguori
Subject: [Qemu-devel] Re: [patch 01/11] qemu: create helper for event notification
Date: Thu, 16 Apr 2009 15:53:04 -0500
User-agent: Thunderbird 2.0.0.21 (X11/20090320)

address@hidden wrote:
Signed-off-by: Marcelo Tosatti <address@hidden>

Index: trunk/vl.c
===================================================================
--- trunk.orig/vl.c
+++ trunk/vl.c
@@ -1183,9 +1183,8 @@ void qemu_mod_timer(QEMUTimer *ts, int64
             qemu_rearm_alarm_timer(alarm_timer);
         }
         /* Interrupt execution to force deadline recalculation.  */
-        if (use_icount && cpu_single_env) {
-            cpu_exit(cpu_single_env);
-        }
+        if (use_icount)
+            qemu_notify_event();
     }
 }

@@ -1338,8 +1337,6 @@ static void host_alarm_handler(int host_
                                qemu_get_clock(vm_clock))) ||
         qemu_timer_expired(active_timers[QEMU_TIMER_REALTIME],
                            qemu_get_clock(rt_clock))) {
-        CPUState *env = next_cpu;
-
 #ifdef _WIN32
         struct qemu_alarm_win32 *data = ((struct 
qemu_alarm_timer*)dwUser)->priv;
         SetEvent(data->host_alarm);
@@ -1349,16 +1346,7 @@ static void host_alarm_handler(int host_
 #endif
         alarm_timer->flags |= ALARM_FLAG_EXPIRED;

-        if (env) {
-            /* stop the currently executing cpu because a timer occured */
-            cpu_exit(env);
-#ifdef USE_KQEMU
-            if (env->kqemu_enabled) {
-                kqemu_cpu_interrupt(env);
-            }
-#endif
-        }
-        event_pending = 1;
+        qemu_notify_event();
     }
 }

I always thought next_cpu was used here to cover an explicit race condition.

If you're using TCG, and you get a single after running the loop, but before assigning cpu_single_env, then you'll set the interrupt exit request on the old CPU state. You'll eventually exit I guess but you potentially have to run through multiple VCPUs.

I'd feel more comfortable if we preserved the behavior here that we had before.

--
Regards,

Anthony Liguori





reply via email to

[Prev in Thread] Current Thread [Next in Thread]