Patchwork Re: [PATCH, RFC] qemu-timer: fix alarm_timer pending

login
register
mail settings
Submitter Paolo Bonzini
Date March 19, 2010, 9:33 a.m.
Message ID <4BA344DF.2060105@redhat.com>
Download mbox | patch
Permalink /patch/48121/
State New
Headers show

Comments

Paolo Bonzini - March 19, 2010, 9:33 a.m.
On 03/19/2010 06:24 AM, TeLeMan wrote:
> 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.

Interesting, it ran fine for me under Wine.

I can see why the patch you have works, but I don't think it's 100% 
correct.  alarm_timer->pending should remain 1 until qemu_run_all_timers 
runs.  Can you test this one instead:



If it doesn't work, I'm fine with TeLeMan's patch.

Paolo
TeLeMan - March 19, 2010, 9:47 a.m.
On Fri, Mar 19, 2010 at 17:33, Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 03/19/2010 06:24 AM, TeLeMan wrote:
>>
>> 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.
>
> Interesting, it ran fine for me under Wine.
>
> I can see why the patch you have works, but I don't think it's 100% correct.
>  alarm_timer->pending should remain 1 until qemu_run_all_timers runs.  Can
> you test this one instead:

Yes, I did test this one firstly. It's working also but different with
the previous implement and I didn't know the exact reason, so I made
the another patch.


> diff --git a/qemu-timer.c b/qemu-timer.c
> index 329d3a4..49eac86 100644
> --- a/qemu-timer.c
> +++ b/qemu-timer.c
> @@ -706,14 +706,14 @@ void configure_icount(const char *option)
>
>  void qemu_run_all_timers(void)
>  {
> +    alarm_timer->pending = 0;
> +
>     /* rearm timer, if not periodic */
>     if (alarm_timer->expired) {
>         alarm_timer->expired = 0;
>         qemu_rearm_alarm_timer(alarm_timer);
>     }
>
> -    alarm_timer->pending = 0;
> -
>     /* vm time timers */
>     if (vm_running) {
>         qemu_run_timers(vm_clock);
>
>
> If it doesn't work, I'm fine with TeLeMan's patch.
>
> Paolo
>

Patch

diff --git a/qemu-timer.c b/qemu-timer.c
index 329d3a4..49eac86 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -706,14 +706,14 @@  void configure_icount(const char *option)

  void qemu_run_all_timers(void)
  {
+    alarm_timer->pending = 0;
+
      /* rearm timer, if not periodic */
      if (alarm_timer->expired) {
          alarm_timer->expired = 0;
          qemu_rearm_alarm_timer(alarm_timer);
      }

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