Patchwork x86_64 linux kernel doesn't boot with -icount enabled

login
register
mail settings
Submitter Max Filippov
Date Nov. 8, 2011, 1:45 p.m.
Message ID <CAMo8BfJqyvNAAN_CDrSUaGHLq5oJzWb_nQjZqbC2FDYGawjrDQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/124362/
State New
Headers show

Comments

Max Filippov - Nov. 8, 2011, 1:45 p.m.
Hi.

I'm trying to run stock Debian 6.0 x86_64 kernel using qemu git head.
With the following command line it's ok (getting to rootfs mounting
and panics):

qemu-system-x86_64 -serial stdio -monitor null -nographic -kernel
/boot/vmlinuz-2.6.38-bpo.2-amd64 -append 'console=ttyS0 panic=1'

But once I add -icount option (have tried -icount 1, 2, 16, 256, auto,
the result is the same) qemu loops infinitely in the qemu_run_timers:

    for(;;) {
        ts = *ptimer_head;
        if (!qemu_timer_expired_ns(ts, current_time)) {
            break;
        }
        /* remove timer from the list before calling the callback */
        *ptimer_head = ts->next;
        ts->next = NULL;

        /* run the callback (the timer list can be modified) */
        ts->cb(ts->opaque);
    }

With ts being hpet timer and inside ts->cb that is hpet_timer,  diff =
hpet_calculate_diff(t, cur_tick) is always zero.
The following patch breaks the loop:

     }


but with this patch applied qemu fails as follows:

[    0.000000] Console: colour VGA+ 80x25
[    0.000000] console [ttyS0] enabled
[    0.000000] Fast TSC calibration using PIT
[    0.000000] Detected 999.951 MHz processor.
[    0.000003] Calibrating delay loop (skipped), value calculated
using timer frequency.. 1999.90 BogoMIPS (lpj=3999804)
[    0.000039] pid_max: default: 32768 minimum: 301
[    0.000129] Security Framework initialized
[    0.000144] SELinux:  Disabled at boot.
[    0.000255] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
[    0.000572] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
[    0.000735] Mount-cache hash table entries: 256
[    0.001121] Initializing cgroup subsys ns
[    0.001136] ns_cgroup deprecated: consider using the
'clone_children' flag without the ns_cgroup.
[    0.001161] Initializing cgroup subsys cpuacct
[    0.001193] Initializing cgroup subsys devices
[    0.001208] Initializing cgroup subsys freezer
[    0.001224] Initializing cgroup subsys net_cls
[    0.001239] Initializing cgroup subsys blkio
[    0.001328] mce: CPU supports 10 MCE banks
[    0.001356] SMP alternatives: switching to UP code
[    0.008000] Freeing SMP alternatives: 16k freed
[    0.008000] ACPI: Core revision 20110112
[    0.008000] Setting APIC routing to flat
[    0.008000] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.012000] ..MP-BIOS bug: 8254 timer not connected to IO-APIC
[    0.012000] ...trying to set up timer (IRQ0) through the 8259A ...
[    0.012000] ..... (found apic 0 pin 2) ...
[    0.016000] ....... failed.
[    0.016000] ...trying to set up timer as Virtual Wire IRQ...
Segmentation fault

b/o the following infinite recursion:

(gdb) bt
#0  0x081b9564 in clz32 (val=0) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/host-utils.h:53
#1  0x081b97c2 in fls_bit (value=65536) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:121
#2  0x081ba16d in get_highest_priority_int (tab=0x89cec54) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:346
#3  0x081ba275 in apic_irq_pending (s=0x89cdea8) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:383
#4  0x081ba301 in apic_update_irq (s=0x89cdea8) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:401
#5  0x081ba492 in apic_set_irq (s=0x89cdea8, vector_num=48,
trigger_mode=0) at /home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:434
#6  0x081b9a77 in apic_local_deliver (s=0x89cdea8, vector=3) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:182
#7  0x081b9acf in apic_deliver_pic_intr (d=0x89cdea8, level=1) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:191
#8  0x081ba353 in apic_update_irq (s=0x89cdea8) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:405
#9  0x081ba492 in apic_set_irq (s=0x89cdea8, vector_num=48,
trigger_mode=0) at /home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:434
#10 0x081b9a77 in apic_local_deliver (s=0x89cdea8, vector=3) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:182
#11 0x081b9acf in apic_deliver_pic_intr (d=0x89cdea8, level=1) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:191
#12 0x081ba353 in apic_update_irq (s=0x89cdea8) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:405
#13 0x081ba492 in apic_set_irq (s=0x89cdea8, vector_num=48,
trigger_mode=0) at /home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:434
...
Max Filippov - Nov. 8, 2011, 2:03 p.m.
> b/o the following infinite recursion:
>
> (gdb) bt
> #0  0x081b9564 in clz32 (val=0) at
> /home/jcmvbkbc/ws/xtensa/qemu-xtensa/host-utils.h:53
> #1  0x081b97c2 in fls_bit (value=65536) at
> /home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:121
> #2  0x081ba16d in get_highest_priority_int (tab=0x89cec54) at
> /home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:346
> #3  0x081ba275 in apic_irq_pending (s=0x89cdea8) at
> /home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:383
> #4  0x081ba301 in apic_update_irq (s=0x89cdea8) at
> /home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:401
> #5  0x081ba492 in apic_set_irq (s=0x89cdea8, vector_num=48,
> trigger_mode=0) at /home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:434

