[RFC] qemu-timer: fix alarm_timer pending

Submitted by TeLeMan on March 19, 2010, 5:24 a.m.

Details

Message ID a38b25541003182224s6caa2bc5m8f9dd2e2b17fc934@mail.gmail.com
State New
Headers show

Commit Message

TeLeMan March 19, 2010, 5:24 a.m.
I fetched the lastest qemu-timer codes and found qemu would have no
response when the guest os was WinXP and the timer was "dynticks" on
the win32 host.  After qemu froze, it seemed the win32_rearm_timer()
would never be called and alarm_timer->pending was always 0.
I could not find the more deeper reason and just referred to the
previous implement to make this patch.

Signed-off-by: TeLeMan <geleman@gmail.com>
---
 qemu-timer.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/qemu-timer.c b/qemu-timer.c
index 3d6e99a..f9e2b19 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -280,7 +280,12 @@  static struct qemu_alarm_timer *alarm_timer;

 int qemu_alarm_pending(void)
 {
-    return alarm_timer->pending;
+    if(alarm_timer->pending) {
+        alarm_timer->pending = 0;
+        return 1;
+    }
+
+    return 0;
 }

 static inline int alarm_has_dynticks(struct qemu_alarm_timer *t)
@@ -724,8 +729,6 @@  void qemu_run_all_timers(void)
         qemu_rearm_alarm_timer(alarm_timer);
     }

-    alarm_timer->pending = 0;
-
     /* vm time timers */
     if (vm_running) {
         qemu_run_timers(vm_clock);