尽pipeWindows处于闲置状态,但KVM顶端显示Windows7 guest虚拟机的主机CPU负载过高

我们有一个虚拟化环境,实际上有4个虚拟机(2个Linux,1个W2K3,1个WIN7)。 在主机系统(Debian Jessie)中,即使guest虚拟机内部的taskmanager处于零CPU负载状态,win7 guest的qemu进程总是显示30-70%(或更多)的CPU负载。

top - 11:12:08 up 6 days, 1:47, 1 user, load average: 0,70, 0,62, 0,55 Tasks: 216 total, 2 running, 214 sleeping, 0 stopped, 0 zombie %Cpu(s): 5,0 us, 3,7 sy, 0,0 ni, 91,3 id, 0,0 wa, 0,0 hi, 0,0 si, 0,0 st KiB Mem: 24776900 total, 21591188 used, 3185712 free, 122680 buffers KiB Swap: 3905532 total, 60748 used, 3844784 free. 399364 cached Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 11138 libvirt+ 20 0 10,804g 8,243g 18536 R 70,1 34,9 2137:30 qemu-system-x86 12134 libvirt+ 20 0 7309216 6,046g 18792 S 3,7 25,6 139:13.88 qemu-system-x86 12055 libvirt+ 20 0 8900940 4,057g 18500 S 2,3 17,2 109:41.87 qemu-system-x86 12041 libvirt+ 20 0 2956240 1,388g 18292 S 2,0 5,9 61:38.55 qemu-system-x86 5569 root 20 0 1007924 23456 11012 S 1,0 0,1 1:16.86 libvirtd 

任务管理器在客户中的表现

在客人里面有一个MSSQL 2008 R2 Express运行。 为此设置Traceflag -T8038(根据proxmox性能调整 )。 此外平板电脑设备从configuration中删除,气球设备被禁用客人内(因为我不知道如何禁用它在虚拟机configuration)。 此外,它还运行一个Pervasive SQL 8服务器来触发旧的btrieve数据库。

奇怪的是,如果我完全删除来宾的所有NIC,最高的CPU负载下降到足够的水平(1-3%)。 实际上,作为一个NIC我通过其中一个物理网卡(英特尔I350)。 但是虚拟化网卡的行为是一样的。 所有这些testing没有任何客户端连接。

实际的访客configuration:

 <domain type='kvm'> <name>win7</name> <uuid>4b62c825-07ce-49b9-be8c-63f1f51ec28c</uuid> <memory unit='KiB'>8388608</memory> <currentMemory unit='KiB'>8388608</currentMemory> <vcpu placement='static'>2</vcpu> <os> <type arch='x86_64' machine='pc-i440fx-2.1'>hvm</type> </os> <features> <acpi/> <apic/> <hyperv> <relaxed state='on'/> <vapic state='on'/> <spinlocks state='on' retries='8191'/> </hyperv> </features> <cpu mode='host-model'> <model fallback='allow'/> <topology sockets='1' cores='2' threads='1'/> </cpu> <clock offset='localtime'> <timer name='rtc' tickpolicy='catchup'/> <timer name='pit' tickpolicy='delay'/> <timer name='hpet' present='no'/> <timer name='hypervclock' present='yes'/> </clock> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <pm> <suspend-to-mem enabled='no'/> <suspend-to-disk enabled='no'/> </pm> <devices> <emulator>/usr/bin/kvm</emulator> <disk type='block' device='disk'> <driver name='qemu' type='raw' cache='none' io='native'/> <source dev='/dev/vg_vm/lv_win7Pro'/> <target dev='vda' bus='virtio'/> <boot order='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <target dev='hdb' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='0' target='0' unit='1'/> </disk> <controller type='usb' index='0' model='ich9-ehci1'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> <master startport='0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/> </controller> <controller type='usb' index='0' model='ich9-uhci2'> <master startport='2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/> </controller> <controller type='usb' index='0' model='ich9-uhci3'> <master startport='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/> </controller> <controller type='pci' index='0' model='pci-root'/> <controller type='ide' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <controller type='virtio-serial' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </controller> <serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target type='serial' port='0'/> </console> <channel type='spicevmc'> <target type='virtio' name='com.redhat.spice.0'/> <address type='virtio-serial' controller='0' bus='0' port='1'/> </channel> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'/> <video> <model type='qxl' ram='65536' vram='65536' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <hostdev mode='subsystem' type='pci' managed='yes'> <source> <address domain='0x0000' bus='0x07' slot='0x00' function='0x1'/> </source> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </hostdev> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </memballoon> </devices> </domain> 

任何提示可能会导致这种情况,以及如何改善?

过去我也遇到过类似的问题,在客户端使用IRQ攻击,主机负载过重。 你必须隔离什么,在客人,是猛攻CPU。 总理候选人都是MSSQL实例和hal.dll库。

要debugging,请按照下列步骤操作:

  • 停止你的MSSQL实例。 主机负载是否减less? 如果是这样,你find了罪魁祸首。 重点是MSSQL使用一个高定时器频率(1毫秒),即使空闲。 裸机上,这不是一个问题(系统将使用更多的瓦特),但虚拟化的一个可能是一个问题。 如果可能的话,您应该确定Windows正在使用的计时器来源,并尝试在可用计时器之间切换。 作为一种解决方法,存在一个修补程序来将时钟定时器中断提高到12ms。 欲了解更多信息,请参阅这里和这里 。
  • 如果n.1点没有带来好处,也许问题是与HAL有关。 我看你正在使用两个vCPU; 尝试使用单个vCPU启动虚拟机。 这是否改变了什么? 如果不是,请执行Windows硬件选项卡(扩展HAL节点)的屏幕截图,然后在此处报告。

编辑:好吧,似乎也没有MSSQL或HAL是您的主机负载的根本原因。 进入第二个debugging阶段:

  • 停止虚拟机,并从其定义中删除所有的USB设备。 重新启动机器并检查主机负载:它已更改?
  • 如果不是,请使用powertop实用程序来监视主机的CPU活动。 在这里,你应该看到什么软件例程/中断服务最多。 在30秒内运行并返回此处。

我find了罪魁祸首。 在我们的环境中,我们有一个USB-over-IP服务器( Longshine LCS-US204 )。 客户端软件安装在特定的虚拟机上。 卸载客户端软件后,主机上的CPU负载降低到足够的水平。 似乎它一直在寻找连接。 删除所有的virtio-串口设备带来了另一个小的改进,现在主机负载在2-3%左右,当窗口空闲。 谢谢你的帮助。