[...]

It ends like this:

#131008 0x081ba353 in apic_update_irq (s=0x89cdea8) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:405
#131009 0x081ba492 in apic_set_irq (s=0x89cdea8, vector_num=48,
trigger_mode=0) at /home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:434
#131010 0x081b9a77 in apic_local_deliver (s=0x89cdea8, vector=3) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:182
#131011 0x081b9acf in apic_deliver_pic_intr (d=0x89cdea8, level=1) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:191
#131012 0x081ba353 in apic_update_irq (s=0x89cdea8) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:405
#131013 0x081bad5d in apic_get_interrupt (d=0x89cdea8) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/apic.c:620
#131014 0x08271a77 in cpu_get_pic_interrupt (env=0x89c1ce8) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/hw/pc.c:156
#131015 0x081e4cc6 in cpu_x86_exec (env=0x89c1ce8) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/cpu-exec.c:320
#131016 0x081ea7d5 in tcg_cpu_exec (env=0x89c1ce8) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/cpus.c:1007
#131017 0x081ea8e3 in tcg_exec_all () at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/cpus.c:1039
#131018 0x081e9f55 in qemu_tcg_cpu_thread_fn (arg=0x89c1ce8) at
/home/jcmvbkbc/ws/xtensa/qemu-xtensa/cpus.c:774
#131019 0xf7b37955 in start_thread (arg=0xf40a2b70) at pthread_create.c:300
#131020 0xf7ab7e7e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
(gdb)
Paolo Bonzini - Nov. 8, 2011, 2:14 p.m.
On 11/08/2011 02:45 PM, Max Filippov wrote:
> Hi.
>
> I'm trying to run stock Debian 6.0 x86_64 kernel using qemu git head.
> With the following command line it's ok (getting to rootfs mounting
> and panics):
>
> qemu-system-x86_64 -serial stdio -monitor null -nographic -kernel
> /boot/vmlinuz-2.6.38-bpo.2-amd64 -append 'console=ttyS0 panic=1'
>
> But once I add -icount option (have tried -icount 1, 2, 16, 256, auto,
> the result is the same) qemu loops infinitely in the qemu_run_timers:

Is this a regression, either from 0.15 w/o iothread, or from something 
recent?  Most backends are buggy with icount (with the embedded ones 
more likely to be reliable).

Paolo
Max Filippov - Nov. 8, 2011, 2:21 p.m.
>> But once I add -icount option (have tried -icount 1, 2, 16, 256, auto,
>> the result is the same) qemu loops infinitely in the qemu_run_timers:
>
> Is this a regression, either from 0.15 w/o iothread, or from something
> recent?  Most backends are buggy with icount (with the embedded ones more
> likely to be reliable).

Actually I had it first with qemu-0.13.0-rc0.
And I'm trying this to deal with the bug similar to that one:
https://bugzilla.redhat.com/show_bug.cgi?id=502440
Max Filippov - Nov. 8, 2011, 3:52 p.m.
With kernel command line of 'console=ttyS0 noapic=1 panic=1' patched
qemu boots up successfully with -icount, whereas unpatched qemu loops
infinitely.

Looks like APIC emulation issue to me.
Mars.cao - Nov. 9, 2011, 9:41 a.m.
On 11/08/2011 11:52 PM, Max Filippov wrote:
> With kernel command line of 'console=ttyS0 noapic=1 panic=1' patched
> qemu boots up successfully with -icount, whereas unpatched qemu loops
> infinitely.
>
> Looks like APIC emulation issue to me.
>
I'm trying to test issue using a 2.6.38 vmlinuz image.
The image is a kernel image of a another ubuntu guest. I just copy it to 
host and use it directly.

# /usr/local/bin/qemu-system-x86_64 -enable-kvm -m 1024 -kernel 
vmlinuz-2.6.38-8-generic -append 'ro quiet noacpi=1 ' -chardev 
stdio,id=mon0 -mon chardev=mon0

The kernel can be successfully loaded and run normally until 
kernel_init(),and panic because there is no root file-system supplied.

But add -icount option:

# /usr/local/bin/qemu-system-x86_64 -enable-kvm -m 1024 -kernel 
vmlinuz-2.6.38-8-generic -append 
'root=UUID=96bc04c5-410e-482a-82bf-95b2355552d6 ro quiet noacpi=1' 
-chardev stdio,id=mon0 -mon chardev=mon0 -icount auto

The kernel can not be loaded successfully.

loop in main_loop_wait().
Mars.cao - Nov. 9, 2011, 10:42 a.m.
On 11/09/2011 05:41 PM, Cao,Bing Bu wrote:
> On 11/08/2011 11:52 PM, Max Filippov wrote:
>> With kernel command line of 'console=ttyS0 noapic=1 panic=1' patched
>> qemu boots up successfully with -icount, whereas unpatched qemu loops
>> infinitely.
>>
>> Looks like APIC emulation issue to me.
>>
> I'm trying to test issue using a 2.6.38 vmlinuz image.
> The image is a kernel image of a another ubuntu guest. I just copy it 
> to host and use it directly.
>
> # /usr/local/bin/qemu-system-x86_64 -enable-kvm -m 1024 -kernel 
> vmlinuz-2.6.38-8-generic -append 'ro quiet noacpi=1 ' -chardev 
> stdio,id=mon0 -mon chardev=mon0
>
> The kernel can be successfully loaded and run normally until 
> kernel_init(),and panic because there is no root file-system supplied.
>
> But add -icount option:
>
> # /usr/local/bin/qemu-system-x86_64 -enable-kvm -m 1024 -kernel 
> vmlinuz-2.6.38-8-generic -append 
> 'root=UUID=96bc04c5-410e-482a-82bf-95b2355552d6 ro quiet noacpi=1' 
> -chardev stdio,id=mon0 -mon chardev=mon0 -icount auto
>
> The kernel can not be loaded successfully.
>
> loop in main_loop_wait().
>
>
When with option -icount,kernel message:
"HPET counter not counting. HPET disabled"

