Bug 999844

Summary: qemu-kvm cpu usage keeps 100% after DDOS attack by high frequency of pit timer
Product: Red Hat Enterprise Linux 6 Reporter: mazhang <mazhang>
Component: qemu-kvmAssignee: Bandan Das <bdas>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: bsarathy, chayang, flang, hhuang, juzhang, michen, mkenneth, qzhang, rbalakri, scui, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-18 15:47:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description mazhang 2013-08-22 09:06:48 UTC
Description of problem:
qemu-kvm cpu usage keeps 100% after DDOS attack by high frequency of pit timer


Version-Release number of selected component (if applicable):

host:
qemu-kvm-0.12.1.2-2.394.el6.x86_64
kernel-2.6.32-413.el6.x86_64

guest:
RHEL6U5-64

How reproducible:
100%

Steps to Reproduce:
1.boot guest with:
/usr/libexec/qemu-kvm \
-M pc \
-cpu SandyBridge \
-m 2G \
-smp 2,sockets=1,cores=2,threads=1 \
-enable-kvm \
-name rhel6u5 \
-uuid 990ea161-6b67-47b2-b803-19fb01d30d12 \
-smbios type=1,manufacturer='Red Hat',product='RHEV Hypervisor',version=el6,serial=koTUXQrb,uuid=feebc8fd-f8b0-4e75-abc3-e63fcdb67170 \
-k en-us \
-rtc base=utc,clock=host,driftfix=slew \
-nodefaults \
-monitor stdio \
-qmp tcp:0:6666,server,nowait \
-boot menu=on \
-bios /usr/share/seabios/bios.bin \
-monitor unix:/tmp/monitor-unix,nowait,server \
-vga qxl \
-spice port=5900,disable-ticketing \
-global PIIX4_PM.disable_s3=0 \
-global PIIX4_PM.disable_s4=0 \
-drive file=/home/rhel6u5.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,werror=stop,rerror=stop,aio=threads \
-device virtio-blk-pci,scsi=off,bus=pci.0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \

2. execute the following python script in guest:
import struct
f = file("/dev/port","rw+")

def outb(port, data):
    f.seek(port)
    f.write(struct.pack("B", data))

outb(0x43, 0x34)
outb(0x40, 0x1)
outb(0x40, 0x0)

outb(0x43, 0x35)
outb(0x41, 0x1)
outb(0x41, 0x0)

outb(0x43,0x36)
outb(0x42, 0x1)
outb(0x42, 0x0)

3.

Actual results:
qemu-kvm cpu usage keeps 100%

Tasks: 224 total,   2 running, 222 sleeping,   0 stopped,   0 zombie
Cpu(s):  6.6%us,  6.6%sy,  0.0%ni, 86.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   8000944k total,   808512k used,  7192432k free,    13008k buffers
Swap: 58720240k total,    10468k used, 58709772k free,    88972k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                     
12498 root      20   0 2774m 477m 5904 S 100.5  6.1  33:59.79 qemu-kvm                                   
12499 root      20   0     0    0    0 R 45.9  0.0  15:28.55 kvm-pit-wq                                  
12685 root      20   0 15144 1424 1008 R  0.3  0.0   0:01.93 top                                         
    1 root      20   0 19360 1468 1200 S  0.0  0.0   0:02.16 init                                        
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.02 kthreadd

Expected results:
qemu-kvm cpu usage can resume normal.

Additional info:
host cpu info
processor	: 7
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
stepping	: 9
cpu MHz		: 1600.000
cache size	: 8192 KB
physical id	: 0
siblings	: 8
core id		: 3
cpu cores	: 4
apicid		: 7
initial apicid	: 7
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips	: 6784.49
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management: