Re: CPU utilization between physical CPU and virtual CPU in KVM

From: Dennis Chen
Date: Tue Oct 16 2012 - 01:06:06 EST


Any body can be help about this or a little bit clues? Thanks!

On Mon, Oct 8, 2012 at 3:01 PM, Dennis Chen <kernel.org.gnu@xxxxxxxxx> wrote:
> Hi All,
>
> I am confused by the following observed scenario:
>
> In my 4-CPU (KVM supported, 2 core with 2 thread for each) host
> machine box, I create only one VM with 3-vCPU through virsh/libvirt
> tools and also I pin this VM process to the physical processor 3. I
> guess the CPU utilization for the processor 3 will not exceed 100%,
> then I create 3 process (dead loop-- while(1);) and bind each of them
> to vCPU[0-2] respectively, through the "top -c" command in VM
> environment, I can see the CPU utilization for each of the vCPU is
> about 100%, but interesting, I found that the CPU utilization of
> processor 3 in the host machine is about 300% with "toc -c" command.
> why does a single process bound to a CPU can get ~300% cpu bandwidth
> in this case, does the kernel scheduler dispatch the idle cycle
> capacity of the CPUs to the virtual CPU of the VM, other word, the
> scheduler knows the vCPU info in the VM process?
>
> For the same case, if I create another 4 new dead-loop processes and
> bind them to the physical CPU[0-3] equally, then I find the vCPU0/1 in
> VM will not be 100%, eg. 32%, (I think the scheduler in the guest OS
> doesn't know it's running in a virtual environment, so the utilization
> of the vCPU will not change to adapt to the physical processor
> utilization, but it did, why?
>
> -org-gnu
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/