halt not continue running:
normally boot message:

<  APIC calibration not consistent with PM-Timer: 92ms instead of 100ms^M
<  APIC delta adjusted to PM-Timer: 6250004 (5750429)^M
<  Performance Events: unsupported p6 CPU model 2 no PMU driver, 
software events only.^M
<  Brought up 1 CPUs^M
<  Total of 1 processors activated (5183.86 BogoMIPS).^M
<  devtmpfs: initialized^M
<  print_constraints: dummy: ^M
<  Time: 10:32:17  Date: 11/09/11^M
<  NET: Registered protocol family 16^M
<  EISA bus registered^M
<  ACPI: bus type pci registered^M
<  PCI: PCI BIOS revision 2.10 entry at 0xffe77, last bus=0^M
<  PCI: Using configuration type 1 for base access^M
<  bio: create slab <bio-0> at 0^M
<  ACPI: Interpreter enabled^M
<  ACPI: (supports S0 S3 S4 S5)^M
<  ACPI: Using IOAPIC for interrupt routing^M
<  ACPI: No dock devices found.^M
<  HEST: Table not found.^M
<  PCI: Ignoring host bridge windows from ACPI; if necessary, use 
"pci=use_crs" and report a bug^M
<  ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])^M
<  pci 0000:00:01.3: quirk: [io  0xb000-0xb03f] claimed by PIIX4 ACPI^M
<  pci 0000:00:01.3: quirk: [io  0xb100-0xb10f] claimed by PIIX4 SMB^M
<  ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)^M
<  ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)^M
<  ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)^M
<  ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)^M
<  ACPI: PCI Interrupt Link [LNKS] (IRQs 9) *0^M


Maybe right,it is a ACPI issue.
Max Filippov - Nov. 9, 2011, 10:50 a.m.
> When with option -icount,kernel message:
> "HPET counter not counting. HPET disabled"

For the HPET please try this patch:
http://lists.nongnu.org/archive/html/qemu-devel/2011-11/msg01109.html

> Maybe right,it is a ACPI issue.

