Skip to contentSkip to conversation

VT is comically slow

DISCUSSION Rik van Riel 4 participants 9 messages Jul 3, 2006 – Jul 4, 2006

lore
Share & tools
lore
#0 lore raw

VT by itself seems fine, but once a VT domain is running a workload that is network intensive combined with a disk/cpu intensive workload, things get incredibly slow.

Operations that take less than a second with either workload running alone can now take many seconds, sometimes the better part of a minute!

Is this some limitation of the qemu device model?

Signature · 3 lines
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
#1 lore raw
Quoted 8 lines · Rik van Riel

VT by itself seems fine, but once a VT domain is running a workload that is network intensive combined with a disk/cpu intensive workload, things get incredibly slow.

Operations that take less than a second with either workload running alone can now take many seconds, sometimes the better part of a minute!

Is this some limitation of the qemu device model?

Looking at it a bit more closely, it appears that postgresql doing disk IO from inside a fully virtualized domain totally kills the CPU.

It gets so bad that a simple "dmesg" takes 10-20 seconds to start, and after that it spews data maybe 7 or 8 lines every other second. Actually slower than serial console...

This is totally unusable :(

Signature · 3 lines
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
#2 lore raw
Quoted 9 lines · Rik van Riel

Looking at it a bit more closely, it appears that postgresql doing disk IO from inside a fully virtualized domain totally kills the CPU.

It gets so bad that a simple "dmesg" takes 10-20 seconds to start, and after that it spews data maybe 7 or 8 lines every other second. Actually slower than serial console...

This is totally unusable :(

Might you be emulating PIO? That would certainly suck. The device model is supposed to support (virtual) DMA though.

-- Keir

#3 lore raw
Quoted 7 lines · Keir Fraser
Quoted 4 lines · Rik van Riel

Looking at it a bit more closely, it appears that postgresql doing disk IO from inside a fully virtualized domain totally kills the CPU.

Quoted 8 lines
Quoted 5 lines

It gets so bad that a simple "dmesg" takes 10-20 seconds to start, and after that it spews data maybe 7 or 8 lines every other second. Actually slower than serial console...

This is totally unusable :(

Might you be emulating PIO? That would certainly suck. The device model is supposed to support (virtual) DMA though.

That's the first thing I though about but apparently the kernel
runs the IDE device in DMA mode if one believe the hdparm output in that guest.

Daniel

Signature · 3 lines
Daniel Veillard      | Red Hat http://redhat.com/
[email protected]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
#4 lore raw
Quoted 11 lines · Daniel Veillard
Quoted 10 lines · Keir Fraser
Quoted 8 lines · Rik van Riel

Looking at it a bit more closely, it appears that postgresql doing disk IO from inside a fully virtualized domain totally kills the CPU.

It gets so bad that a simple "dmesg" takes 10-20 seconds to start, and after that it spews data maybe 7 or 8 lines every other second. Actually slower than serial console...

Quoted 6 lines
Quoted 2 lines
Quoted 1 line

This is totally unusable :(

Might you be emulating PIO? That would certainly suck. The device model is supposed to support (virtual) DMA though.

That's the first thing I though about but apparently the kernel
runs the IDE device in DMA mode if one believe the hdparm output in that guest.

The information is conflicting...

While hdparm suggests DMA, the kernel profile has a suspicious amount of IDE in it. Not sure what's going on...

# hdparm /dev/hda

/dev/hda:

 multcount    = 16 (on)
 IO_support   =  0 (default 16-bit)
 unmaskirq    =  0 (off)
 using_dma    =  1 (on)
 keepsettings =  0 (off)
 readonly     =  0 (off)
 readahead    = 256 (on)
 geometry     = 65535/16/63, sectors = 85899345920, start = 0
# readprofile | sort -n | tail -20
148632 copy_user_generic                        498.7651
163787 copy_page                                731.1920
178136 __might_sleep                            1017.9200
178409 ide_intr                                 141.7069
277185 ide_outsl                                39597.8571
324592 ide_execute_command                      772.8381
349538 sys_select                               300.0326
440036 unmap_vmas                               264.6037
478669 do_page_fault                            303.7240
585427 handle_IRQ_event                         6887.3765
1087766 ide_inw                                  120862.8889
1115456 ide_do_request                           950.1329
2169643 do_wp_page                               1662.5617
2945913 ide_outbsync                             736478.2500
3888598 i8042_interrupt                          6480.9967
5892214 do_no_page                               2986.4237
11803041 thread_return                            20890.3381
13074317 __do_softirq                             80705.6605
81661803 poll_idle                                983877.1446
130083897 total                                     52.4560
Signature · 3 lines
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
#5 lore raw
Quoted 49 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Rik van Riel
Sent: 03 July 2006 15:15
To: [email protected]
Cc: [email protected]
Subject: Re: [Xen-devel] VT is comically slow

Quoted 9 lines · Daniel Veillard
Quoted 8 lines · Keir Fraser
Quoted 6 lines · Rik van Riel

Looking at it a bit more closely, it appears that postgresql doing disk IO from inside a fully virtualized domain totally kills the CPU.

It gets so bad that a simple "dmesg" takes 10-20 seconds to start, and after that it spews data maybe 7 or 8 lines every

other second.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

Actually slower than serial console...

This is totally unusable :(

Might you be emulating PIO? That would certainly suck. The

device model

Quoted 5 lines
Quoted 1 line

is supposed to support (virtual) DMA though.

That's the first thing I though about but apparently the kernel
runs the IDE device in DMA mode if one believe the hdparm output in that guest.

The information is conflicting...

While hdparm suggests DMA, the kernel profile has a suspicious amount of IDE in it. Not sure what's going on...

# hdparm /dev/hda

/dev/hda:

  multcount    = 16 (on)
  IO_support   =  0 (default 16-bit)
  unmaskirq    =  0 (off)
  using_dma    =  1 (on)
  keepsettings =  0 (off)
  readonly     =  0 (off)
  readahead    = 256 (on)
  geometry     = 65535/16/63, sectors = 85899345920, start = 0
Quoted 6 lines
# readprofile | sort -n | tail -20
148632 copy_user_generic                        498.7651
163787 copy_page                                731.1920
178136 __might_sleep                            1017.9200
178409 ide_intr                                 141.7069
277185 ide_outsl                                39597.8571

This ...

Quoted 6 lines
324592 ide_execute_command                      772.8381
349538 sys_select                               300.0326
440036 unmap_vmas                               264.6037
478669 do_page_fault                            303.7240
585427 handle_IRQ_event                         6887.3765

1087766 ide_inw 120862.8889

And this...

Quoted 10 lines
1115456 ide_do_request                           950.1329
2169643 do_wp_page                               1662.5617
2945913 ide_outbsync                             736478.2500
3888598 i8042_interrupt                          6480.9967
5892214 do_no_page                               2986.4237
11803041 thread_return                            20890.3381
13074317 __do_softirq                             80705.6605
81661803 poll_idle                                983877.1446

130083897 total 52.4560

Are indications of IDE being used in PIO mode. Why this is, don't ask me...

Also, the read is 16-bit, making it twice as long as the read would be. That's a "bug" in qemu, because it doesn't fall-back to two 16-bit operations on reads, which it does for writes. [See default_ioport_readl vs default_ioport_writel - the latter calls the writew twice, but the former isn't doing the corresponding translation - don't know why this is. I hacked it a while back to do two 16-bit reads, and it seemed to work just fine for my miniature IDE-test application, but I don't know if there's something else somewhere that breaks if you try to do that...

--
Mats

Quoted 13 lines
Signature · 9 lines
-- 
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
#6 lore raw
Quoted 2 lines · Mats

Are indications of IDE being used in PIO mode. Why this is, don't ask me...

A friend is trying out OpenBSD inside Xen, which shows more clearly that HVM guests are indeed using PIO :(

pciide0 at pci0 dev 1 function 1 "Intel 82371SB IDE" rev 0x00: DMA, channel 0 wired to compatibility, channel 1 wired to compatibility wd0 at pciide0 channel 0 drive 0: <QEMU HARDDISK>
wd0: 16-sector PIO, LBA, 20480MB, 41943040 sectors
wd0(pciide0:0:0): using PIO mode 2
pciide0: channel 1 disabled (no drives)

That explains a lot...

Signature · 3 lines
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
#7 lore raw
Quoted 11 lines · Rik van Riel
Quoted 2 lines

Are indications of IDE being used in PIO mode. Why this is, don't ask me...

A friend is trying out OpenBSD inside Xen, which shows more clearly that HVM guests are indeed using PIO :(

pciide0 at pci0 dev 1 function 1 "Intel 82371SB IDE" rev 0x00: DMA, channel 0 wired to compatibility, channel 1 wired to compatibility wd0 at pciide0 channel 0 drive 0: <QEMU HARDDISK>
wd0: 16-sector PIO, LBA, 20480MB, 41943040 sectors
wd0(pciide0:0:0): using PIO mode 2
pciide0: channel 1 disabled (no drives)

You might need to investigate ioemu/hw/ide.c to find out why Linux/*BSD are deciding to use PIO for data transfers. Intel put in considerable effort a while back to ensure that DMA was used. Maybe that's got broken.

-- Keir

#8 lore raw
In reply to Rik van Riel
Quoted 6 lines · Rik van Riel

VT by itself seems fine, but once a VT domain is running a workload that is network intensive combined with a disk/cpu intensive workload, things get incredibly slow.

Operations that take less than a second with either workload running alone can now take many seconds, sometimes the better part of a minute!

You might want to try removing the call to pmtimer_init() in ioemu/hw/piix4acpi.c -- the pmtimer emulation is rather broken (burns 25% of a 3GHz cpu). I've just done this in xen-unstable.

-- Keir