저는 Intel (R) Xeon (R) CPU E3-1230 v2 (총 8 코어)의 KVM 호스트를 실행하고있었습니다. VLC 플레이어를 사용하여 1080p 비디오를 재생할 때 KVM 프로세스의 결과는 perf stat
입니다.Qemu + kvm high cpu 사용
Performance counter stats for process id '120879':
65235.881169 task-clock # 1.631 CPUs utilized [100.00%]
99,073 context-switches # 0.002 M/sec [100.00%]
16,616 cpu-migrations # 0.255 K/sec [100.00%]
8,280 page-faults # 0.127 K/sec
129,136,372,749 cycles # 1.980 GHz [100.00%]
69,852,938,816 stalled-cycles-frontend # 54.09% frontend cycles idle [100.00%]
<not supported> stalled-cycles-backend
176,171,866,933 instructions # 1.36 insns per cycle
# 0.40 stalled cycles per insn [100.00%]
13,853,398,215 branches # 212.359 M/sec [100.00%]
313,064,663 branch-misses # 2.26% of all branches
40.001590915 seconds time elapsed
VM 게스트가 너무 많은 CPU를 소비하고 있습니다. 나는 실제 CPU 주파수가 3.3GHz 인 동안 결과의 주파수가 1.98GHz 인 이유를 궁금해한다 (cpufreq 주지사는 성능으로 설정된다). 또한 컨텍스트 스위치 및 CPU 마이그레이션은 매우 빈번합니다. 유일한 실행 응용 프로그램은 VLC입니다.
프로세스의 perf kvm --host --guest stat
결과는 다음과 같습니다
Performance counter stats for process id '17720':
6935.898736 task-clock:HG # 1.653 CPUs utilized [100.00%]
11,713 context-switches:HG # 0.002 M/sec [100.00%]
2,027 cpu-migrations:HG # 0.292 K/sec [100.00%]
460,754 page-faults:HG # 0.066 M/sec
24,166,977,190 cycles:HG # 3.484 GHz [100.00%]
12,972,225,263 stalled-cycles-frontend:HG # 53.68% frontend cycles idle [100.00%]
<not supported> stalled-cycles-backend:HG
33,789,733,514 instructions:HG # 1.40 insns per cycle
# 0.38 stalled cycles per insn [100.00%]
3,111,479,733 branches:HG # 448.605 M/sec [100.00%]
60,351,733 branch-misses:HG # 1.94% of all branches
4.196966586 seconds time elapsed
은 (일부 장치 및 chardev 옵션은 생략) QEMU-KVM의 구성은 다음과 같습니다 제가 CPU 사용량을 줄이기 어떻게
qemu-kvm
-chardev socket,id=qmp,path=/var/run/qemu-server/$vmid.qmp,server,nowait
-mon chardev=qmp,mode=control
-vnc :0,websocket,to=200
-enable-kvm
-daemonize
-smp sockets=1,cores=2
-cpu core2duo,hv_spinlocks=0xffff,hv_relaxed,hv_time,hv_vapic,+sse4.1,+sse4.2,+x2apic,+pcid,+pdcm,+xtpr,+ht,+ss,+acpi,+ds
-nodefaults
-vga qxl
-spice port=0,disable-ticketing,up_port=5699,down_port=5500,os_type=win7,jpeg-wan-compression=never,jpeg_quality=85,streaming-video=filter
-boot menu=off,splash-time=1
-m 4096
-drive file=/sf/data/local/images/host-001e67b7f807/9cef0faa00d6/Win7x86-VM0001_hzq.vm/vm-disk-1.qcow2,if=none,id=drive-virtio0,cache=none,aio=native,forecast=enable,cache_cnt=4096,cache_size=256
-device virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,bootindex=100
-rtc driftfix=slew,clock=rt,base=localtime
-global kvm-pit.lost_tick_policy=discard
-global PIIX4_PM.disable_s3=1
-chardev socket,path=/var/run/qemu-server/$vmid.virtser,server,nowait,id=channelser
-device qxl
KVM의?
에뮬레이션을 시작할 때 -enable-kvm 매개 변수를 전달 했습니까? – ViniCoder
@ViniCoder 예, -enable-kvm이 구성되었습니다. – useprxf