Bug 818829 - the qemu-kvm CPU usage cann't reduce to 0% when freeze (stop) the guest tasks in cgroups
the qemu-kvm CPU usage cann't reduce to 0% when freeze (stop) the guest tasks...
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.3
x86_64 Linux
medium Severity high
: rc
: ---
Assigned To: Virtualization Maintenance
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-04 01:49 EDT by Sibiao Luo
Modified: 2012-05-04 05:40 EDT (History)
14 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-05-04 05:40:41 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Sibiao Luo 2012-05-04 01:49:04 EDT
Description of problem:
the qemu-kvm CPU usage cann't reduce to 0% after freeze (stop) the guest tasks in cgroups.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm-rhev
2.6.32-269.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.290.el6.x86_64
guest info:
guest name: RHEL6.3-20120502.3-Server-x86_64
# uname -r
2.6.32-269.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.setup.
# mkdir /mnt/cgroup
# mount -t cgroup -o freezer none /mnt/cgroup
# cd /mnt/cgroup
2.boot guest and create a child cgroup.
# mkdir /mnt/cgroup/freezer
3.run a script in the guest.
# cat script.c 
#include <stdio.h>

int main(void){
        int i;

        for(;;){
                i += 1;
        }

        return 0;
}
4.put qemu-kvm task into this cgroup.
# echo `pidof qemu-kvm` > /mnt/cgroup/freezer/tasks
5.freeze the task.
# echo FROZEN > /mnt/cgroup/freezer/freezer.state
6.check guest status with 'top'.
  
Actual results:
after the step 6, the guest were in stop and the CPU usage as following,
# top
...
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                  
 4416 root      20   0 3022m 836m 5208 D 99.8 10.7  70:31.70 qemu-kvm
...

Expected results:
the CPU usage is 0%.

Additional info:
1.if i stop the guest directly instead of freeze in monitor, the qemu-kvm CPU usage can reduce to 0%.
(qemu) info status 
VM status: running
(qemu) stop
handle_dev_stop: stop
(qemu) info status 
VM status: paused
after the step 6,
# top
...
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                  
 4416 root      20   0 3022m 836m 5208 S  0.3 10.7  69:19.65 qemu-kvm
...
2.CLI: # /usr/libexec/qemu-kvm -M rhel6.3.0 -cpu SandyBridge -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -usb -device usb-tablet,id=input0 -name sluo_test -uuid `uuidgen` -drive file=/home/RHEL6.3-20120502.3-Server-x86_64.qcow2,format=qcow2,if=none,id=drive-disk,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,scsi=off,drive=drive-disk,id=blk_image,bootindex=1 -netdev tap,id=hostnet0,script=/etc/qemu-ifup -device rtl8139,netdev=hostnet0,id=virtio-net-pci0,mac=08:2E:5F:0A:0D:A1,bus=pci.0,bootindex=2 -device virtio-balloon-pci,id=balloon0,bus=pci.0 -spice port=5931,disable-ticketing -vga qxl -global qxl-vga.vram_size=67108864 -nodefconfig -nodefaults -device sga -chardev socket,path=/tmp/sluo-test,server,nowait,id=isa1 -device isa-serial,chardev=isa1,id=isa-serial1 -boot menu=on -monitor stdio
Comment 1 Sibiao Luo 2012-05-04 05:40:41 EDT
when I put qemu-kvm task(contain threads) into this cgroup, and freeze the task, the CPU usage is 0%, and unfreeze the task, the CPU usage is 100%. so, this is not a bug, close it.

Steps to Reproduce:
1.setup.
# mkdir /mnt/cgroup
# mount -t cgroup -o freezer none /mnt/cgroup
# cd /mnt/cgroup
2.boot guest and create a child cgroup.
# mkdir /mnt/cgroup/freezer
3.run a script in the guest.
# cat script.c 
#include <stdio.h>

int main(void){
        int i;

        for(;;){
                i += 1;
        }

        return 0;
}
4.put qemu-kvm task(contain threads) into this cgroup.
# ps -eLf | grep qemu-kvm  To get the LWP (thread ID)
# echo `$thread ID` > /mnt/cgroup/freezer/tasks
5.freeze the task.
# echo FROZEN > /mnt/cgroup/freezer/freezer.state
6.check guest status with 'top'.
7.unfreeze the task.
# echo THAWED > /mnt/cgroup/freezer/freezer.state

Actual results:
after the step 6, the guest were in stop and the CPU usage is 0%,
# top -H -p 7763

top - 17:26:15 up  6:46,  4 users,  load average: 0.00, 0.27, 0.45
Tasks:   5 total,   0 running,   5 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   8017836k total,  6315460k used,  1702376k free,    39548k buffers
Swap:  8159224k total,        0k used,  8159224k free,  5011812k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                  
 7763 root      20   0 2882m 796m 5200 D  0.0 10.2   0:07.10 qemu-kvm                                                 
 7773 root      20   0 2882m 796m 5200 D  0.0 10.2   7:24.67 qemu-kvm                                                 
 7774 root      20   0 2882m 796m 5200 D  0.0 10.2   7:28.30 qemu-kvm                                                 
 7775 root      20   0 2882m 796m 5200 D  0.0 10.2   0:01.45 qemu-kvm                                                 
 8137 root      20   0 2882m 796m 5200 D  0.0 10.2   0:00.00 qemu-kvm

after the step 7, the guest was running, and the CPU usage is 100%,
# top -H -p 7763

top - 17:28:08 up  6:48,  4 users,  load average: 0.52, 0.32, 0.44
Tasks:   5 total,   1 running,   4 sleeping,   0 stopped,   0 zombie
Cpu(s): 12.6%us,  0.2%sy,  0.0%ni, 87.0%id,  0.2%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   8017836k total,  6349136k used,  1668700k free,    39604k buffers
Swap:  8159224k total,        0k used,  8159224k free,  5011808k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                  
 7773 root      20   0 2882m 831m 5208 R 99.9 10.6   8:11.56 qemu-kvm                                                 
 7763 root      20   0 2882m 831m 5208 S  2.3 10.6   0:07.87 qemu-kvm                                                 
 7774 root      20   0 2882m 831m 5208 S  0.0 10.6   7:28.50 qemu-kvm                                                 
 7775 root      20   0 2882m 831m 5208 S  0.0 10.6   0:01.49 qemu-kvm                                                 
 8234 root      20   0 2882m 831m 5208 S  0.0 10.6   0:00.00 qemu-kvm

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