Bug 783827 - Guest CPU usage is truncated at 100%.
Summary: Guest CPU usage is truncated at 100%.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: vdsm
Version: 6.2
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Dan Kenigsberg
QA Contact: yeylon@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-01-22 16:16 UTC by Yaniv Lavi
Modified: 2016-04-18 06:43 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-01-22 21:04:37 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Yaniv Lavi 2012-01-22 16:16:17 UTC
Description of problem:
Guest CPU usage is collected from the VM process CPU usage.
If you have a multi-core host the CPU usage can be higher than 100%.
Current the VM CPU samples are truncated at 100% and don't reflect the CPUs usage on the guest level (VM's CPU Usage = Host's CPU Usage / VM's CPUs). 
The result should still truncated at 100% to avoid overhead that will return more than 100%, but be divided by VM's CPUs to reflect the correct stats.

Version-Release number of selected component (if applicable):
vdsm-4.9-112.3.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Run VM with more than one core.
2. Load it beyond 100% CPU Usage. 
3. Check Guest CPU Usage.
  
Actual results:
Guest sees less usage than reported.

Expected results:
Reported result should be close to the one reported on the guest.

Comment 2 Dan Kenigsberg 2012-01-22 21:04:37 UTC
I'm sorry to have mislead you: a closer review of the code shows that vdsm reports cpu consumption of qemu processes similarly to top(1). For mutli-vcpu VMs, cpuUser+cpuSys may exceed 100% considerably.

        jiffies = (vms1.pidcpu.user - vms0.pidcpu.user) % 2**32
        stats['cpuUser'] = jiffies / interval

cpuUser is the jiffies per second, allocated to the qemu-kvm process (each host cpu provides 100 jiffies per second)


Note You need to log in before you can comment on or make changes to this bug.