I was actually talkin about the APIC one, but well, there are 24
anagrams of these letters (.
Mars.cao - Nov. 10, 2011, 2:54 a.m.
On 11/09/2011 06:50 PM, Max Filippov wrote:
>> When with option -icount,kernel message:
>> "HPET counter not counting. HPET disabled"
> For the HPET please try this patch:
> http://lists.nongnu.org/archive/html/qemu-devel/2011-11/msg01109.html
>
>> Maybe right,it is a ACPI issue.
> I was actually talkin about the APIC one, but well, there are 24
> anagrams of these letters (.

Sorry for that typo of last mail,What I mean is APIC not APCI. :)

I applied the patch: 
http://lists.nongnu.org/archive/html/qemu-devel/2011-11/msg01109.html.
But I feel it doesn't affect anything.

I am using QEMU-1.0 rc1,pulled on 9 Nov.
QEMU emulator version 0.15.91.

Then,
/usr/local/bin/qemu-system-x86_64 -enable-kvm -m 1024 -kernel 
vmlinuz-2.6.38-8-generic -append 'ro noapic=1 console=ttyS0' -serial 
stdio -icount auto

When bootup:

[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 2.6.38-8-generic (buildd@vernadsky) (gcc 
version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu3) ) #42-Ubuntu SMP Mon Apr 11 
03:31:50 UTC 2011 (Ubuntu 2.6.38-8.42-generic 2.6.38.2)
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009f400 (usable)
[    0.000000]  BIOS-e820: 000000000009f400 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 000000003fffd000 (usable)
[    0.000000]  BIOS-e820: 000000003fffd000 - 0000000040000000 (reserved)
[    0.000000]  BIOS-e820: 00000000feffc000 - 00000000ff000000 (reserved)
[    0.000000]  BIOS-e820: 00000000fffc0000 - 0000000100000000 (reserved)
[    0.000000] Notice: NX (Execute Disable) protection cannot be enabled 
in hardware: non-PAE kernel!
[    0.000000] NX (Execute Disable) protection: approximated by x86 
segment limits
[    0.000000] DMI 2.4 present.
[    0.000000] last_pfn = 0x3fffd max_arch_pfn = 0x100000
[    0.000000] PAT not supported by CPU.
[    0.000000] found SMP MP-table at [c00fda80] fda80
[    0.000000] init_memory_mapping: 0000000000000000-00000000377fe000
[    0.000000] ACPI: RSDP 000fd920 00014 (v00 BOCHS )
[    0.000000] ACPI: RSDT 3fffd7b0 00034 (v01 BOCHS  BXPCRSDT 00000001 
BXPC 00000001)
[    0.000000] ACPI: FACP 3fffff80 00074 (v01 BOCHS  BXPCFACP 00000001 
BXPC 00000001)
[    0.000000] ACPI: DSDT 3fffd9b0 02589 (v01   BXPC   BXDSDT 00000001 
INTL 20100528)
[    0.000000] ACPI: FACS 3fffff40 00040
[    0.000000] ACPI: SSDT 3fffd910 0009E (v01 BOCHS  BXPCSSDT 00000001 
BXPC 00000001)
[    0.000000] ACPI: APIC 3fffd830 00072 (v01 BOCHS  BXPCAPIC 00000001 
BXPC 00000001)
[    0.000000] ACPI: HPET 3fffd7f0 00038 (v01 BOCHS  BXPCHPET 00000001 
BXPC 00000001)
[    0.000000] 135MB HIGHMEM available.
[    0.000000] 887MB LOWMEM available.
[    0.000000]   mapped low ram: 0 - 377fe000
[    0.000000]   low ram: 0 - 377fe000
[    0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00
[    0.000000] kvm-clock: cpu 0, msr 0:183a841, boot clock
[    0.000000] Zone PFN ranges:
[    0.000000]   DMA      0x00000010 -> 0x00001000
[    0.000000]   Normal   0x00001000 -> 0x000377fe
[    0.000000]   HighMem  0x000377fe -> 0x0003fffd
[    0.000000] Movable zone start PFN for each node
[    0.000000] early_node_map[2] active PFN ranges
[    0.000000]     0: 0x00000010 -> 0x0000009f
[    0.000000]     0: 0x00000100 -> 0x0003fffd
[    0.000000] Using APIC driver default
[    0.000000] ACPI: PM-Timer IO Port: 0xb008
[    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[    0.000000] ACPI: IOAPIC (id[0x01] address[0xfec00000] gsi_base[0])
[    0.000000] IOAPIC[0]: apic_id 1, version 17, address 0xfec00000, GSI 
0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] SMP: Allowing 1 CPUs, 0 hotplug CPUs
[    0.000000] PM: Registered nosave memory: 000000000009f000 - 
00000000000a0000
[    0.000000] PM: Registered nosave memory: 00000000000a0000 - 
00000000000f0000
[    0.000000] PM: Registered nosave memory: 00000000000f0000 - 
0000000000100000
[    0.000000] Allocating PCI resources starting at 40000000 (gap: 
40000000:beffc000)
[    0.000000] Booting paravirtualized kernel on KVM
[    0.000000] setup_percpu: NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:1 
nr_node_ids:1
[    0.000000] PERCPU: Embedded 13 pages/cpu @f6800000 s28800 r0 d24448 
u4194304
[    0.000000] kvm-clock: cpu 0, msr 0:36806841, primary cpu clock
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  
Total pages: 259980
[    0.000000] Kernel command line: ro noacpi=1 console=ttyS0
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 
bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 
bytes)
[    0.000000] Initializing CPU#0
[    0.000000] allocated 5242500 bytes of page_cgroup
[    0.000000] please try 'cgroup_disable=memory' option if you don't 
want memory cgroups
[    0.000000] Initializing HighMem for node 0 (000377fe:0003fffd)
[    0.000000] Memory: 1024556k/1048564k available (5188k kernel code, 
23556k reserved, 2540k data, 700k init, 139260k highmem)
[    0.000000] virtual kernel memory layout:
[    0.000000]     fixmap  : 0xfff16000 - 0xfffff000   ( 932 kB)
[    0.000000]     pkmap   : 0xff800000 - 0xffc00000   (4096 kB)
[    0.000000]     vmalloc : 0xf7ffe000 - 0xff7fe000   ( 120 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf77fe000   ( 887 MB)
[    0.000000]       .init : 0xc178d000 - 0xc183c000   ( 700 kB)
[    0.000000]       .data : 0xc15112a1 - 0xc178c480   (2540 kB)
[    0.000000]       .text : 0xc1000000 - 0xc15112a1   (5188 kB)
[    0.000000] Checking if this processor honours the WP bit even in 
supervisor mode...Ok.
[    0.000000] SLUB: Genslabs=15, HWalign=64, Order=0-3, MinObjects=0, 
CPUs=1, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]     RCU dyntick-idle grace-period acceleration is enabled.
[    0.000000]     RCU-based detection of stalled CPUs is disabled.
[    0.000000] NR_IRQS:2304 nr_irqs:256 16
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] console [ttyS0] enabled
[    0.000000] *HPET counter not counting. HPET disabled*
[    0.000000] Detected 2591.788 MHz processor.
[    0.004000] Calibrating delay loop (skipped) preset value.. 5183.57 
BogoMIPS (lpj=10367152)
[    0.004000] pid_max: default: 32768 minimum: 301
[    0.004000] Security Framework initialized
[    0.004000] AppArmor: AppArmor initialized
[    0.004000] Yama: becoming mindful.
[    0.004000] Mount-cache hash table entries: 512
[    0.004000] Initializing cgroup subsys ns
[    0.004000] ns_cgroup deprecated: consider using the 'clone_children' 
flag without the ns_cgroup.
[    0.004000] Initializing cgroup subsys cpuacct
[    0.004000] Initializing cgroup subsys memory
[    0.004000] Initializing cgroup subsys devices
[    0.004000] Initializing cgroup subsys freezer
[    0.004000] Initializing cgroup subsys net_cls
[    0.004000] Initializing cgroup subsys blkio
[    0.004000] mce: CPU supports 10 MCE banks
[    0.004000] SMP alternatives: switching to UP code
[    0.004000] Freeing SMP alternatives: 20k freed
[    0.004000] ACPI: Core revision 20110112
[    0.004000] ftrace: allocating 23640 entries in 47 pages
[    0.004000] Enabling APIC mode:  Flat.  Using 1 I/O APICs
[    0.004000] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.004000] CPU0: Intel QEMU Virtual CPU version 0.15.91 stepping 03

