kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question about IPC statistics of vcpu thread
@ 2011-11-26  3:09 Chengjian Wen
  2011-11-27 10:25 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Chengjian Wen @ 2011-11-26  3:09 UTC (permalink / raw)
  To: kvm

Hi All,

I find a problem when I test the IPC of the kvm vcpu. My question is
that when the thread is a vcpu, whether the instructions we get from
perf stat includes
the part spending on the time vcpu had enter vmx or else it only
includes the time vm-exit.

I run NPB benchmark in the KVM which owns 4 vcpu and I use the
following command to get the IPC information of vcpu thread.
thread 3117 is the qemu-io thread, 3118,3119,3120,3121 are the vcpu
thread. I am curious that the why the IPC is so slow when the guest is
running a cpu-intensive application.

Here below is some output of my tests.

1." perf stat -t 3121"  run for 1 s , then get the following result.
[root@wenfedora hcfs]# perf stat -t 3121
^C
 Performance counter stats for thread id '3121':

         977.620697  task-clock-msecs         #      0.999 CPUs
                103  context-switches         #      0.000 M/sec
                  0  CPU-migrations           #      0.000 M/sec
                  0  page-faults              #      0.000 M/sec
         3005826152  cycles                   #   3074.634 M/sec
          825271483  instructions             #      0.275 IPC
          140665441  branches                 #    143.885 M/sec
           11731765  branch-misses            #      8.340 %
             256884  cache-references         #      0.263 M/sec
               3102  cache-misses             #      0.003 M/sec

        0.978720288  seconds time elapsed

2.output for "ps -eLf | grep qemu"
qemu      3117     1  3118 94    6 11:22 ?        00:23:02
/usr/bin/qemu-kvm -S -M pc-0.13 -enable-kvm -m 3869 -smp
4,sockets=4,cores=1,threads=1 -name c1 -uuid
1f335024-45fb-fadb-db63-34a64db9840d -nodefconfig -nodefaults -chardev
socket,id=monitor,path=/var/li

qemu      3117     1  3119 94    6 11:22 ?        00:22:59
/usr/bin/qemu-kvm -S -M pc-0.13 -enable-kvm -m 3869 -smp
4,sockets=4,cores=1,threads=1 -name c1 -uuid
1f335024-45fb-fadb-db63-34a64db9840d -nodefconfig -nodefaults -chardev
socket,id=monitor,path=/var/li

qemu      3117     1  3120 94    6 11:22 ?        00:23:00
/usr/bin/qemu-kvm -S -M pc-0.13 -enable-kvm -m 3869 -smp
4,sockets=4,cores=1,threads=1 -name c1 -uuid
1f335024-45fb-fadb-db63-34a64db9840d -nodefconfig -nodefaults -chardev
socket,id=monitor,path=/var/li

qemu      3117     1  3121 94    6 11:22 ?        00:23:00
/usr/bin/qemu-kvm -S -M pc-0.13 -enable-kvm -m 3869 -smp
4,sockets=4,cores=1,threads=1 -name c1 -uuid
1f335024-45fb-fadb-db63-34a64db9840d -nodefconfig -nodefaults -chardev
socket,id=monitor,path=/var/li

Thanks,
Chengjian

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question about IPC statistics of vcpu thread
  2011-11-26  3:09 Question about IPC statistics of vcpu thread Chengjian Wen
@ 2011-11-27 10:25 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2011-11-27 10:25 UTC (permalink / raw)
  To: Chengjian Wen; +Cc: kvm

On 11/26/2011 05:09 AM, Chengjian Wen wrote:
> Hi All,
>
> I find a problem when I test the IPC of the kvm vcpu. My question is
> that when the thread is a vcpu, whether the instructions we get from
> perf stat includes
> the part spending on the time vcpu had enter vmx or else it only
> includes the time vm-exit.

It includes both.  Linux 3.2 will allow the option of selecting one or
the other.

> I run NPB benchmark in the KVM which owns 4 vcpu and I use the
> following command to get the IPC information of vcpu thread.
> thread 3117 is the qemu-io thread, 3118,3119,3120,3121 are the vcpu
> thread. I am curious that the why the IPC is so slow when the guest is
> running a cpu-intensive application.
>
> Here below is some output of my tests.
>
> 1." perf stat -t 3121"  run for 1 s , then get the following result.
> [root@wenfedora hcfs]# perf stat -t 3121
> ^C
>  Performance counter stats for thread id '3121':
>
>          977.620697  task-clock-msecs         #      0.999 CPUs
>                 103  context-switches         #      0.000 M/sec
>                   0  CPU-migrations           #      0.000 M/sec
>                   0  page-faults              #      0.000 M/sec
>          3005826152  cycles                   #   3074.634 M/sec
>           825271483  instructions             #      0.275 IPC
>           140665441  branches                 #    143.885 M/sec
>            11731765  branch-misses            #      8.340 %
>              256884  cache-references         #      0.263 M/sec
>                3102  cache-misses             #      0.003 M/sec
>
>         0.978720288  seconds time elapsed

Try

  perf stat -e kvm:kvm_exit -e instructions -e cycles -e branches -e
branch-misses

to see if you have many exits.  What's the output of the same test when
the benchmark is running on the host?

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-27 10:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-26  3:09 Question about IPC statistics of vcpu thread Chengjian Wen
2011-11-27 10:25 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).