All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Hetze <s.hetze@linux-ag.com>
To: Avi Kivity <avi@redhat.com>
Cc: Sebastian Hetze <s.hetze@linux-ag.com>, kvm@vger.kernel.org
Subject: Re: Strange CPU usage pattern in SMP guest
Date: Sun, 21 Mar 2010 13:02:36 +0100	[thread overview]
Message-ID: <20100321120236.761EBA0017@mail.linux-ag.de> (raw)
In-Reply-To: <4BA5F03C.1020900@redhat.com>

On Sun, Mar 21, 2010 at 12:09:00PM +0200, Avi Kivity wrote:
> On 03/21/2010 02:13 AM, Sebastian Hetze wrote:
>> Hi *,
>>
>> in an 6 CPU SMP guest running on an host with 2 quad core
>> Intel Xeon E5520 with hyperthrading enabled
>> we see one or more guest CPUs working in a very strange
>> pattern. It looks like all or nothing. We can easily identify
>> the effected CPU with xosview. Here is the mpstat output
>> compared to one regular working CPU:
>>
>>
>> mpstat -P 4 1
>> Linux 2.6.31-16-generic-pae (guest) 	21.03.2010 	_i686_	(6 CPU)
>> 00:45:19     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
>> 00:45:20       4    0,00  100,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00
>> 00:45:21       4    0,00  100,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00
>> 00:45:22       4    0,00  100,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00
>> 00:45:23       4    0,00  100,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00
>> 00:45:24       4    0,00   66,67    0,00    0,00    0,00   33,33    0,00    0,00    0,00
>> 00:45:25       4    0,00  100,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00
>> 00:45:26       4    0,00  100,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00
>>    
>
> Looks like the guest is only receiving 3-4 timer interrupts per second,  
> so time becomes quantized.
>
> Please run the attached irqtop in the affected guest and report the results.
>
> Is the host overly busy?  What host kernel, kvm, and qemu are you  
> running?  Is the guest running an I/O workload? if so, how are the disks  

The host is not busy at all. In fact, currently it is running only one
guest. The host is running an ubuntu 2.6.31-14-server kernel. qemu-kvm
is 0.12.2-0ubuntu6. The kvm module has srcversion: 82D6B673524596F9CF3E84C
as stated by modinfo.

The guest occasionally is running IO workload. However, the effect is
visible all the time. And it is only one out of 6 CPUs the very same guest
is running. This is the output on the guest for all CPUs:

mpstat -P ALL 1
12:45:59     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
12:46:00     all    0,40    9,74    2,39    5,37    0,80    3,98    0,00    0,00   77,34
12:46:00       0    1,00    5,00    6,00    3,00    1,00    9,00    0,00    0,00   75,00
12:46:00       1    0,00   23,00    2,00   10,00    0,00    0,00    0,00    0,00   65,00
12:46:00       2    0,00    5,94    0,99    6,93    0,00    1,98    0,00    0,00   84,16
12:46:00       3    0,00    8,00    2,00    5,00    2,00    9,00    0,00    0,00   74,00
12:46:00       4    0,00   33,33    0,00    0,00    0,00    0,00    0,00    0,00   66,67
12:46:00       5    0,00    5,94    0,00    3,96    0,00    0,99    0,00    0,00   89,11

12:46:00     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
12:46:01     all    0,60    5,81    3,21   24,45    0,40    3,61    0,00    0,00   61,92
12:46:01       0    1,01    4,04    7,07   31,31    1,01    6,06    0,00    0,00   49,49
12:46:01       1    0,00    5,00    2,00   19,00    0,00    2,00    0,00    0,00   72,00
12:46:01       2    0,99    7,92    1,98   35,64    0,00    2,97    0,00    0,00   50,50
12:46:01       3    1,98    4,95    2,97   13,86    0,00    6,93    0,00    0,00   69,31
12:46:01       4    0,00   33,33    0,00    0,00    0,00    0,00    0,00    0,00   66,67
12:46:01       5    0,00    8,08    3,03   22,22    0,00    1,01    0,00    0,00   65,66

12:46:01     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
12:46:02     all    2,38   12,70   17,06   14,68    0,60    1,98    0,00    0,00   50,60
12:46:02       0    3,96   15,84    9,90   13,86    0,00    2,97    0,00    0,00   53,47
12:46:02       1    2,97    6,93    5,94   19,80    2,97    2,97    0,00    0,00   58,42
12:46:02       2    2,02   17,17    8,08   18,18    2,02    1,01    0,00    0,00   51,52
12:46:02       3    2,02   10,10    8,08   14,14    0,00    2,02    0,00    0,00   63,64
12:46:02       4    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:02       5    0,00   13,00   55,00    6,00    0,00    1,00    0,00    0,00   25,00

12:46:02     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
12:46:03     all    0,20   11,35   10,96    8,96    0,40    2,99    0,00    0,00   65,14
12:46:03       0    1,00   11,00    7,00   15,00    0,00    1,00    0,00    0,00   65,00
12:46:03       1    0,00    7,14    2,04    6,12    1,02   11,22    0,00    0,00   72,45
12:46:03       2    0,00   15,00    1,00   12,00    0,00    1,00    0,00    0,00   71,00
12:46:03       3    0,00   11,00   23,00    8,00    0,00    0,00    0,00    0,00   58,00
12:46:03       4    0,00    0,00   50,00    0,00    0,00    0,00    0,00    0,00   50,00
12:46:03       5    0,00   13,00   20,00    4,00    0,00    1,00    0,00    0,00   62,00