hang.


With no icount option:
/usr/local/bin/qemu-system-x86_64 -enable-kvm -m 1024 -kernel 
vmlinuz-2.6.38-8-generic -append 'ro noapic=1 console=ttyS0' -serial stdio

[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 2.6.38-8-generic (buildd@vernadsky) (gcc 
version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu3) ) #42-Ubuntu SMP Mon Apr 11 
03:31:50 UTC 2011 (Ubuntu 2.6.38-8.42-generic 2.6.38.2)
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009f400 (usable)
[    0.000000]  BIOS-e820: 000000000009f400 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 000000003fffd000 (usable)
[    0.000000]  BIOS-e820: 000000003fffd000 - 0000000040000000 (reserved)
[    0.000000]  BIOS-e820: 00000000feffc000 - 00000000ff000000 (reserved)
[    0.000000]  BIOS-e820: 00000000fffc0000 - 0000000100000000 (reserved)
[    0.000000] Notice: NX (Execute Disable) protection cannot be enabled 
in hardware: non-PAE kernel!
[    0.000000] NX (Execute Disable) protection: approximated by x86 
segment limits
[    0.000000] DMI 2.4 present.
[    0.000000] last_pfn = 0x3fffd max_arch_pfn = 0x100000
[    0.000000] PAT not supported by CPU.
[    0.000000] found SMP MP-table at [c00fda80] fda80
[    0.000000] init_memory_mapping: 0000000000000000-00000000377fe000
[    0.000000] ACPI: RSDP 000fd920 00014 (v00 BOCHS )
[    0.000000] ACPI: RSDT 3fffd7b0 00034 (v01 BOCHS  BXPCRSDT 00000001 
BXPC 00000001)
[    0.000000] ACPI: FACP 3fffff80 00074 (v01 BOCHS  BXPCFACP 00000001 
BXPC 00000001)
[    0.000000] ACPI: DSDT 3fffd9b0 02589 (v01   BXPC   BXDSDT 00000001 
INTL 20100528)
[    0.000000] ACPI: FACS 3fffff40 00040
[    0.000000] ACPI: SSDT 3fffd910 0009E (v01 BOCHS  BXPCSSDT 00000001 
BXPC 00000001)
[    0.000000] ACPI: APIC 3fffd830 00072 (v01 BOCHS  BXPCAPIC 00000001 
BXPC 00000001)
[    0.000000] ACPI: HPET 3fffd7f0 00038 (v01 BOCHS  BXPCHPET 00000001 
BXPC 00000001)
[    0.000000] 135MB HIGHMEM available.
[    0.000000] 887MB LOWMEM available.
[    0.000000]   mapped low ram: 0 - 377fe000
[    0.000000]   low ram: 0 - 377fe000
[    0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00
[    0.000000] kvm-clock: cpu 0, msr 0:183a841, boot clock
[    0.000000] Zone PFN ranges:
[    0.000000]   DMA      0x00000010 -> 0x00001000
[    0.000000]   Normal   0x00001000 -> 0x000377fe
[    0.000000]   HighMem  0x000377fe -> 0x0003fffd
[    0.000000] Movable zone start PFN for each node
[    0.000000] early_node_map[2] active PFN ranges
[    0.000000]     0: 0x00000010 -> 0x0000009f
[    0.000000]     0: 0x00000100 -> 0x0003fffd
[    0.000000] Using APIC driver default
[    0.000000] ACPI: PM-Timer IO Port: 0xb008
[    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[    0.000000] ACPI: IOAPIC (id[0x01] address[0xfec00000] gsi_base[0])
[    0.000000] IOAPIC[0]: apic_id 1, version 17, address 0xfec00000, GSI 
0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] SMP: Allowing 1 CPUs, 0 hotplug CPUs
[    0.000000] PM: Registered nosave memory: 000000000009f000 - 
00000000000a0000
[    0.000000] PM: Registered nosave memory: 00000000000a0000 - 
00000000000f0000
[    0.000000] PM: Registered nosave memory: 00000000000f0000 - 
0000000000100000
[    0.000000] Allocating PCI resources starting at 40000000 (gap: 
40000000:beffc000)
[    0.000000] Booting paravirtualized kernel on KVM
[    0.000000] setup_percpu: NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:1 
nr_node_ids:1
[    0.000000] PERCPU: Embedded 13 pages/cpu @f6800000 s28800 r0 d24448 
u4194304
[    0.000000] kvm-clock: cpu 0, msr 0:36806841, primary cpu clock
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  
Total pages: 259980
[    0.000000] Kernel command line: ro noacpi=1 console=ttyS0
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 
bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 
bytes)
[    0.000000] Initializing CPU#0
[    0.000000] allocated 5242500 bytes of page_cgroup
[    0.000000] please try 'cgroup_disable=memory' option if you don't 
want memory cgroups
[    0.000000] Initializing HighMem for node 0 (000377fe:0003fffd)
[    0.000000] Memory: 1024556k/1048564k available (5188k kernel code, 
23556k reserved, 2540k data, 700k init, 139260k highmem)
[    0.000000] virtual kernel memory layout:
[    0.000000]     fixmap  : 0xfff16000 - 0xfffff000   ( 932 kB)
[    0.000000]     pkmap   : 0xff800000 - 0xffc00000   (4096 kB)
[    0.000000]     vmalloc : 0xf7ffe000 - 0xff7fe000   ( 120 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf77fe000   ( 887 MB)
[    0.000000]       .init : 0xc178d000 - 0xc183c000   ( 700 kB)
[    0.000000]       .data : 0xc15112a1 - 0xc178c480   (2540 kB)
[    0.000000]       .text : 0xc1000000 - 0xc15112a1   (5188 kB)
[    0.000000] Checking if this processor honours the WP bit even in 
supervisor mode...Ok.
[    0.000000] SLUB: Genslabs=15, HWalign=64, Order=0-3, MinObjects=0, 
CPUs=1, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]     RCU dyntick-idle grace-period acceleration is enabled.
[    0.000000]     RCU-based detection of stalled CPUs is disabled.
[    0.000000] NR_IRQS:2304 nr_irqs:256 16
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] console [ttyS0] enabled
[    0.000000] Detected 2591.788 MHz processor.
[    0.008000] Calibrating delay loop (skipped) preset value.. 5183.57 
BogoMIPS (lpj=10367152)
[    0.008000] pid_max: default: 32768 minimum: 301
[    0.008000] Security Framework initialized
[    0.008000] AppArmor: AppArmor initialized
[    0.008000] Yama: becoming mindful.
[    0.008000] Mount-cache hash table entries: 512
[    0.008000] Initializing cgroup subsys ns
[    0.008000] ns_cgroup deprecated: consider using the 'clone_children' 
flag without the ns_cgroup.
[    0.008000] Initializing cgroup subsys cpuacct
[    0.008010] Initializing cgroup subsys memory
[    0.008367] Initializing cgroup subsys devices
[    0.008745] Initializing cgroup subsys freezer
[    0.009100] Initializing cgroup subsys net_cls
[    0.009477] Initializing cgroup subsys blkio
[    0.009879] mce: CPU supports 10 MCE banks
[    0.012474] SMP alternatives: switching to UP code
[    0.025842] Freeing SMP alternatives: 20k freed
[    0.026212] ACPI: Core revision 20110112
[    0.027359] ftrace: allocating 23640 entries in 47 pages
[    0.028086] Enabling APIC mode:  Flat.  Using 1 I/O APICs
[    0.029951] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
*[    0.030437] CPU0: Intel QEMU Virtual CPU version 0.15.91 stepping 03*
*[    0.032001] APIC calibration not consistent with PM-Timer: 94ms 
instead of 100ms
[    0.032001] APIC delta adjusted to PM-Timer: 6249992 (5936475)*
[    0.032048] Performance Events: unsupported p6 CPU model 2 no PMU 
driver, software events only.
[    0.033326] Brought up 1 CPUs
[    0.033573] Total of 1 processors activated (5183.57 BogoMIPS).
[    0.034338] devtmpfs: initialized
[    0.035397] print_constraints: dummy:
[    0.035732] Time:  2:05:37  Date: 11/10/11
[    0.036034] NET: Registered protocol family 16
[    0.036509] EISA bus registered
[    0.036775] ACPI: bus type pci registered
[    0.037190] PCI: PCI BIOS revision 2.10 entry at 0xffe77, last bus=0
[    0.037691] PCI: Using configuration type 1 for base access
[    0.038828] bio: create slab <bio-0> at 0
[    0.040934] ACPI: Interpreter enabled
[    0.041236] ACPI: (supports S0 S3 S4 S5)
[    0.041589] ACPI: Using IOAPIC for interrupt routing
[    0.044757] ACPI: No dock devices found.
[    0.045091] HEST: Table not found.
[    0.045367] PCI: Ignoring host bridge windows from ACPI; if 
necessary, use "pci=use_crs" and report a bug
[    0.046158] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    0.049098] pci 0000:00:01.3: quirk: [io  0xb000-0xb03f] claimed by 
PIIX4 ACPI
[    0.049687] pci 0000:00:01.3: quirk: [io  0xb100-0xb10f] claimed by 
PIIX4 SMB
[    0.068129] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
[    0.068721] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
[    0.069240] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
[    0.069771] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
[    0.070272] ACPI: PCI Interrupt Link [LNKS] (IRQs 9) *0
[    0.070851] vgaarb: device added: 
PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
[    0.071484] vgaarb: loaded
[    0.071881] SCSI subsystem initialized
[    0.072080] usbcore: registered new interface driver usbfs
[    0.072519] usbcore: registered new interface driver hub
[    0.072959] usbcore: registered new device driver usb
[    0.073452] wmi: Mapper loaded
[    0.073701] PCI: Using ACPI for IRQ routing
[    0.074161] NetLabel: Initializing
[    0.074441] NetLabel:  domain hash size = 128
[    0.074782] NetLabel:  protocols = UNLABELED CIPSOv4
[    0.075175] NetLabel:  unlabeled traffic allowed by default
[    0.076009] HPET: 3 timers in total, 0 timers will be used for 
per-cpu timer
[    0.076622] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[    0.077038] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
[    0.080085] Switching to clocksource kvm-clock
[    0.083504] Switched to NOHz mode on CPU #0
[    0.084619] AppArmor: AppArmor Filesystem Enabled
[    0.085031] pnp: PnP ACPI init
[    0.085544] ACPI: bus type pnp registered
[    0.086482] pnp: PnP ACPI: found 8 devices
[    0.086809] ACPI: ACPI bus type pnp unregistered
[    0.087175] PnPBIOS: Disabled
[    0.123137] NET: Registered protocol family 2
[    0.123519] IP route cache hash table entries: 32768 (order: 5, 
131072 bytes)
[    0.124338] TCP established hash table entries: 131072 (order: 8, 
1048576 bytes)
[    0.125351] TCP bind hash table entries: 65536 (order: 7, 524288 bytes)
[    0.125939] TCP: Hash tables configured (established 131072 bind 65536)
[    0.126453] TCP reno registered
[    0.126688] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.127127] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.127673] NET: Registered protocol family 1
[    0.128168] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[    0.128678] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[    0.129147] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[    0.129806] cpufreq-nforce2: No nForce2 chipset.
[    0.130290] audit: initializing netlink socket (disabled)
[    0.130784] type=2000 audit(1320890738.128:1): initialized
[    0.137806] highmem bounce pool size: 64 pages
[    0.138503] HugeTLB registered 4 MB page size, pre-allocated 0 pages
[    0.140188] VFS: Disk quotas dquot_6.5.2
[    0.140582] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.141521] fuse init (API version 7.16)
[    0.141902] msgmni has been set to 1729
[    0.142347] Block layer SCSI generic (bsg) driver version 0.4 loaded 
(major 253)
[    0.142948] io scheduler noop registered
[    0.143267] io scheduler deadline registered
[    0.143614] io scheduler cfq registered (default)
[    0.144107] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[    0.144603] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
[    0.145222] input: Power Button as 
/devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[    0.145806] ACPI: Power Button [PWRF]
[    0.147088] ERST: Table is not found!
[    0.147411] isapnp: Scanning for PnP cards...
[    0.153326] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled
[    0.174572] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.240044] 00:06: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.240731] Linux agpgart interface v0.103
[    0.242180] brd: module loaded
[    0.242809] loop: module loaded
[    0.243162] i2c-core: driver [adp5520] using legacy suspend method
[    0.243653] i2c-core: driver [adp5520] using legacy resume method
[    0.288631] scsi0 : ata_piix
[    0.288936] scsi1 : ata_piix
[    0.289203] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc040 irq 14
[    0.289738] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc048 irq 15
[    0.290549] Fixed MDIO Bus: probed
[    0.290853] PPP generic driver version 2.4.2
[    0.291298] tun: Universal TUN/TAP device driver, 1.6
[    0.291706] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[    0.292504] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.293041] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.293540] uhci_hcd: USB Universal Host Controller Interface driver
[    0.294094] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 
0x60,0x64 irq 1,12
[    0.295204] serio: i8042 KBD port at 0x60,0x64 irq 1
[    0.295606] serio: i8042 AUX port at 0x60,0x64 irq 12
[    0.296440] mousedev: PS/2 mouse device common for all mice
[    0.297054] input: AT Translated Set 2 keyboard as 
/devices/platform/i8042/serio0/input/input1
[    0.297858] rtc_cmos 00:01: RTC can wake from S4
[    0.298250] rtc_cmos 00:01: rtc core: registered rtc_cmos as rtc0
[    0.298803] rtc0: alarms up to one day, 114 bytes nvram, hpet irqs
[    0.299389] device-mapper: uevent: version 1.0.3
[    0.299806] device-mapper: ioctl: 4.19.1-ioctl (2011-01-07) 
initialised: dm-devel@redhat.com
[    0.300645] device-mapper: multipath: version 1.2.0 loaded
[    0.301086] device-mapper: multipath round-robin: version 1.0.0 loaded
[    0.301714] EISA: Probing bus 0 at eisa.0
[    0.302070] EISA: Detected 0 cards.
[    0.302382] cpuidle: using governor ladder
[    0.302705] cpuidle: using governor menu
[    0.303144] TCP cubic registered
[    0.303486] NET: Registered protocol family 10
[    0.307493] NET: Registered protocol family 17
[    0.307879] Registering the dns_resolver key type
[    0.308450] Using IPI No-Shortcut mode
[    0.308851] registered taskstats version 1
[    0.309247]   Magic number: 3:503:55
[    0.309607] rtc_cmos 00:01: setting system clock to 2011-11-10 
02:05:37 UTC (1320890737)
[    0.310267] BIOS EDD facility v0.16 2004-Jun-25, 0 devices found
[    0.310740] EDD information not available.
[    0.486394] ata2.00: ATAPI: QEMU DVD-ROM, 0.15.91, max UDMA/100
[    0.487115] ata2.00: configured for MWDMA2
[    0.574862] isapnp: No Plug & Play device found
[    0.575471] scsi 1:0:0:0: CD-ROM            QEMU     QEMU DVD-ROM     
0.15 PQ: 0 ANSI: 5
[    0.579636] sr0: scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[    0.580202] cdrom: Uniform CD-ROM driver Revision: 3.20
[    0.580898] sr 1:0:0:0: A ttached scsi generic sg0 type 5
[    0.581374] md: Waiting for all devices to be available before autodetect
[    0.581918] md: If you don't use raid, use raid=noautodetect
[    0.582448] md: Autodetecting RAID arrays.
[    0.582781] md: Scanned 0 and added 0 devices.
[    0.583140] md: autorun ...
[    0.583363] md: ... autorun DONE.
......

