qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Xin Li <xin.li@rochester.edu>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Bug: hpet timer hangs QEMU using icount
Date: Tue, 02 Mar 2010 00:06:59 -0500	[thread overview]
Message-ID: <4B8C9CF3.8000700@rochester.edu> (raw)

Hpet hangs QEMU when icount is present. I don't know if this is a 
universal problem. The cause is that for periodical timers, hpet_timer 
function tries to insert the timer back to the active timers queue, 
using an updated expire time. However, before the update, if the expire 
time is equal to the current time, this updating will be skipped. As a 
result, this timer will be inserted as is and goes off again and again, 
basically traps itself in a infinite loop, preventing any new 
instructions from being executed.

The patch tries to update the timer even when the current time equals 
the old expire time.

Thanks.

-Xin

--- hw/hpet.c   2010-03-01 23:58:08.815931235 -0500
+++ hw/new_hpet.c       2010-03-01 23:55:07.316704119 -0500
@@ -220,10 +220,10 @@

      if (timer_is_periodic(t) && period != 0) {
          if (t->config & HPET_TN_32BIT) {
-            while (hpet_time_after(cur_tick, t->cmp))
+            while (!hpet_time_after(t->cmp, cur_tick))
                  t->cmp = (uint32_t)(t->cmp + t->period);
          } else
-            while (hpet_time_after64(cur_tick, t->cmp))
+            while (!hpet_time_after64(t->cmp, cur_tick))
                  t->cmp += period;

          diff = hpet_calculate_diff(t, cur_tick);

                 reply	other threads:[~2010-03-02  5:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B8C9CF3.8000700@rochester.edu \
    --to=xin.li@rochester.edu \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).