Bug 806238

Summary: Unmatched the cpu usage from virt-top to task manager in the guest.
Product: Red Hat Enterprise Linux 6 Reporter: dyuan
Component: virt-topAssignee: Richard W.M. Jones <rjones>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: mzhan, rwu, yupzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 806235 Environment:
Last Closed: 2012-08-14 08:04:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 806235    
Bug Blocks:    

Description dyuan 2012-03-23 09:45:24 UTC
virt-top should present the current state of guest.

+++ This bug was initially created as a clone of Bug #806235 +++

Description of problem:
In the guest, the cpu usage is 100% from task manager, but it's around 29% from virt-manager.
It's better to return "no respons" when the guest cpu usage reached 100% but not stay at 29%, or it will be confused for users.

Version-Release number of selected component (if applicable):
virt-manager-0.9.0-10.el6.x86_64
virt-top-1.0.4-3.12.el6.x86_64
python-virtinst-0.600.0-7.el6.noarch
libvirt-0.9.10-6.el6

How reproducible:
always

Steps to Reproduce:
1. boot up a guest, xp-i386
2. open the IE browser, or issue other programme to occupy 100% cpu
3. track the cpu usage from task manager
  
Actual results:
unmatched cpu usage from the tools to the guest task manager.

Expected results:
Presents the current state of guest.

Additional info:

Comment 1 Richard W.M. Jones 2012-03-23 09:52:16 UTC
100% CPU in the guest could correspond to [25%] CPU in the host.
It depends on the number of physical CPUs in the host and the
number of virtual CPUs in the guest.

Please give some more details of the host, such as number of
physical CPUs.  Also please give the guest libvirt XML.

Comment 2 dyuan 2012-03-26 03:22:01 UTC
I have 4 cpus in the host, and 1 vcpu in guest.

As you said, I'll try to increase the vcpu num to 4 for the test.

# virsh dumpxml xp
<domain type='kvm' id='17'>
  <name>xp</name>
  <uuid>18585065-c348-1c4f-46b9-fdfee279543b</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.3.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/winXP-32-virtio.qcow2'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:3a:5f:6c'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/4'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/4'>
      <source path='/dev/pts/4'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <graphics type='spice' port='5900' autoport='yes'/>
    <sound model='ich6'>
      <alias name='sound0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' vram='65536' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <video>
      <model type='qxl' vram='65536' heads='1'/>
      <alias name='video1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </video>
    <video>
      <model type='qxl' vram='65536' heads='1'/>
      <alias name='video2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c605,c770</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c605,c770</imagelabel>
  </seclabel>
</domain>

Comment 3 Richard W.M. Jones 2012-08-10 13:10:46 UTC
Not clear what you're expecting to see.

If this is a real bug, clone it for Fedora and provide a
clear test case.

Also, it might be a problem in libvirt (which collects the
stats) rather than virt-top (which just displays them).

Comment 4 dyuan 2012-08-14 08:04:08 UTC
Close it as NOTABUG according to comment 1, and it's the expected result for virt-top.