My qemu does not behave as yours,even with kernel parameter "-noapic",it 
still not run normally.
Max Filippov - Nov. 10, 2011, 9:05 a.m.
> I applied the patch: 
> http://lists.nongnu.org/archive/html/qemu-devel/2011-11/msg01109.html.
> But I feel it doesn't affect anything.
> 
> I am using QEMU-1.0 rc1,pulled on 9 Nov.
> QEMU emulator version 0.15.91.
> 
> Then,
> /usr/local/bin/qemu-system-x86_64 -enable-kvm -m 1024 -kernel 

Oh, I didn't use -enable-kvm. With that switch it hangs for me as well.

> vmlinuz-2.6.38-8-generic -append 'ro noapic=1 console=ttyS0' -serial 
> stdio -icount auto

[...]

Thanks.
-- Max
Paolo Bonzini - Nov. 10, 2011, 9:15 a.m.
On 11/10/2011 10:05 AM, Max Filippov wrote:
>> >  /usr/local/bin/qemu-system-x86_64 -enable-kvm -m 1024 -kernel
> Oh, I didn't use -enable-kvm. With that switch it hangs for me as well.
>
>> >  vmlinuz-2.6.38-8-generic -append 'ro noapic=1 console=ttyS0' -serial
>> >  stdio -icount auto

