]> git.proxmox.com Git - qemu.git/commit
qemu-timer: properly arm alarm timer for timers set by device initialization
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 3 Sep 2012 15:34:32 +0000 (17:34 +0200)
committerAurelien Jarno <aurelien@aurel32.net>
Tue, 4 Sep 2012 10:30:28 +0000 (12:30 +0200)
commitde188751da8db3c77a681bf903035a0e5218c463
tree04572921bcbb36d25b8a31c9fc23c5c77a0255f7
parente7eee62a90c671d22d50964b7de05e3f4fd96f5f
qemu-timer: properly arm alarm timer for timers set by device initialization

QEMU will hang when fed the following command-line

  qemu-system-mips -kernel vmlinux-2.6.32-5-4kc-malta -append "console=ttyS0" -nographic -net none

The -net none is important otherwise it seems some events are generated
causing the things to work. When it doesn't work, the guest hangs when
measuring the CPU frequency, after the following line:

  [    0.000000] NR_IRQS:256

Pressing a key on the serial port unblocks it, hinting that the problem
is due to the recent elimination of the 1 second timeout in the main
loop.

The problem is that because init_timer_alarm sets the timer's pending
flag to true, the alarm timer is never armed until after the first time
through the main loop.  Thus the bug started when QEMU started testing
the pending flag in qemu_mod_timer (commit 1828be3, more alarm timer
cleanup, 2010-03-10).

But actually, it isn't true at all that a timer is pending when the
alarm timer is created, and the real bug has been latent forever: the
fix is to remove the bogus setting of pending flag.

Reported-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
qemu-timer.c