So it is only CPU4 that is showing this strange behaviour.
The same time on the host:

mpstat -P ALL 1
12:46:00     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
12:46:01     all    0,16    0,00    1,92    1,37    0,00    0,05    0,00    5,97   90,53
12:46:01       0    1,00    0,00    9,00   25,00    0,00    1,00    0,00   17,00   47,00
12:46:01       1    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:01       2    0,00    0,00   13,08    0,00    0,00    0,00    0,00   17,69   69,23
12:46:01       3    0,00    0,00    2,06    0,00    0,00    0,00    0,00    8,25   89,69
12:46:01       4    0,95    0,00    0,95    0,00    0,00    0,00    0,00   22,86   75,24
12:46:01       5    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:01       6    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:01       7    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:01       8    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:01       9    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:01      10    0,87    0,00    5,22    0,00    0,00    0,00    0,00   23,48   70,43
12:46:01      11    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
12:46:01      12    0,00    0,00    0,00    0,00    0,00    0,00    0,00   10,20   89,80
12:46:01      13    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
12:46:01      14    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
12:46:01      15    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00

12:46:01     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
12:46:02     all    0,20    0,00    0,53    4,92    0,00    0,13    0,00    6,25   87,97
12:46:02       0    0,00    0,00    2,00   74,00    0,00    2,00    0,00    1,00   21,00
12:46:02       1    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:02       2    0,00    0,00    3,06    0,00    0,00    0,00    0,00   28,57   68,37
12:46:02       3    1,11    0,00    1,11    0,00    0,00    0,00    0,00   22,22   75,56
12:46:02       4    0,00    0,00    0,00    0,00    0,00    0,00    0,00    7,87   92,13
12:46:02       5    0,00    0,00    0,95    0,00    0,00    0,00    0,00    0,00   99,05
12:46:02       6    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
12:46:02       7    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:02       8    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:02       9    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:02      10    0,92    0,00    0,92    0,00    0,00    0,00    0,00   22,02   76,15
12:46:02      11    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:02      12    1,08    0,00    0,00    0,00    0,00    0,00    0,00   15,05   83,87
12:46:02      13    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
12:46:02      14    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
12:46:02      15    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00

12:46:02     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
12:46:03     all    0,26    0,00    1,12    1,97    0,00    0,07    0,00   13,93   82,65
12:46:03       0    1,00    0,00    6,00   30,00    0,00    1,00    0,00    0,00   62,00
12:46:03       1    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:03       2    0,00    0,00    0,00    0,00    0,00    0,00    0,00   82,18   17,82
12:46:03       3    0,00    0,00    4,76    0,00    0,00    0,00    0,00   38,10   57,14
12:46:03       4    0,00    0,00    0,00    0,00    0,00    0,00    0,00   16,49   83,51
12:46:03       5    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:03       6    0,34    0,00    1,01    0,00    0,00    0,00    0,00   11,11   87,54
12:46:03       7    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:03       8    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:03       9    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00
12:46:03      10    2,25    0,00    0,00    0,00    0,00    0,00    0,00   26,97   70,79
12:46:03      11    0,00    0,00    1,67    0,00    0,00    0,00    0,00    0,00   98,33
12:46:03      12    0,00    0,00    1,98    0,00    0,00    0,00    0,00   15,84   82,18
12:46:03      13    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
12:46:03      14    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
12:46:03      15    0,00    0,00    0,00    0,00    0,00    0,00    0,00    0,00  100,00


your irqtop on the guest shows something like:

 Local timer interrupts              1257
 Rescheduling interrupts              849
 eth0                                 715
 ata_piix                              24
 virtio0-input                          1


Disk configuration of the guest is a single LVM volume running as raw image.

Here is the qemu-kvm command line:
/usr/bin/qemu-system-x86_64 -S -M pc-0.12 -cpu qemu32 -m 8192 -smp 6 -name guest -uuid dac8c0df-5848-48e5-904e-5548fcb5e614 -monitor unix:/var/lib/libvirt/qemu/guest.monitor,server,nowait -boot c -drive file=/dev/drbd/by-res/guest,if=ide,index=0,boot=on,format=host_device,cache=none -net nic,macaddr=24:09:61:01:32:00,vlan=0,model=virtio,name=virtio.0 -net tap,fd=20,vlan=0,name=tap.0 -serial pty -parallel none -usb -vnc 127.0.0.1:0 -k de -vga cirrus -soundhw es1370 -pcidevice host=01:00.0 -pcidevice host=06:00.1


  reply	other threads:[~2010-03-21 12:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-21  0:13 Strange CPU usage pattern in SMP guest Sebastian Hetze
2010-03-21 10:09 ` Avi Kivity
2010-03-21 12:02   ` Sebastian Hetze [this message]
     [not found]   ` <20100321120236.55228A0015@mail.linux-ag.de>
2010-03-21 12:19     ` Avi Kivity
2010-03-21 14:55       ` Sebastian Hetze
     [not found]       ` <20100321145548.CC027A0015@mail.linux-ag.de>
2010-03-21 15:17         ` Avi Kivity
2010-03-21 15:47           ` Sebastian Hetze
2010-03-22 12:51           ` Sebastian Hetze
2010-03-23 21:18             ` Marcelo Tosatti
2010-03-30  8:27               ` Sebastian Hetze
     [not found]               ` <20100330082743.49A113030135@mail.linux-ag.de>
2010-04-05 21:24                 ` Sebastian Hetze

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=20100321120236.761EBA0017@mail.linux-ag.de \
    --to=s.hetze@linux-ag.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.