-icount should be ignored or give an error together with KVM.  Would you 
like to prepare a patch?

Thanks,

Paolo
Max Filippov - Nov. 10, 2011, 10:25 a.m.
>>> >  /usr/local/bin/qemu-system-x86_64 -enable-kvm -m 1024 -kernel
>>
>> Oh, I didn't use -enable-kvm. With that switch it hangs for me as well.
>>
>>> >  vmlinuz-2.6.38-8-generic -append 'ro noapic=1 console=ttyS0' -serial
>>> >  stdio -icount auto
>
> -icount should be ignored or give an error together with KVM.  Would you

What's the background for that? (Unfortunately I'm completely
unfamiliar with kvm).

> like to prepare a patch?

Just sent it.
Paolo Bonzini - Nov. 10, 2011, 11:25 a.m.
On 11/10/2011 11:25 AM, Max Filippov wrote:
>> >
>> >  -icount should be ignored or give an error together with KVM.  Would you
> What's the background for that? (Unfortunately I'm completely
> unfamiliar with kvm).
>

With -icount, The vm_clock is updated with help from TCG (it counts 
instructions at 2^ICOUNT ns/instructions).  With KVM, the instruction 
count is not available so KVM cannot provide this help.

The patch you sent looks good, but perhaps you can include the above 
comment in the commit message and also include Xen?  With these changes, 
you can add my Acked-by.

Thanks,

Paolo
Benoit Canet - Nov. 13, 2011, 9:57 p.m.
I bissected with -icount+hpet looping behavior without kvm to:

commit 16b29ae1807b024bd5052301550f5d47dae958a2
Author: aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Date:   Wed Dec 17 23:28:44 2008 +0000

    Add HPET emulation to qemu (Beth Kon)

On Thu, Nov 10, 2011 at 12:25 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 11/10/2011 11:25 AM, Max Filippov wrote:
>
>> >
>>> >  -icount should be ignored or give an error together with KVM.  Would
>>> you
>>>
>> What's the background for that? (Unfortunately I'm completely
>> unfamiliar with kvm).
>>
>>
> With -icount, The vm_clock is updated with help from TCG (it counts
> instructions at 2^ICOUNT ns/instructions).  With KVM, the instruction count
> is not available so KVM cannot provide this help.
>
> The patch you sent looks good, but perhaps you can include the above
> comment in the commit message and also include Xen?  With these changes,
> you can add my Acked-by.
>
> Thanks,
>
> Paolo
>
>

Patch

diff --git a/hw/hpet.c b/hw/hpet.c
index 12bd64d..eadec7b 100644
--- a/hw/hpet.c
+++ b/hw/hpet.c
@@ -297,13 +297,17 @@  static void hpet_timer(void *opaque)
             }
         }
         diff = hpet_calculate_diff(t, cur_tick);
-        qemu_mod_timer(t->qemu_timer,
-                       qemu_get_clock_ns(vm_clock) +
(int64_t)ticks_to_ns(diff));
+        if (diff) {
+            qemu_mod_timer(t->qemu_timer,
+                    qemu_get_clock_ns(vm_clock) + (int64_t)ticks_to_ns(diff));
+        }
     } else if (t->config & HPET_TN_32BIT && !timer_is_periodic(t)) {
         if (t->wrap_flag) {
             diff = hpet_calculate_diff(t, cur_tick);
-            qemu_mod_timer(t->qemu_timer, qemu_get_clock_ns(vm_clock) +
-                           (int64_t)ticks_to_ns(diff));
+            if (diff) {
+                qemu_mod_timer(t->qemu_timer, qemu_get_clock_ns(vm_clock) +
+                        (int64_t)ticks_to_ns(diff));
+            }
             t->wrap_flag = 0;
         }